top of page

.NET interview questions


Basic Answers

 

1. **What is .NET?

   .NET is a software development framework and ecosystem developed by Microsoft that enables developers to create applications across various platforms. It provides a runtime environment called the Common Language Runtime (CLR) and a rich library of pre-coded solutions to common programming problems.

 

2. **What is CLR?

   The Common Language Runtime (CLR) is the execution engine of the .NET Framework. It handles memory management, security, exception handling, and more. It also provides a common type system, and manages code execution to ensure type safety, security, and performance.

 

3. **What are the main components of .NET?

   The main components of .NET include:

   - **Common Language Runtime (CLR): Manages the execution of programs.

 

   - **.NET Class Library: Provides reusable types for tasks, including file input/output, threading, and XML document manipulation.

 

   - **ASP.NET: A framework for building web applications.

 

   - **.NET Core: A cross-platform version of .NET for building websites, services, and console apps.

 

4. **What is C#?

   C# is a type-safe, object-oriented programming language developed by Microsoft. It is one of the primary languages used for developing applications on the .NET framework.

 

5. **What is managed code?

   Managed code is code written in one of the .NET languages, which is directly executed by the CLR. It benefits from features such as cross-language integration, exception handling, enhanced security, and memory management.

 

 

 Intermediate Answers

 

6. **What is the difference between a class and an object?

   A class is a blueprint or prototype that defines the variables and the methods (functions) common to all objects of a certain kind. An object is a specific instance of a class containing actual values instead of variables.

 

7. **What are value types and reference types?

   Value types hold their data directly and are stored in the stack. Examples include integers and Booleans. Reference types store a reference to their data, which is held in the heap. Examples include objects, arrays, and strings.

 

8. **What is garbage collection in .NET?

   Garbage collection (GC) in .NET is a process by which the framework automatically reclaims memory occupied by objects that are no longer in use. GC frees developers from manually managing memory, thus reducing errors and improving efficiency.

 

9. **What are delegates in .NET?

   Delegates are type-safe pointers to methods. They are used to encapsulate a reference to a method inside a delegate object, which can then be passed to code that can call the referenced method without needing to know at compile time which method will be invoked.

 

10. **What is ASP.NET?

    ASP.NET is a web framework designed to develop web applications. It provides the tools necessary to build dynamic websites, web applications, and web services.

 

 

Advanced Answers

 

11. **What are generics in .NET?

    Generics allow developers to define classes, methods, and interfaces with a placeholder for the type of data they store or use. This enables type-safety and performance improvements because it eliminates the need for boxing or unboxing.

 

12. **Explain the concept of LINQ.

    Language Integrated Query (LINQ) is a set of extensions methods on the .NET Framework that provides a native data querying syntax reminiscent of SQL but integrated into C# and VB.NET. LINQ enables developers to write queries directly within the code, enhancing readability and maintainability.

 

13. **What is MVC?

    Model-View-Controller (MVC) is an architectural pattern used in software development. In .NET, MVC is implemented to separate an application into three main components: the model (data), the view (user interface), and the controller (business logic), thereby promoting organized programming and code reusability.

 

14. **What are attributes in .NET?

    Attributes in .NET are special declarative tags used to add metadata to code (such as classes, methods, or properties) that can be retrieved at runtime via reflection. They are commonly used for configuration and behavioral settings on code elements.

 

15. **Explain dependency injection in .NET.

    Dependency injection is a design pattern used in .NET to reduce hard-coded dependencies among your classes by injecting these dependencies at run time instead of during design time. This promotes a modular architecture and makes the application easier to test and maintain.

 

 

Practical Answers

 

16. **How would you implement exception handling in C#?

    Exception handling in C# is done using the try-catch-finally block. Code that may throw an exception is placed in the try block. Exceptions are caught in the catch block, and the finally block contains code that is executed regardless of whether an exception occurred.

 

17. **Can you explain the concept of multithreading in .NET?

    Multithreading in .NET allows multiple threads to be created within a process, enabling tasks to be performed simultaneously. .NET provides various synchronization objects to coordinate these threads safely and efficiently.

 

18. **What are the differences between .NET Core and .NET Framework?

    .NET Core is a cross-platform, open-source rewrite of the .NET Framework, designed to be agile and performant with full side-by-side installation support. The .NET Framework, on the other hand, is Windows-only and includes additional APIs like Web Forms and WCF, which are not available in .NET Core.

 

19. **How do you secure a web application using .NET?

    Securing a .NET web application involves using HTTPS, securing data with encryption, implementing proper authentication and authorization strategies, and regularly updating the framework and dependencies to protect against vulnerabilities.

 

20. **What is Entity Framework?

    Entity Framework is an object-relational mapper (ORM) that enables developers to work with data using objects of domain-specific classes without focusing on the underlying database tables and columns where this data is stored.

0 views0 comments

Recent Posts

See All

MVC V layered architecture

MVC (Model-View-Controller) and layered architecture are two design patterns used in software development to structure code and improve...

Flask vs Node.js

Flask and Node.js are both popular choices for building web applications, but they have different strengths and use cases. Here's a...

Comentários


bottom of page