If you’re looking to hire .NET Developer for your IT or software development department then you’re in luck as we have compiled some of the crucial questions that you must ask a .NET Developer.
Remote .NET Developer positions are hard to fill especially if you don’t have a background relevant to the framework. In such cases, it can’t be easy to identify which aspects to look at and which to ignore. Before we can go into each question individually you need to have some form of basic understanding of programming. If you don’t have a basic understanding, it’s better to bring on-board a team member who does. The problem is that .NET developer interview questions can get quite technical in a matter of seconds. Hence, it is essential that either you or someone who knows the framework is present within the interview.
1- What is .NET Framework?
A simple question that you can begin the interview with is to ask what is .NET framework. You must know what the .NET Framework is and when to use it and the main features. In essence, .NET is Microsoft Framework that allows .NET Developer to work with programming languages. Working as a development framework allows .NET Developer to compile, convert, and execute code. (dot NET) allows developers to formulate and create web-based applications and services.
2- What are the important components of .Net?
A basic question but an effective one to judge a developer’s knowledge base. There are two main components of .NET Framework. These include Common Language Runtime (CLR) & .NET Framework Class Library. The CLR’s function is to work as an execution engine that manages running applications. Whereas, .NET Framework Class Library provides a set of APIs and types for common functionality.
3- What is ASP.NET?
ASP.NET is an extension for .NET and adds a wide range of tools and libraries that are used to build web applications. It acts as a base framework for processing web requests in C# or F#.
4- What is OOP and its relevance to the .NET Framework?
OOP stands for object-oriented programming and some of the famous OOP languages include Visual Basic.NET, C# & C++. These OOP are supported by .NET Framework and can help programmers in creating containing methods, properties, and logical modules. .NET Developer can then use these features to make applications. In essence, OOP has four features which include polymorphism, inheritance, encapsulation & abstraction.
5- What does IL, CIL, JIT & CLI stand for in .NET, and what is their main function?
Every .NET developer must know the abbreviations of these acronyms as they are connected with each other and vital in terms of .NET development. IL stands for Intermediate Language which is primarily a CPU independent compiled code. Here Just in Time Compiler or JIT comes into play as it compiles IL code to native machine code and uses CPU architecture of the target machine to run a .NET application. CLI stands for Common Language Infrastructure which is developed by Microsoft as an open specification. CLI is a compiled code library used in deployment, security, and versioning.
6- Explain the Difference between managed and unmanaged code?
You must also check how a .NET Developer manages obstacles and one of the most common is how to deal with managed and unmanaged code. The differentiation between the two is essential to understand how .NET works in different coding environments. The basic difference lies between how Managed code is managed by and runs inside the CLR and needs the .NET framework to execute. On the contrary, Unmanaged code doesn’t need CLR to execute.
7- Can you Describe the Garbage Collection Process?
Garbage Collection Process is a process in .NET Framework which allows memory usage optimization. GRP takes or releases unused code which is in the memory and uses this code to optimize the process. The memory in a .NET framework is divided into three generations and the GRP releases unused code within these three generations. Code objects live in the three generations (0, 1, 2). Code objects within generation 0 are frequently released as they are short-lived, whereas the code objects in the other two generations are released less frequently.
8- What is the difference between an Interface and an Abstract Class in .NET?
Interface:
An Interface class is a set of class members that are specified and not implemented. It is a reference type and includes only abstract members like Methods, Properties, and Events but doesn’t contain any access modifiers. Interface can be seen as only a contract that implementing classes should follow. Once abstract members are declared then they must be implemented.
Abstract Class:
An abstract class on the other hand stays within partial implementation for functionalities. Some of the abstract members must be implemented by the inheriting entity.
9- What is a partial class in .Net?
In .NET Framework, it is possible to divide a class definition into more than one source file. Once this is done, a partial class is formed. Each partial class contains a part of the class definition. The end result is a combination of partial classes to develop applications.
10- What are Delegates and their Types?
A delegate can be defined as a reference type variable that always holds the reference towards a method. Delegate references can be changed within the runtime. There are two types of delegates:
Singlecast Delegate: When a delegate is assigned to a single method at one point of time, it means it is a Singlecast Delegate.
Multicast Delegate: When a delegate is assigned to more than a single method at one point of time then that delegate is known as Multicast delegate.
11- How can you Differentiate between Compile time issues and Run Time Issues?
Compile Time is referred to as the time taken when converting source code into machine code. The process is done to make the source code executable. Normally, compile-time issues are syntax related errors.
// Compile-Time Error
void main()
{
int x = 10;
//syntax error : semicolon missed
int y = 20
}
// Run-Time error
void main()
{
int n = 9, div = 0;
// wrong logic
// number is divided by 0,
// so this program abnormally terminates
div = n/0;
}
Run Time on the other hand is referred to as when an issue occurs when the application is running. Which naturally refers to the issues that occur after an app is launched and running, for example, unexpected app crashes or features not working properly.
// Run-Time error
void main()
{
int n = 9, div = 0;
// wrong logic
// number is divided by 0,
// so this program abnormally terminates
div = n/0;
}
12- Difference between events and delegates?
A delegate can be defined as a reference type variable that always holds the reference towards a method. An event on the other hand refers to a notification mechanism that is dependent on delegates. Delegates can exist without events, not the other way round.
13- What is Exception Handling?
Exception occurs during the execution of a program and is identified as an issue. A typical issue can be when the program is running and an attempt to divide by 0 occurs. The try-catch statement consists of a try block followed by one or more catch clauses, which specify handlers for different exceptions.
When an exception is thrown, the common language runtime (CLR) looks for the catch statement that handles this exception. If the currently executing method does not contain such a catch block, the CLR looks at the method that called the current method, and so on up the call stack. If no catch block is found, then the CLR displays an unhandled exception message to the user and stops execution of the program.
class Program
{
static void Main(string[] args)
{
try
{
Console.WriteLine("Enter a number: ");
var num = int.parse(Console.ReadLine());
Console.WriteLine($"Squre of {num} is {num * num}");
}
catch
{
Console.Write("Error occurred.");
}
finally
{
Console.Write("Re-try with a different number.");
}
}
}
14- What is Middleware in .NET Framework?
Middleware is referred to as software components that are used in an application pipeline to cater to requests and responses. Middleware has multiple components and each component selects whether to pass a request further down the pipeline. Middleware allows actions to be performed before and after each component stage is reached.
15- What is the difference between ViewData, ViewBag & TempData?
ViewData:
The basic function of ViewData is to pass data from controlled to view and remain available for the current request only. In case a redirection occurs, then the value of ViewData is nullified.
ViewBag:
ViewBag carries the same functionality as ViewData, as it also allows data to pass from controller to respective view. The only difference is that it is a dynamic property that uses dynamic features in C#4.
TempData:
TempData is primarily used to transfer data from the current to the next requests. TempData is derived from the TempData Dictionary class.
16- Difference between TempData keep() and peek() methods?
TempData retrieves information from TempDataDictionary where every data is read and marked as available for deletion. This is where keep() & peek() comes into play to retain the data. The only difference is that keep() is used to retain data that is supposed to get deleted. Whereas, peek() is used to read data without marking for deletion.
17- What is the Difference between Value Type & Reference Type?
Data Types refer to value types that contain data value within its memory. The variables within these data types contain some intrinsic value. A Reference Type does not store a value directly, rather it has a pointer that points towards where the data is stored which is typically in a memory location.
using System;
class Example1
{
static void Main()
{
// Value-type examples
// -------------------
// Create an integer
int msZimmerAge = 54;
// Create a second integer
int mrSmithAge = msZimmerAge;
// Display both integers
Console.WriteLine("Ms. Zimmer age: {0}, Mr. Smith age: {1}", msZimmerAge, mrSmithAge);
//Output: Ms. Zimmer age: 54, Mr. Smith age: 54
// Modify the second integer
mrSmithAge = 44;
// Output both integers again
Console.WriteLine("Ms. Zimmer age: {0}, Mr. Smith age: {1}", msZimmerAge, mrSmithAge);
//Output: Ms. Zimmer age: 54, Mr. Smith age: 44
// Reference-type example
// ----------------------
// Create a person
Person mrJones = new Person();
// Assign a value to age
mrJones.Age = 22;
// Create a second reference to a person
Person msKelley = mrJones;
// Display their ages
Console.WriteLine("nMr. Jones age: {0}, Ms. Kelley age: {1}", mrJones.Age, msKelley.Age);
//Output: Mr. Jones age: 22, Ms. Kelley age: 22
// Assign a new age to the second reference
msKelley.Age = 31;
// Display their ages again
Console.WriteLine("Mr. Jones age: {0}, Ms. Kelley age: {1}", mrJones.Age, msKelley.Age);
//Output: Mr. Jones age: 31, Ms. Kelley age: 31
}
}
// An instance of a class is a reference type
public class Person
{
public int Age;
}
In a Nutshell
.NET interviews aren’t going to be easy but if you stick to these questions and the interviewer aces them then you have got hold of a great resource. Speaking of resources, we’ve got some excellent .NET developer that can produce a product that sparks perfection. Do give us a call for a quick chat!