REAL TIME Dot Net Interview Question & Answer For [PRACTICE]
Last updated on 05th Jun 2020, Blog, Interview Questions
.NET is referred to as a software development platform that is used in various languages. It offers interoperability of languages which enables each language to be used in other languages. The dot net structure consists of a class library called FCL. It follows the principle of interoperability, language-independent, type of security, portability, security, memory management, and performance.
1. What is .NET?
.NET is the developer platform to build the variety of applications for a web, mobile, desktop, and IoT. It supports the various languages like C#, F#, Visual Basic, J#, C++, etc. for building the applications.
2. What is the .NET framework?
The .NET framework is the software development platform that supports the object-oriented approach. It offers the services, like memory management, networking, security, and type safety.
3. What is the difference between “dispose” and “finalize”?
|Primarily associated with the IDisposable interface in .NET languages like C#.||Associated with the finalization process in languages like C#.|
|Dispose is a method that allows an object to release unmanaged resources explicitly before it is reclaimed by the garbage collector.||Finalize is a method that is part of the finalization process and is automatically called by the garbage collector before reclaiming an object’s memory.|
4. What are the most important aspects of .NET?
- Cross-Platform Development
- Language Independence
- Common Language Runtime (CLR)
- ASP.NET for Web Development
- Frameworks for Different Application Types
5. Explain OOP and its relation to.NET Framework.
OOP is an acronym for Object-Oriented Programming.It is the programming structure that achieves a desired functionality by using self-contained things called “objects” rather than methods.OOP allows .NET developers to create a modular programs and classes containing the methods, properties, fields, events, and other logical modules.
6. Wha are the basic features of OOP?
- Encapsulation: Creation of a self-contained modules that bind together data and the functions that access that data.
- Abstraction: Handles the complexity and allows implementation of further complex logic without disclosing it to user object.
- Polymorphism: Operation performed depends upon context at runtime to facilitate simple integration.
- Inheritance: Creation of classes in the hierarchy to enable a class to inherit the behavior from its parent class allowing reuse of a code.
7. Name some OOP languages.
8. What is JIT?
JIT stands for a Just In Time. It is the compiler in CLR responsible for an execution of .NET programs of various languages by converting them into machine code. It speeds up a code execution and supports the multiple platforms.
9. What are the different types of JIT Compilers?
Pre-JIT compiler: It performs a single compilation cycle, or when an application is being deployed, to convert all source code into machine code.
Regular JIT Compiler: This compiler converts source code methods into machine code and stores it in cache so that it may be invoked later.
Econo JIT Compiler: This compiler is used to compile methods that are only needed at runtime and do not save the results for later use.
10. Describe the term BCL.
BCL stands for a Base Class Library. It comprises the classes, interface, and value types. It is foundation for building .NET Framework applications, components, and controls.
11. What is Framework Class Library ?
The Microsoft.NET framework’s Framework Class Library (FCL) is a crucial part. It is a set of reusable classes, interfaces, and value types that offers a variety of capabilities for creating applications on the.NET platform.
12. What is caching in .NET?
Caching functionality in .NET Framework allows the data storage in memory for a rapid access. It helps to improve performance by making a data available, even if data source is temporarily unavailable, and enhances scalability.
13. What are the types of caching in .NET?
- In-Memory Cache
- Persistent in-process Cache
- Distributed Cache
14. What are the main components of it?
- Class library
- Common Language Runtime (CLR)
- Dynamic Language Runtime (DLR)
- Application Domains
- Runtime Hosts
15. Distinguish difference between the constants and read-only variables.
|Constant fields are created using const keyword and their value remains a same throughout a program.||The Read-only fields are created using the read-only keyword and their value can be changed.|
|Const is the compile-time constant.||Read-only is the runtime constant.|
16. What is EXE and DLL?
EXE is an executable file that functions as a program and runs independently since it includes the entry point. DLL stands for Dynamic Link Library, and it is a supporting file for other applications that cannot be operated independently.
17. Distinguish difference between the value type and reference type.
Types in .NET Framework are either Value Type or be Reference Type. A Value Type is saved in the stack and it holds a data within its own memory allocation. While the Reference Type is saved in the heap and it contains the pointer to another memory location that holds a real data.
18. What is Base class ?
In .NET, the base class is the root class from which all other classes in the framework are derived. The base class provides a fundamental set of functionalities that are inherited by all classes in the .NET class hierarchy.
19. Define extension method for a class.
The extension method is used to add a new methods in the existing class or structure without modifying a source code of original type. Special permission from original type or re-compiling it is not required.
20. Distinguish between Stack and Heap.
Static memory is allocated using the stack, and accessing this memory is quick and easy to keep track of. Heap is utilized for run-time memory allocation for variables and dynamic memory allocation. When compared to stack memory, accessing heap memory is more challenging and time-consuming.
21. What is inheritance?
Inheritance is the method for creating hierarchies of the objects wherein one class, called a subclass, is based on another class, called a base class.
22. What is the inheritance hierarchy?
The inheritance hierarchy in programming refers to the organization of classes in a system based on the principle of inheritance. In .NET, the inheritance hierarchy centers around the System.Object class, which serves as the root of the hierarchy. All other classes in the framework and user-defined classes ultimately derive from System.Object.
23. Distinguish difference between Stack and Queue.
The values in the stack are processed following LIFO (Last-In, First-Out) principle, so all the elements are inserted and deleted from a top end. But a queue lists items on FIFO (First-In, First-Out) basis in terms of both the insertion and deletion. The elements are inserted from a rear end in a queue and deleted from front end.
24. What is implementation inheritance and interface inheritance?
Implementation inheritance is when class inherits all the members of class from which it is derived. Interface inheritance is when class inherits only signatures of functions from the another class.
25. How can class be prevented from being inherited?
To prevent the class from being inherited, sealed keyword in C# can be used. The NotInheritable keyword can be used in the VB.NET to prevent accidental inheritance of class.
26. Define Method Overriding.
Method Overriding is the process that allows using a same name, return type, argument, and invoking a same functions from the another class (base class) in the derived class.
27. What is Shadowing?
A Shadowing makes the method of parent class available to child class without using a override keyword. It is also known as a Method Hiding.
28. Distinguish difference between shadowing and overriding.
Shadowing is used to provide the new implementation for a base class method and helps protect against the subsequent base class modification. Overriding allows to rewrite a base class function with the various definition and achieve polymorphism.
29. What is Polymorphism?
Polymorphism refers to a one interface with the multiple functions. It means that same method or property can perform different actions depending on the run-time type of instance that invokes it.
30. What are the types of Polymorphism?
- Static or compile-time polymorphism
- Dynamic or runtime polymorphism
31. Do we have multiple inheritances in .NET?
No, .NET does not support multiple inheritance in the traditional sense where a class can inherit from more than one class. However, .NET supports a form of multiple inheritance through interfaces.
32. What is the Diamond of Death?
The “Diamond of Death” is a term used in object-oriented programming, particularly in languages that support multiple inheritance. It refers to a situation where a class inherits from two or more classes that have a common base class.
Get On-Demand .NET Training to Build Your Skills & Advance Your Career
- Instructor-led Sessions
- Real-life Case Studies
33. What is Interface?
An interface is the declaration for set of a class members. It is the reference type that contains only abstract members like Events, Methods, Properties, etc.
34. What are memory-mapped files?
Memory-mapped files are used to correspond a file’s content to a logical application address. It enables the sharing of data between many processes running on the same computer. You may use the method MemoryMappedFile to get a memory mapped file object.CreateFromFiles(). It represents the persistent, disk-to-memory mapped file.
35. Define business logic.
Business logic refers to the set of rules, processes, and calculations that define how a particular business or organization operates. It represents the core functionality and decision-making processes that drive an organization’s day-to-day operations and activities.
36. Distinguish difference between the component and a control.
A Component does not draw itself on form and can be placed below form area. A control draws itself on form and can be placed inside a form area. Also, all controls are components, but not all the components are controls.
37. Distinguish between the user controls and custom controls.
User and Custom controls inherit from the different levels in inheritance tree. Custom control is designed for use by single application while the user control can be used by a more than one application.
38. What are functional and non-functional requirements?
Functional requirements are basic and mandatory facilities that must be incorporated into the system. Non-functional requirements are the quality-related attributes that system must deliver.
39. Explain .Net Reflection.
Reflection objects are used for creating a type instances and obtaining a type information at runtime. The classes in System.Reflection namespace gives access to the metadata of running program.
40. Describe Global Assembly Cache (GAC).
The Global Assembly Cache is the machine-wide code cache that is stored in folder in a Windows directory. It stores the .NET assemblies that can specifically designated to be shared by all the applications executed on system.
41. What is Object-Role Modeling (ORM)?
An Object-Role Modeling (ORM) is the powerful method for designing and querying information systems at conceptual level. It is easy and understandable description of application for non-technical users.
42. What is globalization and localization?
Globalization is designing and coding the culture-neutral and language-neutral applications. Localization is a customizing the application and translating UI based on a specific cultures and regions.
43. What is MIME?
MIME stands for the Multipurpose Internet Mail Extension. It is add-on or a supplementary protocol that allows a non-ASCII data to be sent through SMTP. It facilitates an exchange of data files on internet.
44. Explain Hashtable.
The Hashtable class is the collection that stores a key-value pairs. It organizes pairs based on hash code of each key and uses it to access the elements in the collection.
45. Name design patterns in the .NET Framework.
- Creational Design Pattern
- Structural Design Patterns
- Behavioral Design Patterns
46. What are the design principles used in .NET?
- Single responsibility principle (SRP)
- Open-Closed Principle (OCP)
- Liskov substitution principle (LSP)
- Interface segregation principle (ISP)
- Dependency inversion principle (DIP)
47. Explain the term Marshaling.
Marshaling is the process of transforming data between different formats or representations to enable communication between different parts of a computer program or between different programs.
48. What is Boxing?
Boxing is a concept in programming languages, including C# and other languages in the .NET framework, where a value type is converted to an object type. In the context of C# and .NET, a value type is a type that directly contains its data, and an object type is a reference type that can refer to any object.
49. Define Unboxing in .NET.
Unboxing in .NET refers to the process of converting an object of a reference type to a value type. In C# and other languages within the .NET framework, boxing and unboxing are related concepts that involve the conversion between value types and reference types.
50. What is Garbage Collection in .NET?
Garbage Collection in .NET Framework facilitates an automatic memory management. It automatically releases memory space after all actions related to the object in a heap memory are completed.
Learn Practical Oriented Dot Net Training from Real Time ExpertsWeekday / Weekend BatchesSee Batch Details
51. What are the divisions of Memory Heap?
Generation 0: Used to save short-lived objects. A Frequent Garbage Collection happens this Generation.
Generation 1: Used for a medium-lived objects.
Generation 2: Used for a long-lived objects.
52. Distinguish difference between trace class and debug class.
The Debug mode is the only one that includes the call to the Debug class, and it is utilized while developing an application. While being utilized at the time of application deployment, the call to the Trace class is included in both the Debug and Release modes.
53. What is Debug build ?
A Debug build is a compilation of a software application with specific settings that facilitate debugging and development activities. When developers are working on a project, they often create both Debug and Release builds to serve different purposes.
54. Explain the application object.
The Application object is used to share the information among all users of application. And can tie a group of ASP files that work together to perform for some purpose.
55. Describe session object.
A server-side tool called a session object is employed when a user interacts with a web application to save and manage user-specific data across numerous requests. It is an integral part of web sessions, allowing developers to maintain state information for individual users.
56. What is Release build?
A Release build is a compiled version of a software application that is optimized for performance, size, and efficiency during production deployment. Unlike Debug builds, which prioritize ease of debugging and development support, Release builds are tailored for efficient execution in a production environment.
57. What are managed and unmanaged codes?
Managed code runs inside CLR and installing .NET Framework is important to execute it. Unmanaged code does not depend on the CLR for execution and is developed using the languages outside the .NET framework.
58. How is Managed code executed?
The steps for executing the managed code are as follows:
- Choose the language compiler depending on language of the code.
- Convert a code into an Intermediate language using its own compiler.
- The IL is then targeted to the CLR which converts a code into native code using JIT.
- Execution of a Native code.
59. Explain different parts of an Assembly.
Manifest: Also known as a assembly metadata, it has information about version of an assembly.
Type Metadata: Binary information of a program.
MSIL: Microsoft Intermediate Language code.
Resources: List of the related files.
60. Explain the term MVC.
MVC is architectural model for building a .Net applications. It stands for the Model View Controller. It is simple to use and offers full control over HTML.
61. Distinguish difference between Function and Stored procedure.
|A function in a database is designed to return a value.||A stored procedure, on the other hand, is a set of SQL statements that can perform a series of operations.|
|It performs a specific computation or operation and returns a single value or a table of values.||Stored procedures can return values, but their primary purpose is to execute a sequence of statements.|
62. What is a .NET web service?
It is the component that allows publishing of the application’s function on a web to make it accessible to public. It resides on the Web server and provides information and services using the standard Web protocols like HTTP and Simple Object Access Protocol (SOAP).
63. What are the advantages of Web Services?
- It is easy to build and supported by the variety of platforms.
- It can extend its interface and add a new methods without affecting client’s operations.
- It is a stateless and firewall-friendly.
64. What is MEF?
Managed Extensibility Framework is known as MEF. It is the library that enables host applications to use external extensions without the need for setup.
65. What is ADO?
ADO stands for ActiveX Data Objects. It is the application program for writing a Windows applications. It is used to get access to the relational or non-relational database from a database providers like Microsoft and others.
66. What are the disadvantages of cookies?
- Cookie can save only string value.
- Cookies are the browser dependent.
- Cookies are not be secure.
- Cookies can save only small amount of data.
67. What is Object Pooling ?
Object Pooling is the concept for optimal use of limited resources through a software constructs. The ready-to-use objects, connections, and threads are saved in a pool (group) of objects in memory for a later use.It is a feature used to secure connection string information.
68. What are client-side and server-side validations in Web pages?
69. Explain Serialization.
Serialization is the process of converting a state of an object into the form (a stream of bytes) to be persisted or transported. Deserialization converts the stream into an object and is opposite of serialization. These processes allow the data to be stored and transferred.
70. What is a PE file?
PE stands for Portable Executable. It is the derivative of a Microsoft Common Object File Format (COFF). A Windows executable. It consists of the four parts:
PE/COFF headers: Contains an information regarding. EXE or DLL file.
CLR header: Contains an information about the CLR & memory management.
CLR data: Contains metadata of a DDLs and MSIL code generated by compilers.
Native image section: Contains sections are .data, .rdata, .rsrc, .text etc.
71. What is an IL?
IL stands for an Intermediate Language. It is also known as MSIL (A Microsoft Intermediate Language) or CIL (A Common Intermediate Language).All .NET source codes are the first compiled to the IL. Then, IL is converted to the machine code at point where the software is installed, or at run-time by Just-In-Time (JIT) compiler.
72. Explain use of Error Provider Control in .NET.
The Error Provider control is used to indicatean invalid data or errors to end-user while filling the data entry form. In case of invalid data entry, error message attached to error description string is displayed next to control.
73. Distinguish between Task and Thread in .NET.
The thread represents an actual OS-level thread, with its own stack and a kernel resources, and allows highest degree of control. And can choose to Abort() or Suspend() or Resume() a thread, and set thread-level properties, like a stack size, apartment state, or culture. While the Task class from Task Parallel Library is executed by TaskScheduler to return a result and allows to find out when it finishes.
74. What is MDI?
An MDI lets open the multiple windows, it will have a one parent window and as many child windows. The components are shared from a parent window like menubar, toolbar, etc.
75. What is SDI?
It opens every document in separate window. Every window has its own components like a menubar, toolbar, etc. Therefore it is not constrained to a parent window.
76. What is Multithreading?
Multithreading is a concurrent execution mechanism where multiple threads run independently within the same process, sharing the same resources such as memory space.
77. What is meaning of state management in .NET?
State management in .NET refers to the techniques and mechanisms used to maintain and persist the state of an application or a user’s interaction across multiple requests or sessions. In web applications, state management is crucial because HTTP, the underlying protocol of the web, is stateless, meaning each request is independent of the others.
78. What is LINQ?
The term “LINQ” means for “Language Integrated Query,” and it refers to a group of capabilities in several programming languages, particularly C# and Visual Basic.NET, that enable programmers to query and alter data using a declarative syntax.
79. What is CAS?
CAS stands for a code access security, CAS is the part of a security model that prevents the unauthorized access to the resources. It also enables users to set permissions for a code. CLR then executes code depending upon the permissions.CAS can only be used for a managed code.
80. Explain the difference between int and Int32.
In .NET, int and Int32 are used interchangeably, and there is essentially no difference between them. Both represent a 32-bit signed integer data type, and Int32 is simply an alias for the System. Int32 struct in the .NET Framework.
81. What are the advantages of using a session?
- It is used to store user data over the life of an application since it is simpler to create and store any type of object in a program.
- If necessary, individual entities of the user data may be saved independently.
- In some cases, it may be necessary to keep user data’s individual entities separately.
- In a secure session, objects are kept on a runtime server.
82. What is Application domain?
Every .NET application is executed in the dedicated worker process on Windows Operating System. To execute a managed code of the .NET application, CLR loads managed code in application context of process called Application Domain.
83. What is the use of delegation in .NET?
A delegate works similar to that function pointer of the other programming languages. It provides the way to encapsulate the reference of method in an object. After that, a delegate object may be supplied to the application, and the previously mentioned method can be invoked. Custom events may also be created in a class by utilizing a delegate.
84. What is the meaning of Auto Post Back in .NET?
Auto Post Back is the property in the .NET framework, which provides an automatic postback whenever an event starts its an execution cycle. To use AutoPostBack, have to set a property to True.
86. What parameters that control connection pooling behaviors in .NET?
- Connect Timeout
- Min Pool Size
- Max Pool Size
87. What requirements needed for connection pooling?
- The presence of the identical connection string for both the entities.
- The existence of the multiple processes with same connection parameters.
- The presence of a similar security protocols and settings.
88. What is role-based security in .NET?
Role-based security, as name suggests, is a measure implemented in .NET to provide a security access based on roles assigned to users. Examples include the provision of access to the users, administrators, and guests.
89. What templates are present in a Repeater control?
90. How is the status of a Data Reader checked in .NET?
The status of DataReader can be checked easily by using the property called ‘IsClosed.’ It will tell if the DataReader is closed or opened.If it is closed, a true value is a returned, and if reader is open, it returns false value.
91. What types of cookies available in ASP.NET?
Session cookies: Present on a client machine and valid only for a single sessions.
Persistent cookies: Present on user machine and has specific period denoting its expiry.
92. What is the order of the events that take place in page life cycle?
93. What skills should successful .NET Developer possess?
- NET MVC architecture
- Database handling
- Client-side web development
- .NET core
94. What is MSIL?
MSIL is abbreviation for a Microsoft Intermediate Language. It is used to provide instructions required for operations like memory handling, exception handling, and more. It can also provide an instructions to initialize and store the values and methods easily.
95. Distinguish difference between managed code and unmanaged code in .NET.
Managed code: A Managed by CLR. Garbage collection is used to manage memory. The .NET framework is necessary for an execution.
Unmanaged code: Not managed by the any entity. A Runtime environment takes care of management. .not dependant on .NET framework to run.
96. What is Transfer-encoding?
Transfer-Encoding is an HTTP header that specifies the form of encoding that has been applied to the payload of the message in order to safely transfer it between the client and the server. It was introduced to allow the entity body of a message to be different from the format or content coding that is used in the transfer.
97. What is MSBuild .NET?
MSBuild (Microsoft Build Engine) is the build platform for Microsoft and Visual Studio. It is used to build and deploy projects written in languages like C#, Visual Basic, and F#. MSBuild is file-based and is driven by XML-based project files. It’s an integral part of the .NET development ecosystem.
99. What is CLS?
CLS stands for Common Language Specification. It is a subset of the Common Type System (CTS) within the .NET Framework. The CLS is a set of rules and guidelines that define a common set of features that all language compilers targeting the .NET Framework should support. This ensures interoperability between different .NET languages.
100. What is Middleware in .NET ?
Middleware components in .NET are part of the request pipeline and can perform various tasks such as handling requests, processing responses, authentication, logging, and more. They are executed in a sequential order as the request flows through the pipeline.