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

Dotnet Interview N Questions

The document discusses the .NET framework and provides answers to various questions about its components and features. It describes the .NET framework as supporting an object-oriented approach for building applications on Windows using languages like C#, VB, etc. It has tools and APIs for building, deploying, and running web services and applications. The questions cover topics like the components of .NET, Common Type System (CTS), Common Language Runtime (CLR), Common Language Specification (CLS), Just-In-Time (JIT) compilation, differences between classes and objects, boxing and unboxing, managed vs unmanaged code, namespaces vs assemblies, LINQ, and more.

Uploaded by

Prasadlee Lee
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)
109 views

Dotnet Interview N Questions

The document discusses the .NET framework and provides answers to various questions about its components and features. It describes the .NET framework as supporting an object-oriented approach for building applications on Windows using languages like C#, VB, etc. It has tools and APIs for building, deploying, and running web services and applications. The questions cover topics like the components of .NET, Common Type System (CTS), Common Language Runtime (CLR), Common Language Specification (CLS), Just-In-Time (JIT) compilation, differences between classes and objects, boxing and unboxing, managed vs unmanaged code, namespaces vs assemblies, LINQ, and more.

Uploaded by

Prasadlee Lee
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/ 33

Q-1: What is the .NET framework?

Microsoft .NET Framework Certification Training

Explore Curriculum

The .NET framework supports an object-oriented approach that is used for building applications on
windows. It supports various languages like C#, VB, Cobol, Perl, .NET, etc. It has a wide variety of tools
and functionalities like class, library and APIs that are used to build, deploy and run web services and
different applications.

Q-2: What are the different components of .NET?

Following are the components of .NET

 Common Language run-time

 Application Domain

 Common Type System

 .NET Class Library

 .NET Framework

 Profiling
Q-3: What do you know about CTS?

CTS stands for Common Type System. It follows certain rules according to which a data type should be
declared and used in the program code. CTS also describes the data types that are going to be used in
the application. We can even make our own classes and functions following the rules in the CTS, it helps
in calling the data type declared in one program language by other programming languages.

Q-4: What is CLR?

CLR stands for common language run-time, it is an important component of the .NET framework. We
can use CLR as a building block of various applications and provides a secure execution environment for
applications.

Whenever an application written in C# is compiled, the code is converted into an intermediate language.
After this, the code is targeted to CLR which then performs several operations like memory
management, security checks, loading assemblies, and thread management.

Q-5: Explain CLS.

Common language specification helps the developers to use the components that are inter-language
compatible with certain rules that come with CLS. It then helps in reusing the code in other .NET
compatible languages.

Q-6: What do you know about JIT?

JIT is a compiler which stands for Just In Time. It is used to convert the intermediate code into the native
language. During the execution, the intermediate code is converted into the native language.

Q-7: Why do we use Response.Output.Write()?

Programming & Frameworks Training

FULL STACK WEB DEVELOPMENT INTERNSHIP PROGRAM

Full Stack Web Development Internship Program

Reviews

 5(2047)

JAVA CERTIFICATION TRAINING COURSE

Java Certification Training Course

Reviews

 4(53912)
PYTHON SCRIPTING CERTIFICATION TRAINING

Python Scripting Certification Training

Reviews

 5(11348)

C PROGRAMMING CERTIFICATION COURSE

C Programming Certification Course

Reviews

 5(483)

PYTHON DJANGO CERTIFICATION TRAINING COURSE

Python Django Certification Training Course

Reviews

 5(6567)

ADVANCED JAVA CERTIFICATION TRAINING

Advanced Java Certification Training

Reviews

 5(4312)

C++ PROGRAMMING COURSE

C++ Programming Course

Reviews
 5(344)

SPRING FRAMEWORK CERTIFICATION COURSE

Spring Framework Certification Course

Reviews

 5(9332)

NODE.JS CERTIFICATION TRAINING COURSE

Node.js Certification Training Course

Reviews

 5(7078)

Next

Response.Output.Write() is used to get the formatted output.

Q-8: What is the difference between Response.Redirect and Server.Transfer?

Response.Redirect basically redirects the user’s browser to another page or site. The history of the
user’s browser is updated to reflect the new address as well. It also performs a trip back to the client
where the client’s browser is redirected to the new page.

Whereas, Server.Transfer transfers from one page to the other without making any round-trip back to
the client’s browser. The history does not get updated in the case of Server.Transfer.

Q-9: What is the difference between managed and unmanaged code?

Managed code Unmanaged code

Managed code is managed by CLR Any code that is not managed by CLR

.NET framework is necessary to execute managed


Independent of .NET framework
code

CLR manages memory management through Own runtime environment for compilation and
garbage collection execution

Q-10: Explain the difference between a class and an object?


Class Object

Class is the definition of an object An object is an instance of a class.

A class does not become an object unless


It is a template of the object
instantiated

An object is used to access all those properties


It describes all the methods, properties, etc
from the class.

Q-11: What do you know about boxing and unboxing?

Boxing Unboxing

Implicit Explicit

Converting a value type to the type object Extracting the value type from the object

eg : obj myObject = i; eg : i = (int)myObject;

Q-12: Differentiate between constants and read-only variables.

Constants Read-only Variables

Evaluated at compile time Evaluated at run-time

Support only value type variables They can hold the reference type variables

They are used when the value is not changing at Used when the actual value is unknown before the
compile time run-time

Cannot be initialized at the time of declaration or Can be initialized at the time of declaration or in a
in a constructor constructor

Q-13: What is BCL?

 BCL is a base class library of classes, interfaces and value types

 It is the foundation of .NET framework applications, components, and controls

 Encapsulates a huge number of common functions and make them easily available for the
developers

 It provides functionality like threading, input/output, security, diagnostics, resources,


globalization, etc.

 Also serves the purpose of interaction between user and runtime

 It also provides namespaces that are used very frequently. for eg: system, system.Activities, etc.

Q-14: What are the different versions of the .NET framework?


Version  .NET Framework  Visual Studio

C# 1.0 .NET Framework 1.0/1.1 Visual Studio .NET 2002

C# 2.0 .NET Framework 2.0 Visual Studio 2005

C# 3.0 .NET Framework 3.0/3.5 Visual Studio 2008

C# 4.0 .NET Framework 4.0 Visual Studio 2010

C# 5.0 .NET Framework 4.5 Visual Studio 2012/2013

C# 6.0 .NET Framework 4.6 Visual Studio 2013/2015

C# 7.0 .NET CORE Visual Studio 2017

Q-15: What is the difference between namespace and assembly?

An assembly is a physical grouping of logical units whereas namespace groups classes. Also, a
namespace can span multiple assemblies as well.

Q-16: What is LINQ?

It is an acronym for Language integrated query which was introduced with visual studio 2008. LINQ is a
set of features that extend query capabilities to the .NET framework language syntax that allows data
manipulation irrespective of the data source. LINQ bridges the gap between the world of objects and the
world of data.

Q-17: What is MSIL?

Microsoft .NET Framework Certification Training

Weekday / Weekend BatchesSee Batch Details

MSIL is the Microsoft Intermediate Language, it provides instructions for calling methods, storing and
initializing values, memory handling, exception handling and so on. All the .NET codes are first compiled
to Intermediate Language.

Q-18: From which base class all web Forms are inherited?
All web forms are inherited from page class.

Want to upskill yourself to get ahead in your career? Check out this video

Top 10 Technologies to Learn in 2022 | Edureka

Intermediate .NET interview questions

Q-1: Explain the different parts of the assembly.

Following are the different parts of assembly:

 Manifest: It has the information about the version of the assembly.

 Type Metadata: Contains the binary information of the program

 MSIL: Microsoft Intermediate Language Code

 Resources: List of related files

Q-2: How do you prevent a class from being inherited?

In C#, we can use the sealed keyword to prevent a class from being inherited.

Q-3: What are the different types of constructors in c#?

Following are the types of constructors in C#:


 Default Constructor

 Parameterized constructor

 Copy Constructor

 Static Constructor

 Private Constructor

Q-4: What are the different types of assemblies?

There are two types of assemblies:

 Private Assembly: It is accessible only to the application, it is installed in the installation


directory of the application.

 Shared Assembly: It can be shared by multiple applications, it is installed in the GAC.

Q-5: What are MDI and SDI?

 MDI( Multiple Document Interface): An MDI lets you open multiple windows, it will have one
parent window and as many child windows. The components are shared from the parent
window like menubar, toolbar, etc.

 SDI( Single Document Interface): It opens each document in a separate window. Each window
has its own components like menubar, toolbar, etc. Therefore it is not constrained to the parent
window.

Q-6: What is the difference between custom and user control?

Custom Control User Control

Derives from control Derives from UserControl

Dynamic Layout Static Layout

Defines a single control Defines a set of con

It has full toolbox support Cannot be added to the toolbox

Loosely coupled control Tightly coupled control

Q-7: What is a garbage collector?

Garbage collector feature in .NET frees the unused code objects in the memory. The memory head is
divided into 3 generations:

 Generation 0: It stores short-lived objects.

 Generation 1: This is for medium-lived objects.

 Generation 2: It stores long-lived objects.


Collection of garbage refers to the collection of objects stored in the generations.

Q-8: What is caching?

Caching simply means storing the data temporarily in the memory so that the data can be accessed from
the memory instead of searching for it in the original location. It increases the efficiency of the
application and also increases its speed.

Following are the types of caching:

 Page caching

 Data caching

 Fragment caching

Q-9: Explain MVC.

MVC stands for model view controller which is an architecture to build .NET applications.

Model: They are the logical part of any application that handles the object storage and retrieval from
the databases for an application.

View: View handles the UI part of an application. They get the information from the models for their
display.

Controller: They handle the user interactions, figure out the responses for the user input and also
render the view that is required for the user interaction.
Q-10: What is CAS?

CAS stands for code access security, CAS is a part of a security model that prevents unauthorized access
to the resources. It also enables the users to set permissions for the code. CLR then executes the code
depending upon the permissions.

CAS can only be used for managed code. If an assembly uses CAS it is treated as partially trusted.
Although it goes through checks each time an assembly tries to access the resources.

Q-11: Explain localization and globalization.

Localization Globalization

It means changing the already globalized application Globalization is the process of developing
to cater to a specific language or culture. applications to support multiple languages.

Microsoft.Extensions.Localization is used to localize Existing applications can also be converted to


the application content. support multiple languages.

Q-12: What is the application domain?

ASP.NET introduces a concept of application domain or AppDomain which is like a lightweight process
that acts like both container and boundary. The .NET run-time uses the AppDomain as a container for
data and code. The CLR allows multiple .NET applications to run in a single AppDomain.

Q-13: What is delegate in .NET?


A delegate in .NET is similar to a function pointer in other programming languages like C or C++. A
delegate allows the user to encapsulate the reference of a method in a delegate object. A delegate
object can then be passed in a program, which will call the referenced method. We can even use a
delegate method to create a custom event in a class.

Q-14: Difference between interface and abstract class in .NET?

Interface Abstract Class

An abstract class provides a partial implementation


An interface merely declares a contract or
for a functionality that must be implemented by
behavior that implementing classes should have.
the inheriting entities.

An interface may declare only properties, methods


An abstract class declares fields too.
and events with no access modifier.

Neither interface nor an abstract class can be instantiated.

Q-15: What is the difference between a stack and a heap?

Stack Heap

Stored value type Stored reference type

A stack is responsible for keeping track of each The heap is responsible for keeping track of the
executing thread and its location. more precise objects or data.

Q-16: What are the different validators in ASP.NET?

 Client-side validation – When the validation takes place on the client-side browser, it is called
client-side validation. Usually, JavaScript is used for client-side validation.

 Server-side validation – When the validation takes place on the server then it is called server-
side validation. Server-side validation is considered as a secure form of validation because even
if the user bypasses the client-side validation we can still catch it in server-side validation.

Advanced .NET Interview Questions

Q-1:  What are EXE and DLL?

EXE and DLL are assembly executable modules.

EXE: It is an executable file that runs the application for which it is designed. When we build an
application, an exe file is generated. Therefore the assemblies are loaded directly when we run an exe.
But an exe file cannot be shared with other applications.

DLL: It stands for dynamic link library that consists of code that needs to be hidden. The code is
encapsulated in this library, an application can have many DLLs and can also be shared with other
applications.

Q-2: What is the difference between function and stored procedure?


Function Stored Procedure

Must return a single value Always used to perform a specific task

It can only have the input parameter It can have both input and output parameters

Exception handling is not possible using a try-catch Exception handling can be done using a try-catch
block block

A stored procedure cannot be called from a


A function can be called from a procedure
function

Q-3: List the events in the page life cycle.

Following are the events in the page life cycle:

 Page_PreInit

 Page_Init

 Page_InitComplete

 Page_PreLoad

 Page_Load

 Page_LoadComplete

 Page_PreRender

 Render

Q-4: What is the code to send an email from an ASP.NET application?

1 mail message = new mail();

2 message.From = "[email protected]";

3 message.To = "[email protected]";

4 message.Subject = "Test";

5 message.Body = "hello";

6  

7 SmtpMail.SmtpServer = "localhost";

8 SmtpMail.Send(message);

Q-5: What are the event handlers that we have for the Global.asax file?

 Application Events: 
o Application_Start, Application_End, Application_AcquireRequestState,
Application_AuthenticateRequest, Application_AuthorizeRequest,
Application_BeginRequest, Application_Disposed, Application_EndRequest,
Application_Error, Application_PostRequestHandlerExecute,
Application_PreRequestHandlerExecute, Application_PreSendRequestContent,
Application_PreSendRequestHeaders, Application_ReleaseRequestState,
Application_ResolveRequestCache, Application_UpdateRequestCache

 Session Events: 

o Session_Start, Session_End

Q-6: Explain role-based security.

Role-based security is used to implement security measures based on the role assigned to the users in
the organization. Then we can authorize users based on their roles in the organization. For example,
windows have role-based access like user, administrators, and guests.

Q-7: What is cross-page posting?

Whenever we click on a submit button on a page, the data is stored on the same page. But if the data is
stored on a different page, it is known as a cross-page posting.

Cross-page posting can be achieved by POSTBACKURL property which causes the postback.

FindControl method can be used to get the values that are posted on this page to which the page has
been posted.

Q-8: How can we apply themes to an ASP.NET application?

We can use the web.config file to specify the themes

1 <cofiguration>

2 <system.web>

3 <pages theme="windows"/>

4 </system.web>

5 </configuration>

Q-9: Explain passport authentication.

During the passport authentication, it first checks the passport authentication cookie, if the cookie is not
available the application redirects to the passport sign on page. Passport service then authenticates the
details of the user on the sign on page and if they are valid, stores them on the client machine and then
redirects the user to the requested page.

Q-10: What are ASP.NET security controls?

 <asp: Login>: Provides a login capability that enables the users to enter their credentials.
 <asp: LoginName>: Allows you to display the name of the logged-in user.

 <asp: LoginStatus>: Displays if the user is authenticated or not.

 <asp: LoginView>: provides various login views depending on the template that has been
selected.

 <asp: PasswordRecovery>: Emails the users the lost passwords.

Q-11: List all the templates of the Repeater control.

 ItemTemplate

 AlternatingItemTemplate

 SeparatorTemplate

 HeaderTemplate

 FooterTemplate

Q-12: What is the appSettings section in the web.config file?

If we want to set the user-defined values for the whole applications, we can use the appSettings block in
the web.config file. For example the code below uses the ConnectionString throughout the project for
the database connection:

1 <em><configuration>

2 <appsettings>

3 <add key= "ConnectionString" value="server=local; pwd=password; database=default" />

4 </appSettings></em>

Q-13: What is MIME?

MIME stands for multipurpose internet mail extensions, it is the extension of the e-mail protocol which
lets users use the protocol to exchange files over the internet.

Servers insert the MIME header at the beginning of the web transmission. Then the clients use this
header to select an appropriate ‘player’ for the type of data that the header indicates. Some of these
players are built into the web browser.

Q-14: What is HTTP Handler?

Every request into an ASP.NET application is handled by a specialized component called HTTP handler. It
is the most important component for handling ASP.NET application requests.

It uses different handlers to serve different files. The handler for web page creates the page and control
objects, runs your code and then renders the final HTML.

Following are the default HTTP handlers for ASP.NET:

 Page Handler(.aspx): Handles web pages


 User Control Handler(.ascx): It handles web user control pages

 Web Service Handler(.asmx): Handles web service pages

 Trace Handler(trace.axd): It handles trace functionality

Q-15: What are the different types of cookies in ASP.NET?

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

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

Q-16: What is the difference between ExecuteScalar and ExecuteNonQuery?

ExecuteScalar ExecuteNonQuery

Returns the output value Does not return any value

Used for fetching a single value Used to execute insert and update statements

Does not return the number of affected rows Returns the number of affected rows.

This brings us to the end of this tutorial. Hope all the questions shared in the article are clear to you.

If you found this article on “.NET Interview Questions” relevant, check out the  Edureka  .NET Certification
Training,  a trusted online learning company with a network of more than 250,000 satisfied learners
spread across the globe.  We are here to help you with every step on your journey and come up with a
curriculum that is designed for students and professionals who want to be a .NET developer. 

If you come across any questions, feel free to ask all your questions in the comments section of “.NET
Interview Questions” and our team will be glad to answer.

1) What is .NET?

.NET is a framework for software development. It is just like other software development framework like
(J2EE). It provides runtime capabilities and a rich set of pre-built functionality in the form of class library
and API's. This .NET framework is an environment to build, deploy and run web services and other
applications.

The .NET framework contains three main parts:

o Common Language Runtime

o Framework classes

o ASP.NET

2) How many languages are supported by .NET at present time?


When .NET was introduced first time, it supports many languages like VB.NET,C#,COBOL, and Perl etc. At
present time it supports almost 44 languages.

3) How is it possible for .NET to support many languages?

The .NET language code is compiled to Microsoft Intermediate Language (MSIL). The generated code is
called managed code. This managed code is run in .NET environment. So after compilation the language
is not a barrier and the code can call or use function of another language also.

4) Is ASP.NET different from ASP? If yes, explain how?

Yes, ASP.NET is different from ASP. These are the main differences:

o ASP.NET is developed by Microsoft to create dynamic web applications while ASP (Active Server
Pages) is a Microsoft's server side technology use to create web pages.

o ASP.NET is compiled while ASP is interpreted.

o ASP uses the technology named ADO while ASP.NET uses ADO.NET.

o ASP.NET is completely object oriented while ASP is partially object oriented.

5) What is the state management in ASP.NET?

State management is a technique that is used to manage a state of an object on different request. It is
very important to manage state in any web application. There are two types of state management
systems in ASP.NET.

o Client side state management

o Server side state management

6) What is the difference between trace and debug?

Debug class is used to debug builds while Trace is used for both debug and release builds.

7) What are differences between system.stringbuilder and system.string?

The main differences between system.stringbuilder and system.string are:

o system.stringbuilder is a mutable while system.string is immutable.

o Append keyword is used in system.stringbuilder but not in system.string.


8) What is the difference between int and int32?

There is no difference between int and int32. System. Int is an alias name for System.Int32 which is
a .Net Class.

9) What is the difference between namespace and assembly?

An assembly is a physical grouping of logical units while namespace groups classes. A namespace can
span multiple assemblies.

10) Explain the differences between value type and reference type.

Following are the main differences between value type and reference type:

o Value type contain variable while reference type doesn't contain value directly in its memory.

o In reference type, memory is allocated in managed heap and in value type memory allocated in
stack.

o Reference type ex-class value type-struct, enumeration

11) What is the difference between session object and application object?

The session object is used to maintain the session of each user.

For example: If a user enters into the application then he will get a session id. If he leaves from the
application then the session id is deleted. If he again enters into the application, he will get a different
session id.

But in the case of application object the id is maintained for whole application.

12) What are differences between function and stored procedure in .Net programming language?

The difference between function and stored procedure:

o Function returns only one value but procedure can return one or more than one value.

o Function can be used in select statements but procedure cannot be used.

o Function has only input parameters while Procedure can have an input and output parameters.

o Exceptions can be handled by try catch block in procedures but that is not possible in function.

13) How to retrieve user name in case of Window Authentication?


System.Environment.UserName

14) What is the difference between Hash table and Array list?

Hash table stores data in the form of value pair and name while Array list stores only values.

You need to pass name to access value from the Hash table while in Array, you need to pass index
number to access value.

In Array, you can store only similar type of data type while in Hash table you can store different type of
data types. ex. int, string etc.

15) What is the meaning of Immutable?

Immutable means once you create a thing, you cannot modify it.

For example: If you want give new value to old value then it will discard the old value and create new
instance in memory to hold the new value.

16) What are the advantages of using session?

The advantages of using session are:

o A session stores user states and data to all over the application.

o It is very easy to implement and we can store any kind of object.

o It can store every user data separately.

o Session is secure and transparent from user because session object is stored on the server.

17) What are the disadvantages of using session?

The disadvantages of using session are:

o Performance overhead occurs in case of large number of users, because session data is stored in
server memory.

o Overhead involved in serializing and De-Serializing session Data. Because In case of StateServer
and SQLServer session mode we need to serialize the object before store.

18) Can you set the session out time manually?

Yes. Session out time can be set manually in web.config.


19) Explain the boxing and unboxing concept in .Net?

Boxing: Boxing is a process of converting value type into reference type.

Unboxing: Unboxing is a process of converting reference type to value type.

20) Is it possible to change the index of primary key on table?

No.

21) What is HTTPhandler?

HttpHandler is a low level request and response API which is made to service incoming Http request.
Every incoming Http request recieved by ASP.NET is ultimately processed by a instance of a class that
implements HttpHandler.

22) What is .NET Framework and what are the main components of it?

.NET Framework facilitates the developer to develop, run and deploy the applications like console
application, window Forms applications, web applications, web services, window services etc. It also
provides environment to create sharable components to be used in distributed computing architecture.

Main components of .Net Framework:

o Class library

o Common Language Runtime (CLR)

o Dynamic Language Runtime (DLR)

o Application Domains

o Runtime Hosts

o Cross-language interoperability

o Framework security

o Profiling etc.

23) What is manifest in .NET Framework?

Manifest is used to store assembly metadata. It contains all the metadata which are necessary for
following things.
o Version of assembly

o Security identity

o Scope of the assembly

o To resolve references to resources and classes

24) What are the memory-mapped files?

Memory-mapped files are used to map the content of a file to the logical address of an application. It
makes you able to run multiple process on the same machine to share data with each other. To obtain a
memory mapped file object, you can use the method MemoryMappedFile.CreateFromFiles( ). It
represents a persistent memory-mapped file from a file on disk.

25) Which method is used to enforce garbage collection in .NET?

System.GC.Collect() method.

26) What is the difference between dispose() and finalize()?

Although Dispose and Finalize both methods are used by CLR to perform garbage collection of runtime
objects of .NET applications but there is a difference between them.

The Finalize method is called automatically by the runtime while the Dispose method is called by the
programmer.

27) Explain the Code Access Security (CAS) in .NET framework.

.NET security model is used to prevent unauthorized access of resources and operations and also restrict
the codes to perform particular tasks. Code Access Security is a part of that .NET security.

28) What is Garbage collection?

Garbage collection is used to prevent memory leaks during execution of programs. There is a low-
priority process name as garbage collector manages the allocation and deallocation a memory for
applications. It also checks for the unreferenced variables and objects. If there is ny object which is no
further used by application the Garbage collector frees up the memory from that object.

29) How can you identify that the page is post back?
There is a property, named as "IsPostBack" property. You can check it to know that the page is post
backed or not.

30) What is variable and constant in .NET programming language?

Variable: A variable is a data storage location in the computer memory that contains a value and has a
meaningful name. Every variable is attached to a data type which determines what type of value can be
stored in the variable.

Variables can be declared by using the following syntax:

1. <data_type>  <variable_name>;  

Constant: Constant is also similar to the variable except that the value. Value once assigned to a
constant can't be changed. Constants must be initialized at the same time they are declared.

Constants can be declared by using the following syntax:

1. const int interestRate =10;  

31) If you want to replace multiple if-else statements in code, which statement will you use?

In Visual basic, we can use Select-Case statement to replace multiple If-Else statement. In C#, we should
use Switch-Case statement to replace multiple If-Else statement.

32) What are the different types of indexes in .Net?

There are two types of indexes in .Net:

Clustered index and non-clustered index

33) How many types of memories are there in .Net?

There are two types of memories in .Net

o Stack memory

o Heap Memory

34) Which are the new features added in .NET framework 4.0?

A list of new features of .NET Framework 4.0:

o Improved Application Compatibility and Deployment Support


o Dynamic Language Runtime

o Managed Extensibility Framework

o Parallel Programming framework

o Improved Security Model

o Networking Improvements

o Improved Core ASP.NET Services

o Improvements in WPF 4

o Improved Entity Framework (EF)

o Integration between WCF and WF

35) What are cookies?

A cookie is a small amount of data created by server on the client. When a web server creates a cookie,
an additional HTTP header is sent to the browser when a page is served to the browser.

36) What are the disadvantages of cookies?

The main disadvantages of cookies are:

o Cookie can store only string value.

o Cookies are browser dependent.

o Cookies are not secure.

o Cookies can store only small amount of data.

37) What is an IL?

IL stands for Intermediate Language. It is also known as MSIL (Microsoft Intermediate Language) or CIL
(Common Intermediate Language).

All .NET source codes are first compiled to IL. Then, IL is converted to machine code at the point where
the software is installed, or at run-time by a Just-In-Time (JIT) compiler.
38) Which method is used to enforce garbage collection in .NET?

System.GC.Collect() method is used to enforce garbage collection in .Net.

39) What are tuples in .Net?

A tuple is a fixed-size collection that can have elements of either same or different data types. The user
must have to specify the size of a tuple at the time of declaration just like arrays.

40) How many elements a tuple can hold?

A tuple can hold up from 1 to 8 elements. In the case of more than 8 elements, then the 8th element
can be defined as another tuple. Tuples can be specified as parameter or return type of a method.

41) Which architecture does a Dataset follow?

A Dataset follows the disconnected data architecture.

42) How do you check whether a DataReader is closed or opened?

There is a property named "IsClosed" property is used to check whether a DataReader is closed or
opened. This property returns a true value if a Data Reader is closed, otherwise a false value is returned.

43) What are the basic requirements for connection pooling?


The following two requirements must be fulfilled for connection pooling:

o There must be multiple processes to share the same connection describing the same parameters
and security settings.

o The connection string must be identical.

44) Which adapter should be used to get the data from an Access database?

OleDbDataAdapter is used to get the data from an Access database.

45) What are the parameters that control most of connection pooling behaviors?

The following parameters control the connection pooling behavior:

o Connect Timeout

o Max Pool Size

o Min Pool Size

o Pooling

46) What do you mean by AutoPostBack?

AutoPostBack is a property which is used to postback automatically when an event is raised. You have to
set the AutoPostBack property of the control to True.

47) Which properties are used to bind a DataGridView control?

The DataSource property and the DataMember property are used to bind a DataGridView control.

1) What is .NET?

.NET is a framework for software development. It is just like other software development framework like
(J2EE). It provides runtime capabilities and a rich set of pre-built functionality in the form of class library
and API's. This .NET framework is an environment to build, deploy and run web services and other
applications.

The .NET framework contains three main parts:

o Common Language Runtime

o Framework classes

o ASP.NET
2) How many languages are supported by .NET at present time?

When .NET was introduced first time, it supports many languages like VB.NET,C#,COBOL, and Perl etc. At
present time it supports almost 44 languages.

3) How is it possible for .NET to support many languages?

The .NET language code is compiled to Microsoft Intermediate Language (MSIL). The generated code is
called managed code. This managed code is run in .NET environment. So after compilation the language
is not a barrier and the code can call or use function of another language also.

4) Is ASP.NET different from ASP? If yes, explain how?

Yes, ASP.NET is different from ASP. These are the main differences:

o ASP.NET is developed by Microsoft to create dynamic web applications while ASP (Active Server
Pages) is a Microsoft's server side technology use to create web pages.

o ASP.NET is compiled while ASP is interpreted.

o ASP uses the technology named ADO while ASP.NET uses ADO.NET.

o ASP.NET is completely object oriented while ASP is partially object oriented.

5) What is the state management in ASP.NET?

State management is a technique that is used to manage a state of an object on different request. It is
very important to manage state in any web application. There are two types of state management
systems in ASP.NET.

o Client side state management

o Server side state management

6) What is the difference between trace and debug?

Debug class is used to debug builds while Trace is used for both debug and release builds.

7) What are differences between system.stringbuilder and system.string?

The main differences between system.stringbuilder and system.string are:

o system.stringbuilder is a mutable while system.string is immutable.


o Append keyword is used in system.stringbuilder but not in system.string.

8) What is the difference between int and int32?

There is no difference between int and int32. System. Int is an alias name for System.Int32 which is
a .Net Class.

9) What is the difference between namespace and assembly?

An assembly is a physical grouping of logical units while namespace groups classes. A namespace can
span multiple assemblies.

10) Explain the differences between value type and reference type.

Following are the main differences between value type and reference type:

o Value type contain variable while reference type doesn't contain value directly in its memory.

o In reference type, memory is allocated in managed heap and in value type memory allocated in
stack.

o Reference type ex-class value type-struct, enumeration

11) What is the difference between session object and application object?

The session object is used to maintain the session of each user.

For example: If a user enters into the application then he will get a session id. If he leaves from the
application then the session id is deleted. If he again enters into the application, he will get a different
session id.

But in the case of application object the id is maintained for whole application.

12) What are differences between function and stored procedure in .Net programming language?

The difference between function and stored procedure:

o Function returns only one value but procedure can return one or more than one value.

o Function can be used in select statements but procedure cannot be used.

o Function has only input parameters while Procedure can have an input and output parameters.

o Exceptions can be handled by try catch block in procedures but that is not possible in function.
13) How to retrieve user name in case of Window Authentication?

System.Environment.UserName

14) What is the difference between Hash table and Array list?

Hash table stores data in the form of value pair and name while Array list stores only values.

You need to pass name to access value from the Hash table while in Array, you need to pass index
number to access value.

In Array, you can store only similar type of data type while in Hash table you can store different type of
data types. ex. int, string etc.

15) What is the meaning of Immutable?

Immutable means once you create a thing, you cannot modify it.

For example: If you want give new value to old value then it will discard the old value and create new
instance in memory to hold the new value.

16) What are the advantages of using session?

The advantages of using session are:

o A session stores user states and data to all over the application.

o It is very easy to implement and we can store any kind of object.

o It can store every user data separately.

o Session is secure and transparent from user because session object is stored on the server.

17) What are the disadvantages of using session?

The disadvantages of using session are:

o Performance overhead occurs in case of large number of users, because session data is stored in
server memory.

o Overhead involved in serializing and De-Serializing session Data. Because In case of StateServer
and SQLServer session mode we need to serialize the object before store.
18) Can you set the session out time manually?

Yes. Session out time can be set manually in web.config.

19) Explain the boxing and unboxing concept in .Net?

Boxing: Boxing is a process of converting value type into reference type.

Unboxing: Unboxing is a process of converting reference type to value type.

20) Is it possible to change the index of primary key on table?

No.

21) What is HTTPhandler?

HttpHandler is a low level request and response API which is made to service incoming Http request.
Every incoming Http request recieved by ASP.NET is ultimately processed by a instance of a class that
implements HttpHandler.

22) What is .NET Framework and what are the main components of it?

.NET Framework facilitates the developer to develop, run and deploy the applications like console
application, window Forms applications, web applications, web services, window services etc. It also
provides environment to create sharable components to be used in distributed computing architecture.

Main components of .Net Framework:

o Class library

o Common Language Runtime (CLR)

o Dynamic Language Runtime (DLR)

o Application Domains

o Runtime Hosts

o Cross-language interoperability

o Framework security

o Profiling etc.

23) What is manifest in .NET Framework?


Manifest is used to store assembly metadata. It contains all the metadata which are necessary for
following things.

o Version of assembly

o Security identity

o Scope of the assembly

o To resolve references to resources and classes

24) What are the memory-mapped files?

Memory-mapped files are used to map the content of a file to the logical address of an application. It
makes you able to run multiple process on the same machine to share data with each other. To obtain a
memory mapped file object, you can use the method MemoryMappedFile.CreateFromFiles( ). It
represents a persistent memory-mapped file from a file on disk.

25) Which method is used to enforce garbage collection in .NET?

System.GC.Collect() method.

26) What is the difference between dispose() and finalize()?

Although Dispose and Finalize both methods are used by CLR to perform garbage collection of runtime
objects of .NET applications but there is a difference between them.

The Finalize method is called automatically by the runtime while the Dispose method is called by the
programmer.

27) Explain the Code Access Security (CAS) in .NET framework.

.NET security model is used to prevent unauthorized access of resources and operations and also restrict
the codes to perform particular tasks. Code Access Security is a part of that .NET security.

28) What is Garbage collection?

Garbage collection is used to prevent memory leaks during execution of programs. There is a low-
priority process name as garbage collector manages the allocation and deallocation a memory for
applications. It also checks for the unreferenced variables and objects. If there is ny object which is no
further used by application the Garbage collector frees up the memory from that object.
29) How can you identify that the page is post back?

There is a property, named as "IsPostBack" property. You can check it to know that the page is post
backed or not.

30) What is variable and constant in .NET programming language?

Variable: A variable is a data storage location in the computer memory that contains a value and has a
meaningful name. Every variable is attached to a data type which determines what type of value can be
stored in the variable.

Variables can be declared by using the following syntax:

1. <data_type>  <variable_name>;  

Constant: Constant is also similar to the variable except that the value. Value once assigned to a
constant can't be changed. Constants must be initialized at the same time they are declared.

Constants can be declared by using the following syntax:

1. const int interestRate =10;  

31) If you want to replace multiple if-else statements in code, which statement will you use?

In Visual basic, we can use Select-Case statement to replace multiple If-Else statement. In C#, we should
use Switch-Case statement to replace multiple If-Else statement.

32) What are the different types of indexes in .Net?

There are two types of indexes in .Net:

Clustered index and non-clustered index

33) How many types of memories are there in .Net?

There are two types of memories in .Net

o Stack memory

o Heap Memory

34) Which are the new features added in .NET framework 4.0?

A list of new features of .NET Framework 4.0:


o Improved Application Compatibility and Deployment Support

o Dynamic Language Runtime

o Managed Extensibility Framework

o Parallel Programming framework

o Improved Security Model

o Networking Improvements

o Improved Core ASP.NET Services

o Improvements in WPF 4

o Improved Entity Framework (EF)

o Integration between WCF and WF

35) What are cookies?

A cookie is a small amount of data created by server on the client. When a web server creates a cookie,
an additional HTTP header is sent to the browser when a page is served to the browser.

36) What are the disadvantages of cookies?

The main disadvantages of cookies are:

o Cookie can store only string value.

o Cookies are browser dependent.

o Cookies are not secure.

o Cookies can store only small amount of data.

37) What is an IL?

IL stands for Intermediate Language. It is also known as MSIL (Microsoft Intermediate Language) or CIL
(Common Intermediate Language).

All .NET source codes are first compiled to IL. Then, IL is converted to machine code at the point where
the software is installed, or at run-time by a Just-In-Time (JIT) compiler.
38) Which method is used to enforce garbage collection in .NET?

System.GC.Collect() method is used to enforce garbage collection in .Net.

39) What are tuples in .Net?

A tuple is a fixed-size collection that can have elements of either same or different data types. The user
must have to specify the size of a tuple at the time of declaration just like arrays.

40) How many elements a tuple can hold?

A tuple can hold up from 1 to 8 elements. In the case of more than 8 elements, then the 8th element
can be defined as another tuple. Tuples can be specified as parameter or return type of a method.

41) Which architecture does a Dataset follow?

A Dataset follows the disconnected data architecture.

42) How do you check whether a DataReader is closed or opened?

There is a property named "IsClosed" property is used to check whether a DataReader is closed or
opened. This property returns a true value if a Data Reader is closed, otherwise a false value is returned.

43) What are the basic requirements for connection pooling?


The following two requirements must be fulfilled for connection pooling:

o There must be multiple processes to share the same connection describing the same parameters
and security settings.

o The connection string must be identical.

44) Which adapter should be used to get the data from an Access database?

OleDbDataAdapter is used to get the data from an Access database.

45) What are the parameters that control most of connection pooling behaviors?

The following parameters control the connection pooling behavior:

o Connect Timeout

o Max Pool Size

o Min Pool Size

o Pooling

46) What do you mean by AutoPostBack?

AutoPostBack is a property which is used to postback automatically when an event is raised. You have to
set the AutoPostBack property of the control to True.

47) Which properties are used to bind a DataGridView control?

The DataSource property and the DataMember property are used to bind a DataGridView control.

You might also like