Basic
Basic
1. What is .NET?
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.
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.
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.
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.
In-Memory Cache
Persistent in-process Cache
Distributed Cache
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.
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.
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.
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:
// statements to be excuted.
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.
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.
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.