Categories

ASP.NET Interview Questions and Answers

Here are Asp.net interview questions and answers for fresher as well as experienced candidates to get their dream job.

1. What is ASP.NET?

ASP.NET is a server-side technology used for developing dynamic websites and web applications on the internet. It also produces data-driven web applications.

Microsoft released ASP.NET in 2002 to build dynamic websites and web applications using the .NET framework.

2. List the languages used for ASP.NET

ASP.NET uses Object-Oriented programming languages that provide a framework and patterns, which are easy to use.

Languages used by ASP.NET Framework are :


C#

C-Sharp is a programming language developed by Microsoft that runs on the .NET framework.

It is used for developing web applications on the .NET framework.

VB.NET

VB.NET is a modern object-oriented programming language developed by Microsoft to combine the features of CLR and .NET.

3. What is MVC?

MVC is a software architectural pattern that divides an application into three main parts Model, View, and Controller.

Model:-
Model helps to create the data domain of the application and represents the public properties and business logic of the application.

View:-
View represents the data tables, charts, and diagrams by collecting the data from the model.

Controller:-
The controller helps in handling the user interactions and controls the flow of the application.

4. What is the ASP.NET Life Cycle, and list the types of Life Cycle?

When ASP.NET pages run, it goes through several steps of the life cycle, which performs a series of actions like initialization, running, restoring, and rendering.

Life Cycle is classified into two categories.

Application Life Cycle:
The user requests for accessing the application.

Page Life Cycle:
Page Life Cycle has phases like initialization, restoring, execution, and page rendering.

5. What platform does ASP.NET use?

ASP.NET is a cross-platform which works on the .NET framework and runs on Linux, Windows, macOS, and Docker.

6. List the advantages of using ASP.NET

ASP.NET is a development framework is used for developing web applications. It is one of the most preferred web development technologies at present.

There are a lot of benefits of using ASP.NET. Here are some advantages:

1) Applications created using ASP.NET show better performance

2) ASP.NET provides multi-development modes for the applications

3) Applications created using ASP.NET can be used across the globe

4) ASP.NET is language independent

7. List types of Application Life Cycle.

Application Life Cycle is of five types:

Application Start:
Application Start is a method that you execute when a user makes a request.

Object Creation:
Object Creation contains all the information about current requests and browsing information.

HTTP Application:
HTTP Application processes all subsequent requests sent to the application.

Application End:
Application End helps to unload the memory of an application.

8. What is IIS? And why do you use it?

Internet Information Server (IIS) is the most popular web server used to host and provide internet-based services to ASP.NET and ASP Web applications.

IIS has its own process engine to handle the requests. Using an IIS computer can work as a web server, and provides functionality to deploy ASP.NET Web applications. It is also responsible for providing responses to the requests made by the users.

9. What is CLR?

CLR is the basic Common Language Runtime virtual machine component of the .NET framework used to run the code. It manages and executing .NET programs. And implements a Virtual Execution System (VES) internally.

Services provided by CLR

1) Verification
2) Garbage collection
3) Security
4) Memory management

10. What type of Library is used in ASP.NET?

A library is a pre-coded Object-Oriented Programming template collection used to develop web-based and desktop applications in ASP.NET.

ASP.NET uses a Web Library to develop web applications.

11. List the components of ASP.NET.

ASP.NET provides data-driven web applications on the internet using various components.

They are:

1) Common Language Runtime

2) Language

3) Library

4) Common Type System

5) Windows Forms

12. Describe Web Forms?

Web forms are web pages that a user requests using a browser. It is built using ASP.NET technology.

It executes on the server and generates output to the browser. It also allows you to add and create custom controls.

Now, have a look at some custom controls provided by ASP.NET.

1) Label

2) TextBox

3) Button

4) Hyperlink

5) ImageButton

13. What is an Active Server Page?

Active Server Page is an HTML page used to develop dynamic web pages. It includes one or more scripts on the Microsoft web server before sending the request to the user.

ASP was first released in December 1996. It is used to generate the content that is sent to the client web browser via HTTP response.

14. Explain uses of Global.asax

Global.asax is used to handle high-level applications like Application_Start, Session_End, Session_Start.

Global file is also used to execute the application-level events and set application-level variables.

15. What type of protocol is used to call web service?

Web service is a web-based functionality accessed by using protocols. It uses XML to exchange the software using common internet protocols.

Web service in asp.net has three aspects, they are:

1) Creating web service

2) Creating a proxy

3) Consuming the web service

4) The HTTP protocol is used in ASP.NET to call a Web Service.

16. What is the difference between ASP and ASP.NET?

ASP

ASP.NET

ASP is the first server-side scripting language developed by Microsoft to design dynamic WebForms.

ASP.NET is a server-side technology used for developing dynamic websites and web applications on the internet.

ASP uses ADO(ActiveX Data Objects) to communicate with the database.

ASP.NET uses ADO.NET to communicate with the database.

ASP is written in VBScript.

ASP.NET is written in C#.

ASP.NET Interview Questions For Intermediate

Now, you will see some intermediate-level ASP.NET Interview Questions and Answers.

17. What is Caching?

Caching is a technique used to sort the user data or information in memory. It boosts the performance of the applications and creates pages automatically.

Caching is also essential for data-related transactions.

18. List types of states in ASP.NET?

State in ASP.NET is used to store the information between requests and to retrieve it when required and holding the information.

ASP.NET provides four types of states:

Application State:
It states all collections of web pages and files in a single directory on a web server.

Cookie State:
It stores the information on the client machine.

View State:
It states the state of the web page and its controls.

Session State:
The session state is used to sort the application data.

19. List the sources of data allowed by ASP.NET.

Data Sources are responsible for operations like insertion, deletion, sorting, and updates.

Some of the data sources allowed by ASP.NET.

1) SQL Data Source

2) Object Data Source

3) Linq Data Source

4) Access Data Source

20. What is the role of Page Directives?

Page directives describe the attributes of the specific page file for the compiler.

Attributes of Page Directives are:

Buffer:
Enables and displays HTTP response

ClientTarget:
Browses the server controls

ClientName:
Specifies the class name of the page

Debug:
Enables or specifies compilation debug

CodeFile:
Specifies the name of the code-behind file

21. How is ASP.NET different from ASP.NET Core?

ASP.NET is used to build applications for Windows, where ASP.NET Core is used for Windows, macOS, and Linux.

ASP.NET

ASP.NET Core

ASP.NET is used to build applications for Windows.

ASP.NET Core is used for Windows, macOS, and Linux.

Uses .NET framework

Uses .NET Core framework

Single Version

Multiple Versions

22. What is Late Binding?

Late Binding takes more time to compile. It is hard to find out the object through Late Binding. Late Binding has dynamic objects and is achieved by virtual machines.

23. What is Early Binding?

Early Binding is used to check the methods and properties during compilation. It is fast and easy to code and also reduces the compilation time. It also reduces the time by identifying the errors.

24. What is a Multi-View?

Multi-View is a parent control for the View. It is used to control all types of views.

Multi-View has the prefix mv.

25. Describe a View State?

View State is a Page-Level State Management technique that is used to preserve the values of the page and controls.

View state contains the following sections:

1) Features

2) Background

3) Scenario

4) Class Reference

26. What is a Web Library?

Web Library is a part of a website that accesses all libraries from the browser and helps in adding collections online.

1) It contains base and user-defined data types

2) Access to data

3) Supports to create web services

27. List events of Calendar Control

Calendar control is a function used to provide a calendar on a web page. It also enables you to change and move to the previous months and years.

1) Displaying Month

2) Selecting weeks and days

3) Selecting range

4) Displaying the days programmatically

The events of calendar control are three types:

1) Selection Changed

2) Day Render

3) Visible Month Changed

28. How can a page layout help in ASP.NET?

Page layout provides an overall container for the pages on the website. For example, Navigation Area and Footer. Page layout also includes the main content.

29. What is a Trace?

Tracing enables view diagnostic information about a single request at runtime and debug the application.

The trace contains features, background, code examples, and class references.

30. How can we add a Style sheet in Visual Studio?

To add a style sheet, open Solution Explorer and right-click on the option, then click on new, and a pop-up will appear to choose.

31. List types of Caching.

Caching is a technique used to sort the user data or information in memory.

Caching is divided into three types:-

Output Caching:
It specifies the duration of the cache and the attribute.

Fragment Caching:
It is a user control caching used in a basic web form page.

Data Caching:
It is used for caching the data of data source controls.

32. List the most common built-in objects of ASP.NET?

Built-in objects access the information from the webserver. It is also responsible for recognizing the client who is accessing the web page.

Some common built-in objects of ASP.NET are:

Session:
Describes the methods and properties of the objects and stores the information related to the user.

Context:
Describes wrapper for the object.

Application:
Describes the methods and properties of the objects and stores the information related to the web application.

Request:
Describes the methods and properties of the objects and stores the information related to the HTTP requests.

Server:
Describes the methods and properties of the objects from various servers.

Response:
Describes the methods and properties of the objects and stores the information related to the server response.

33. Explain about Event Bubbling?

Event bubbling is used by data-bound controls. When a parent control contains child controls, and when an event occurs in child controls, it bubbles the event to the parent; this is called Event bubbling.

Event Bubble is classified into two categories:

OnBubbleEvent:
Handles the event data.

RaiseBubbleEvent:
Sends the event data.

34. List advantages of using HTML Server controls.

HTML Server Controls are the standard HTML controls used to enable server-side processing.

Some advantages of using HTML Server Controls are:

HTML Server Control does not possess any mechanism to identify the capabilities of a client browser.

Coding can be easy by adding the runat=”server” attribute.

Controls can interact with the Client-Side Scripting.

35. What are Breakpoints?

A breakpoint helps to specify the runtime to run a line of a line

ASP.NET Interview Questions For Experienced

Now, you will see some advanced ASP.NET Interview Questions and Answers.

36. What are Button controls?

Button controls in ASP.NET are used to display a push button on a web page.

Syntax:-

Buttons are divided into three types, they are:

Simple Push Button:
Display the text in a rectangular area.

Link Button:
Display text like a hyperlink.

Image Button:
Displays an image.

37. List five web controls in ASP.NET

Web Controls are HTML elements used for script tagging and functionality for web forms and pages. They are:

1) HTML Controls

2) HTML Server Controls

3) User and Custom Controls

4) ASP.NET Server Controls

5) ASP.NET Ajax Server Controls

38. What is the role of Postback in ASP.NET?

Postback is a request sent from a client to the server from the page on which the user is working. It posts the complete page back to the server for a new page.

Postback is submitted to a server before processing the page and holds credentials such as verification like username and passwords using a database.

39. List the types of Authentication in ASP.NET?

Authentication is a process of ensuring the user identity.

It is divided into four types:

1) Form Authentication

2) Windows Authentication

3) Custom Authentication

4) Passport Authentication

40. Define Web Configuration.

Web Configuration is used to describe the property and behavior of web applications. It also helps to manage settings. Each file of a web configuration is an XML file that contains a set of configuration elements.

41. Explain Client-Side Script events

Client-Side Script runs on the browser and speeds up the execution of the page.

onclick:
It is used when the control is clicked.

onfocus:
It is used when the control receives the focus.

onchange:
It is used when the value of the control is changed.

onblur:
It is used when the control loses focus.

onkeypress:
It is used when the user presses the key.

42. What is Form-Based Authentication?

Form-Based authentication is used to edit the web configuration files and add a login page to authenticate. It is used for web applications.

Form-based authentication also provides a way to handle authentication using custom logics in ASP.NET applications.

43. Define Configuration files?

Configuration files help to manage the settings of a website. Settings of configuration files are stored as XML files which are separate from the application.

Configuration files are two types:

Web Configuration:
It contains the machine-specific value for all settings of the application.

Machine Configuration:
It helps to extend, restrict and override the settings.

44. List different types of cookies used in ASP.NET

Cookies are small pieces of information stored on the client side.

The cookies in ASP.NET are divided into two types:


Session Cookie:
valid for a single session.

Persistent Cookie:
valid for multiple sessions.

45. Explain the difference between custom controls and user controls.

Custom Controls 

User Controls

Custom control is designed for a single application.

User control is designed for multiple applications.

Custom control is loosely coupled.

User control is tightly coupled.

User Interface can be changed.

The User Interface is fixed.

46. What is a Range Validator and state its syntax?

Range validator checks the input values that lie in between the specified ranges.

Range Validator has three properties:

1) Type
2) MinimumValue
3) MaximumValue

47. What is a Thread Priority?

In multithreading, each thread has its own priority that gains access to CPU resources; whenever a thread is created in C#, it always possesses some priority.

It is mainly used to set a value.

48. What is Anonymous Personalization?

Anonymous Personalization helps and allows the user to personalize the site before identifying themselves.

49. Explain the difference between Web Configuration and Machine Configuration files?

Web Configuration

Machine Configuration

Web Config is automatically created when an application is created.

Machine Config is automatically installed with Visual Studio.

File inherits setting from the Machine Config.

Only one Machine Config exists.

50. What is Entity Framework?

Most applications require storing and retrieving data. Usually, we store this data in a database. Working with databases can often be rather complicated. You have to manage database connections, convert data from your application to a format the database can understand, and handle many other subtle issues.

The .NET ecosystem has libraries you can use for this, such as ADO.NET. However, it can still be complicated to manually build SQL queries and convert the data from the database into C# classes back and forth.

EF, which stands for Entity Framework, is a library that provides an object-oriented way to access a database. It acts as an object-relational mapper, communicates with the database, and maps database responses to .NET classes and objects.

Entity Framework (EF) Core is a lightweight, open-source, and cross-platform version of the Entity Framework.


Cross-platform:

1) We can use EF Core in cross-platform apps that target .NET Core.

2) EF 6.x targets .NET Framework, so you’re limited to Windows.

Performance

EF Core is fast and lightweight. It significantly outperforms EF 6.x.M

Features:

EF Core has some features that EF 6.x doesn’t have (batching statements, client-side key generation, in-memory database for testing)