0% found this document useful (0 votes)
7 views

Dot Net Interview

Uploaded by

Prasad Mohite04
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

Dot Net Interview

Uploaded by

Prasad Mohite04
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

.

NET MCQ
1.

int keyword refers to which .NET type?

System.Int32
System.Int8
System.Int16
System.Int64
2.

Boxing allows the user to convert what?

Integer type to double


Value type to a reference type
Reference type to a value type
Double type to integer
3.

An Event has ____ as the default return type.

No return type for events


Integer
String
Double
4.

If the exception does not occur, will the final block get executed?

There is no such block as finally


Yes
No
Both catch and finally block will be executed.
5.

If a variable is declared inside a method, then it is called as _______

Static
Serial
Local
Private
6.

Runtime environment provided by .NET is called as _______

RMT
CLR
RC
RCT
7.

In which file .Net assembly’s metadata is stored?

manifest
.dll
.exe
core
8.

Common Type System (CTS) can manage _______

Value types
All data types in .net
Reference types
Communication between multiple languages
9.

Specify root namespace used for fundamental types in .Net framework.

System.Web
System.IO
System.Object
System.File
10.

Which method is used to force garbage collection to run?

GC.Run() method
GC.Collection() method
GC.Finalize() method
GC.Collect() method
11.

What is the functionality of Response.Output.Write()?

Response.Output.Write() allows you to buffer output


Response.Output.Write() allows you to flush output
Response.Output.Write() allows you to write formatted output
Response.Output.Write() allows you to stream output
12.

__ is the latest version of .NET core as per 2021.

.NET Core 3.1


.NET Core 3.0
.NET 6
None of the above
13.

Docker is used for ______.

Developing the applications


Shipping the applications
Running the applications
All of the above
14.

.NET Core framework is composed of ______.

CLI tools
Roslyn
CoreFX and CoreCLR
All of the above
15.

What is the use of microservices?

Mix technologies across the service boundary


Debugging
Creating and deploying a container
None of the above
16.
.NET core is ______.

Windows only
Cross-platform
Linux only
MacOS only
17.

What is CoreFX?

Toolset for the development of applications


Compiler
Foundational class libraries for .NET Core
Docker container
18.

What is included within CoreCLR?

Garbage Collector
JIT Compiler
Primitive data types
All of the above
19.

What is Roslyn?

.NET Compiler platform


Container
Library
None of the above
20.

System.Linq namespace contains classes and interfaces that support ______.

use of a memory-mapped file


queries that use LINQ(Language-Integrated Query)
to configure an assembly
immutable collections
21.

Using which package we can share the libraries in .NET Core?


NuGet package
LINQ
System
Dapper

Section 1:- C#.Net :-

Q.1:- What Is CTS and CLS:-

• Common Type System(CTS):


o CTS specifies a standard that will mention which type of data and value can be
defined and managed in memory during runtime.
o It will make sure that programming data defined in different languages should
interact with each other for sharing the information. For example, in VB.NET we
define datatype as integer, while in C# we define int as a data type.
o It can be used to prevent data loss when you are trying to transfer data from a type
in one language to its equivalent type in another language.
• Common Language Specification (CLS):
o Common Language Specification (CLS) is a subset of CTS and defines a set of rules
and regulations to be followed by every .NET Framework’s language.
o A CLS will support inter-operability or cross-language integration, which means it
provides a common platform for interacting and sharing information. For example,
every programming language(C#, F#, VB .Net, etc.) under the .NET framework has
its own syntax. So when statements belonging to different languages get executed,
a common platform will be provided by the CLS to interact and share the
information.

Q 2 :-Explain the differences between value type and reference type.

The main differences between value type and reference type are given below:

• A Value Type holds the actual data directly within the memory location and a
reference type contains a pointer which consists of the address of another memory
location that holds the actual data.
• Value type stores its contents on the stack memory and reference type stores its
contents on the heap memory.
• Assigning a value type variable to another variable will copy the value directly and
assigning a reference variable to another doesn’t copy the value, instead, it creates
a second copy of the reference.
• Predefined data types, structures, enums are examples of value types. Classes,
Objects, Arrays, Indexers, Interfaces, etc are examples of reference types.

Q 3:-. What is the difference between managed and unmanaged


code?

The main difference between managed and unmanaged code is listed below:

Managed Code Unmanaged Code


It is managed by CLR. It is not managed by CLR.
Does not require a .NET framework for the
.NET framework is a must for execution.
execution.
Memory management is done through Runtime environment takes care of memory
garbage collection. management.

Q 4. :-. Explain Microsoft Intermediate Language

MSIL is the Microsoft Intermediate Language, which provides instructions for calling
methods, memory handling, storing and initializing values, exception handling, and
so on.

The instructions provided by MSIL are platform-independent and are generated by


the language-specific compiler from the source code. JIT compiler compiles the
MSIL into machine code based on the requirement.

Q 5:- . What is an assembly?

An assembly is a file that is automatically generated by the compiler which consists


of a collection of types and resources that are built to work together and form a
logical unit of functionality. We can also say, assembly is a compiled code and
logical unit of code.

Assemblies are implemented in the form of executable (.exe) or dynamic link library
(.dll) files.

Q 6:- What is a garbage collector?

Garbage collector frees the unused code objects in the memory. The memory heap
is partitioned into 3 generations:

• Generation 0: It holds short-lived objects.


• Generation 1: It stores medium-lived objects.
• Generation 2: This is for long-lived objects.

Collection of garbage refers to checking for objects in the generations of the


managed heap that are no longer being used by the application. It also performs
the necessary operations to reclaim their memory. The garbage collector must
perform a collection in order to free some memory space.

During the garbage collection process:

• The list of live objects is recognized.


• References are updated for the compacted objects.
• The memory space occupied by dead objects is recollected. The remaining objects
are moved to an older segment.

System.GC.Collect() method is used to perform garbage collection in .NET.

Q 7:- What is a delegate in .NET?


A delegate is a .NET object which defines a method signature and it can pass
a function as a parameter.
Delegate always points to a method that matches its specific signature. Users
can encapsulate the reference of a method in a delegate object.
When we pass the delegate object in a program, it will call the referenced
method. To create a custom event in a class, we can make use of delegate.
Q 8:- What is boxing and unboxing in .NET?
Boxing is the process of converting a value type into a reference type
directly. Boxing is implicit.
Unboxing is the process where reference type is converted back into a value
type. Unboxing is explicit.
An example is given below to demonstrate boxing and unboxing operations:
int a = 10; // a value type
object o = a; // boxing
int b = (int)o; // unboxing

Q 9:-. What is the difference between an abstract class and an


interface?

The main difference between an abstract class and an interface are listed below:

Abstract Class Interface


Used to declare properties, events, methods, and fields as Fields cannot be declared using
well. interfaces.
Provides the partial implementation of functionalities that Used to declare the behavior of an
must be implemented by inheriting classes. implementing class.
Different kinds of access modifiers like private, public, Only public access modifier is
Abstract Class Interface
protected, etc. are supported. supported.
It does not contain static
It can contain static members.
members.
Multiple inheritances are
Multiple inheritances cannot be achieved.
achieved.

Q 10:-. What are the types of memories supported in the .NET


framework?

Two types of memories are present in .NET. They are:

Stack: Stack is a stored-value type that keeps track of each executing thread and its
location. It is used for static memory allocation.

Heap: Heap is a stored reference type that keeps track of the more precise objects
or data. It is used for dynamic memory allocation.

Q 11:-. Explain localization and globalization.

Localization is the process of customizing our application to behave as per the


current culture and locale.

Globalization is the process of designing the application so that it can be used by


users from across the globe by supporting multiple languages.

Section 2:- ASP.NET:-

Q 1 :- Difference Between to .NET and .NET Core Framework

.NET framework is developed by Microsoft, provides an environment to run,


debug and deploy code onto web services and applications by using tools and
functionalities like libraries, classes, and APIs. This framework uses object oriented
Technology. You can use different languages like C#, Cobol, VB, F#, Perl, etc. for
writing .NET framework applications. This Framework supports services, websites,
desktop applications, and many more on Windows. It provides functionalities such
as generic types, automatic memory management, reflection, concurrency, etc.
These functionalities will help to make the development easier and efficiently build
high-quality web as well as client applications.

.NET Core is a newer version of the .NET framework and it is a general-purpose,


cost-free, open-source development platform developed by Microsoft. .NET Core is
a cross-platform framework that runs an application on different operating systems
such as Windows, Linux, and macOS operating systems. This framework can be
used to develop various kinds of applications like mobile, web, IoT, cloud,
microservices, machine learning, game, etc.

Q 2:- Characteristics of .NET Core:

• Free and open-source: .NET Core source code project can be obtained from
Github. It is free and licensed under the MIT and Apache licenses.
• Cross-platform: .NET Core is supported by different operating systems like
Windows, macOS, and Linux.
• Sharable: A single consistent API model that is written in .NET Standard will be
used by .NET Core and is common for all the .NET applications. The same library or
API can be used on multiple platforms with different languages.
• Friendly: The .NET Core is compatible with .NET Framework, Mono, and Xamarin,
through .NET Standard. It also supports working with different Web frameworks
and libraries such as Angular, React, and JavaScript.
• Fast: .NET Core 3.0 is faster compared to the .NET Framework, .NET Core 2.2 and
previous versions. It is also much faster than other server-side frameworks like
Node.js and Java Servlet.

Q 3:-. Is ASP.NET different from ASP? If yes, explain how?

Yes, ASP.NET and ASP(Active Server Pages) both are different. Let’s check how they
are different from each other.

• ASP.NET uses .NET languages such as C# and VB.NET, which are compiled to
Microsoft Intermediate Language (MSIL). ASP uses VBScript. ASP code is
interpreted during the execution.
• ASP.NET which is developed by Microsoft is used to create dynamic web
applications while ASP is Microsoft’s server-side technology used to create web
pages.
• ASP.NET is fully object-oriented but ASP is partially object-oriented.
• ASP.NET has full XML Support for easy data exchange whereas ASP has no built-in
support for XML.
• ASP.NET uses the ADO.NET technology to connect and work with databases. ASP
uses ADO technology.
Q 4:- . What is the order of the events in a page life cycle?

There are eight events as given below that take place in an order to successfully
render a page:

• Page_PreInit
• Page_Init
• Page_InitComplete
• Page_PreLoad
• Page_Load
• Page_LoadComplete
• Page_PreRender
• Render

Q 5:-. Explain different types of cookies available in ASP.NET?

Two types of cookies are available in ASP.NET. They are:

Session Cookie: It resides on the client machine for a single session and is valid
until the user logs out.

Persistent Cookie: It resides on the user machine for a period specified for its
expiry. It may be an hour, a day, a month, or never.

Q. 6:- What Is ADO.NET .

Q. 7:- What is Difference Between Connected and Disconnected Architecture.

Section 3:- ASP.NET MVC:-

Q 1:- Explain MVC.

MVC stands for Model View Controller. It is an architecture to build .NET


applications. Following are three main logical components of MVC: the model, the
view, and the controller.

Components of MVC

Model: They hold data and its related logic. It handles the object storage and
retrieval from the databases for an application. For example:
A Controller object will retrieve the employee information from the database.
It manipulates employee data and sends back to the database or uses it to render
the same data.

View: View handles the UI part of an application. They get the information from the
models for their display. For example, any employee view will include many
components like text boxes, dropdowns, etc.

Controller: They handle the user interactions, figure out the responses for the user
input and also render the final output. For instance, the Employee controller will
handle all the interactions and inputs from the Employee View and update the
database using the Employee Model.

Q 2:-

Q 3:- What Is Web API

Web API is a framework that makes it easy to build HTTP services that reach a
broad range of clients, including browsers and mobile devices. The ASP.NET Web
API is an ideal platform for building REST applications on the .NET Framework.

Q 4:- What Is Entity Framework

Prior to .NET 3.5,developers often used to write ADO.NET code or Enterprise


Data Access Block to save or retrieve application data from the underlying
database. We used to open a connection to the database, create a DataSet to
fetch or submit the data to the database, convert data from the DataSet to
.NET objects or vice-versa to apply business rules. This was a cumbersome and
error prone process. Microsoft has provided a framework called "Entity
Framework" to automate all these database related activities for your
application.

Q. 5:- Development Approaches with Entity Framework

There are three different approaches you can use while developing your
application using Entity Framework:

Database-First

Code-First

Model-First

You might also like