Northcorp Software
10+ Hirect Interview Questions and Answers
Q1. What is the difference between readonly and const in C#?
readonly variables can be assigned a value either at the time of declaration or in the constructor, while const variables must be assigned a value at the time of declaration and cannot be changed.
readonly variables can be assigned a value at runtime, while const variables must be assigned a value at compile time
readonly variables can be assigned a value in the constructor, while const variables cannot
const variables are implicitly static, while readonly variables are not
Q2. What is garbage collection in .NET?
Garbage collection in .NET is an automatic memory management process that helps in reclaiming memory occupied by objects that are no longer in use.
Garbage collection is a process where the runtime environment automatically deallocates memory that is no longer needed by the program.
It helps in preventing memory leaks and improving the performance of the application.
Garbage collection in .NET uses generations to categorize and manage objects based on their lifetime.
Examples of ...read more
Q3. What is D/W array and ArrayList in .Net?
D/W array is a dynamic array in .Net that can grow or shrink in size. ArrayList is a collection class that can store objects of any type.
D/W array is a resizable array that automatically adjusts its size as elements are added or removed.
ArrayList is a collection class that can store objects of any type, allowing for flexibility in data storage.
Example: D/W array - string[] myArray = new string[5]; ArrayList - ArrayList myArrayList = new ArrayList();
Q4. const is compile-time constant, while readonly is runtime constant.
const is compile-time constant, while readonly is runtime constant.
const values are determined at compile time and cannot be changed during runtime
readonly values can be assigned a value either at the declaration or in the constructor and can be changed at runtime
const is used for values that are known at compile time, like mathematical constants
readonly is used when the value needs to be initialized at runtime, like database connection strings
Q5. Injecting Dependencies instead of creating them.
Injecting dependencies allows for better flexibility, testability, and maintainability in code.
Injecting dependencies means passing objects that a class needs rather than creating them within the class.
This allows for easier testing by mocking dependencies and swapping them out for different implementations.
Dependency injection frameworks like Unity, Ninject, or Autofac can help manage dependencies.
Example: Instead of creating a database connection within a class, pass it in ...read more
Q6. What is Dependency injection ?
Dependency injection is a design pattern where components are given their dependencies rather than creating them internally.
Dependency injection helps in achieving loose coupling between classes.
It allows for easier testing and maintenance of code.
There are three types of dependency injection - constructor injection, setter injection, and interface injection.
Example: Instead of creating an instance of a class within another class, the instance is passed as a parameter to the ...read more
Q7. Difference between async and await?
Async is used to define a method that can be run asynchronously, while await is used to pause the execution of an async method until a task is complete.
Async is used to define a method that can be run asynchronously.
Await is used to pause the execution of an async method until a task is complete.
Async methods can be called using the await keyword to run them asynchronously.
Async and await are used in C# to simplify asynchronous programming.
Q8. async defines, await pauses execution.
async defines, await pauses execution in asynchronous programming in C#.
async keyword is used to define a method as asynchronous in C#.
await keyword is used to pause the execution of an asynchronous method until the awaited task completes.
Asynchronous programming allows non-blocking execution of code, improving performance and responsiveness.
Example: async Task<int> GetDataAsync() { await Task.Delay(1000); return 1; }
Q9. What is CLR in .NET?
CLR stands for Common Language Runtime, it is the virtual machine component of the .NET framework.
CLR is responsible for managing the execution of .NET programs.
It provides services such as memory management, exception handling, and security.
CLR compiles the intermediate language code into native code during execution.
It allows for cross-language integration and interoperability within the .NET framework.
Examples of languages that run on the CLR include C#, VB.NET, and F#.
Q10. Common Language runtime.
Common Language Runtime (CLR) is the virtual machine component of Microsoft's .NET framework, responsible for managing execution of .NET programs.
CLR provides various services such as memory management, exception handling, and security.
It compiles intermediate language code into machine code during execution.
CLR allows for interoperability between different languages in the .NET framework.
Example: C# and VB.NET code can be compiled into a common intermediate language (CIL) an...read more
Interview Process at Hirect
Top DOT NET Developer Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month