Tech Interview

dotnet interview questions

150views

Beginner .NET interview Questions

Q-1: What is the .NET framework?

The .NET framework supports an object-oriented approach that is used for building applications on windows. It supports various languages like C#, VB, Cobol, Perl, .NET, etc. It has a wide variety of tools and functionalities like class, library and APIs that are used to build, deploy and run web services and different applications.

 

Q-2: What are the different components of .NET?

Following are the components of .NET

  • Common Language run-time
  • Application Domain
  • Common Type System
  • .NET Class Library
  • .NET Framework
  • Profiling

Q-3: What do you know about CTS?

CTS stands for Common Type System. It follows certain rules according to which a data type should be declared and used in the program code. CTS also describes the data types that are going to be used in the application. We can even make our own classes and functions following the rules in the CTS, it helps in calling the data type declared in one program language by other programming languages.

Q-4: What is CLR?

CLR stands for common language run-time, it is an important component of the .NET framework. We can use CLR as a building block of various applications and provides a secure execution environment for applications.

Whenever an application written in C# is compiled, the code is converted into an intermediate language. After this, the code is targeted to CLR which then performs several operations like memory management, security checks, loading assemblies, and thread management.

Q-5: Explain CLS.

Common language specification helps the developers to use the components that are inter-language compatible with certain rules that come with CLS. It then helps in reusing the code in other .NET compatible languages.

Q-6: What do you know about JIT?

JIT is a compiler which stands for Just In Time. It is used to convert the intermediate code into the native language. During the execution, the intermediate code is converted into the native language.

Q-7: Why do we use Response.Output.Write()?

Response.Output.Write() is used to get the formatted output.

Q-8: What is the difference between Response.Redirect and Server.Transfer?

Response.Redirect basically redirects the user’s browser to another page or site. The history of the user’s browser is updated to reflect the new address as well. It also performs a trip back to the client where the client’s browser is redirected to the new page.

Whereas, Server.Transfer transfers from one page to the other without making any round-trip back to the client’s browser. The history does not get updated in the case of Server.Transfer.

Q-9: What is the difference between managed and unmanaged code?

Managed code Unmanaged code
Managed code is managed by CLR Any code that is not managed by CLR
.NET framework is necessary to execute managed code Independent of .NET framework
CLR manages memory management through garbage collection Own runtime environment for compilation and execution

Q-10: Explain the difference between a class and an object?

Class Object
Class is the definition of an object An object is an instance of a class.
It is a template of the object A class does not become an object unless instantiated
It describes all the methods, properties, etc An object is used to access all those properties from the class.

Q-11: What do you know about boxing and unboxing?

Boxing Unboxing
Implicit Explicit
Converting a value type to the type object Extracting the value type from the object
eg : obj myObject = i; eg : i = (int)myObject;

Q-12: Differentiate between constants and read-only variables.

Constants Read-only Variables
Evaluated at compile time Evaluated at run-time
Support only value type variables They can hold the reference type variables
They are used when the value is not changing at compile time Used when the actual value is unknown before the run-time
Cannot be initialized at the time of declaration or in a constructor Can be initialized at the time of declaration or in a constructor

Q-13: What is BCL?

  • BCL is a base class library of classes, interfaces and value types
  • It is the foundation of .NET framework applications, components, and controls
  • Encapsulates a huge number of common functions and make them easily available for the developers
  • It provides functionality like threading, input/output, security, diagnostics, resources, globalization, etc.
  • Also serves the purpose of interaction between user and runtime
  • It also provides namespaces that are used very frequently. for eg: system, system.Activities, etc.

Q-14: What are the different versions of the .NET framework?

Version  .NET Framework  Visual Studio
C# 1.0 .NET Framework 1.0/1.1 Visual Studio .NET 2002
C# 2.0 .NET Framework 2.0 Visual Studio 2005
C# 3.0 .NET Framework 3.0/3.5 Visual Studio 2008
C# 4.0 .NET Framework 4.0 Visual Studio 2010
C# 5.0 .NET Framework 4.5 Visual Studio 2012/2013
C# 6.0 .NET Framework 4.6 Visual Studio 2013/2015
C# 7.0 .NET CORE Visual Studio 2017

Q-15: What is the difference between namespace and assembly?

An assembly is a physical grouping of logical units whereas namespace groups classes. Also, a namespace can span multiple assemblies as well.

Q-16: What is LINQ?

It is an acronym for Language integrated query which was introduced with visual studio 2008. LINQ is a set of features that extend query capabilities to the .NET framework language syntax that allows data manipulation irrespective of the data source. LINQ bridges the gap between the world of objects and the world of data.

Q-17: What is MSIL?

MSIL is the Microsoft Intermediate Language, it provides instructions for calling methods, storing and initializing values, memory handling, exception handling and so on. All the .NET codes are first compiled to Intermediate Language.