0% found this document useful (0 votes)
41 views6 pages

Basic

The document provides answers to 30 basic and advanced .NET interview questions. It begins by defining .NET as a developer platform that supports various languages like C# and Visual Basic for building applications. It then discusses key .NET concepts like the .NET Framework, object-oriented programming (OOP), just-in-time (JIT) compilation, caching, and differences between types like value types and reference types. The document also compares common .NET components, data structures, and OOP concepts. It finishes by explaining advanced topics such as inheritance, constructors, and method overriding.

Uploaded by

Kalyan Maruti
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views6 pages

Basic

The document provides answers to 30 basic and advanced .NET interview questions. It begins by defining .NET as a developer platform that supports various languages like C# and Visual Basic for building applications. It then discusses key .NET concepts like the .NET Framework, object-oriented programming (OOP), just-in-time (JIT) compilation, caching, and differences between types like value types and reference types. The document also compares common .NET components, data structures, and OOP concepts. It finishes by explaining advanced topics such as inheritance, constructors, and method overriding.

Uploaded by

Kalyan Maruti
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Basic .

Net Interview Questions

1. What is .NET?

Ans: .NET is a developer platform to build a variety of applications for web, mobile,


desktop, and IoT. It supports various languages like C#, F#, Visual Basic, J#, C++, etc.
for building applications.

2. What is the .NET framework?

Ans: The .NET framework is a software development platform that supports an


object-oriented approach. It offers services, like memory management, networking,
security, and type safety.

3. What languages does the .NET Framework support?

Ans: .NET Framework supports over 60 programming languages, out of these 11


programming languages are designed and developed by Microsoft.

4. What are the most important aspects of .NET?

Ans: .NET is an open-source platform containing around 32 programming


languages and several tools for application creation. It is highly secure and runs
comfortably on multiple computer platforms.

5. Explain OOP and its relation to the .NET Framework?

Ans: OOP is the acronym for Object-Oriented Programming. It is a programming


structure that uses self-contained entities called ‘objects’ instead of methods to
achieve the desired functionality. OOP allows .NET developers to create modular
programs and classes containing methods, properties, fields, events, and other
logical modules.

6. What are the basic features of OOP?

Ans: The basic features of OOP are:

 Encapsulation: Creation of self-contained modules that bind together the


data and the functions that access that data.
 Abstraction: Handles complexity and allows the implementation of further
complex logic without disclosing it to the user object.
 Polymorphism: Operation performed depends upon the context at runtime
to facilitate easy integration.
 Inheritance:  Creation of classes in a hierarchy to enable a class to inherit
behaviour from its parent class allowing reuse of code.

Related Article: OOP Interview Questions and Answers

7. Name some OOP languages?

Ans: Simula was the first OOP language and Java, JavaScript, Python, C++, Visual
Basic. NET, Ruby, Scala, PHP are few others.

8. What is JIT?

Ans: JIT stands for Just in Time. It is a compiler in CLR responsible for the execution
of .NET programs of different languages by converting them into machine code. It
speeds up the code execution and supports multiple platforms.

9. What are the different types of JIT Compilers?

Ans: There are 3 types of JIT Compilers:

i. Pre-JIT compiler: It compiles all the source code into the machine code in a
single compilation cycle, i.e., at the application deployment time.

ii. Normal JIT Compiler: The source code methods required at run-time are
compiled into machine code and stored in the cache to be called later.

iii. Econo JIT Compiler: The methods required only at run-time are compiled using
this compiler and they are not stored for future use.

10. What is BCL?

Ans: BCL stands for Base Class Library. It comprises classes, interface, and value
types. It is the foundation for building .NET Framework applications, components,
and controls.

11. What is FCL?

Ans: FCL stands for Framework Class Library and is a collection of reusable types,
including classes, interfaces, and data types included in the .NET Framework. It is
used for developing a wide variety of applications, as it provides access to system
functionality.

12. What is caching in .NET?

Ans: Caching functionality in .NET Framework allows data storage in memory for


rapid access. It helps improve performance by making data available, even if the
data source is temporarily unavailable, and enhances scalability.

13. What are the types of caching in .NET?

Ans: There are 3 types of caches in .NET:

 In-Memory Cache
 Persistent in-process Cache
 Distributed Cache

Related Article: Learn .Net Libraries

14. What is a cross-page posting?

Ans: Cross-page posting is used to submit a form to a different page while creating


a multi-page form to collect information from the user. You can specify the page you
want to post to using the PostBackURL attribute.

15. Discuss the difference between constants and read-only


variables?

Ans: Constant fields are created using the const keyword and their value remains
the same throughout the program. The Read-only fields are created using a read-
only keyword and their value can be changed. Const is a compile-time constant
while read-only is a runtime constant.

16. Explain the difference between value type and reference type?

Ans: Types in .NET Framework are either Value Type or Reference Type. A Value
Type is stored in the stack, and it holds the data within its own memory allocation.
While a Reference Type is stored in the heap, and it contains a pointer to another
memory location that holds the real data.

17. What are EXE and DLL?


Ans: EXE is an executable file that works as an application, and it runs individually
as it contains an entry point. DLL is a Dynamic Link Library which is a supportive file
to other applications, and it cannot run individually.

18. What is the difference between Stack and Heap?

Ans: The stack is used for static memory allocation and access to this memory is
fast and simple to keep track of. Heap is used for dynamic memory allocation and
memory allocation to variables that happen at run time. Accessing the heap
memory is complex and slower compared to the stack.

19. What is the difference between Stack and Queue?

Ans: The values in a stack are processed following the LIFO (Last-In, First-Out)
principle, so all elements are inserted and deleted from the top end. But a queue
lists items on a FIFO (First-In, First-Out) basis in terms of both insertion and deletion.
The elements are inserted from the rear end in a queue and deleted from the front
end.

20. What are the differences between systems. StringBuilder and


system. string?

Ans: System. a. string is immutable and fixed-length, whereas StringBuilder is


mutable and variable length. The size of the string cannot be changed, but that of
the. stringbuilder can be changed.

Advanced .Net Interview Questions

21. What is the difference between the While and For loop? Provide
a .NET syntax for both loops?

Ans: The For loop provides a concise way of writing the loop structure, but the
While loop is a control flow statement that allows repetitive execution of the code.
Initialization, condition checking, iteration statements are written at the top of the
For loop, but only initialization and condition checking is done at the top of the while
loop.

Syntax:

While loop:

while(condtion) {
//statements to excute.

For loop:

for (intialization; condition; Increment or decrement) {

// statements to be excuted.

22. What are a base class and derived class?

Ans: The base class is a class whose members and functions can be inherited, and
the derived class is the class that inherits those members and may also have
additional properties.  

23. What is the extension method for a class?

Ans: The extension method is used to add new methods in the existing class or the
structure without modifying the source code of the original type. Special permission
from the original type or re-compiling it is not required.

24. What is inheritance?

Ans: Inheritance is a method for creating hierarchies of objects wherein one class,


called a subclass, is based on another class, called a base class.

25. What is the inheritance hierarchy?

Ans: Inheritance hierarchy is a singly rooted tree structure for organizing classes.

26. What are implementation inheritance and interface


inheritance?

Ans: Implementation inheritance is when a class inherits all members of the class


from which it is derived. Interface inheritance is when the class inherits only
signatures of the functions from another class.

27. How can a class be prevented from being inherited?


Ans: To prevent a class from being inherited, the sealed keyword in C# can be used.
The NotInheritable keyword can be used in VB.NET to prevent accidental inheritance
of the class.

28. What is a constructor in C#?

Ans: A constructor is a special method of the class that contains a collection of


instructions and gets automatically invoked when an instance of the class is created.

29. Explain Different Types of Constructors in C#?

Ans: There are 5 types of constructors in C#, as given below:

 Default Constructor: It is without any parameters.


 Parameterized Constructor: It has one parameter.
 Copy Constructor: It creates an object by copying variables from another
object.
 Static Constructor: It is created using a static keyword and will be invoked
only once for all the instances of the class.
 Private Constructor: It is created with a private specifier and does not allow
other classes to derive from this class or create an instance of it.

30. Define Method Overriding?

Ans: Method Overriding is a process that allows using the same name, return type,
argument, and invoking the same functions from another class (base class) in the
derived class.

You might also like