ASP.NET Framework MCQs

What is ASP.NET Framework primarily used for? A) Building desktop applications B) Creating web applications and services C) Managing databases D) Writing mobile applications Answer: B) Creating web applications and services Which version of the .NET Framework introduced ASP.NET Web Forms? A) .NET Framework 1.0 B) .NET Framework 2.0 C) .NET Framework 3.0 D) .NET Framework 4.0 Answer: B) .NET Framework 2.0 What is the role of the Web.config file in ASP.NET Framework? A) To configure web application settings B) To define database schemas C) To manage user authentication D) To specify the routing rules Answer: A) To configure web application settings Which of the following is used to create a web page in ASP.NET Web Forms? A) .aspx file B) .html file C) .cshtml file D) .mvc file Answer: A) .aspx file What is the purpose of the Page_Load event in ASP.NET Web Forms? A) To initialize page data when the page is loaded B) To handle form submissions C) To define the layout of the page D) To manage user sessions Answer: A) To initialize page data when the page is loaded Which control in ASP.NET Web Forms is used for user input? A) GridView B) DataList C) TextBox D) Repeater Answer: C) TextBox How does ASP.NET Web Forms handle state management? A) Through ViewState B) Through SessionState C) Through CookieState D) Through QueryString Answer: A) Through ViewState What is the role of HttpModule in ASP.NET? A) To handle HTTP requests and responses B) To configure database connections C) To manage user authentication D) To define routing rules Answer: A) To handle HTTP requests and responses Which of the following is used to manage user sessions in ASP.NET? A) SessionState B) ViewState C) Cache D) QueryString Answer: A) SessionState What is the primary purpose of ASP.NET MVC? A) To create RESTful services B) To implement the Model-View-Controller design pattern C) To manage server-side scripting D) To build desktop applications Answer: B) To implement the Model-View-Controller design pattern What does the Model in ASP.NET MVC represent? A) The data and business logic B) The user interface C) The controller logic D) The view rendering Answer: A) The data and business logic What is the default view engine in ASP.NET MVC? A) Razor B) WebForms C) JSP D) Blade Answer: A) Razor How do you define routing in ASP.NET MVC? A) In RouteConfig.cs B) In Web.config C) In Startup.cs D) In Global.asax Answer: A) In RouteConfig.cs What is ActionResult in ASP.NET MVC? A) A type that represents the result of an action method B) A class that handles HTTP requests C) A service for data access D) A component for error handling Answer: A) A type that represents the result of an action method How do you pass data from a controller to a view in ASP.NET MVC? A) Using ViewBag B) Using SessionState C) Using ViewState D) Using QueryString Answer: A) Using ViewBag Which method in ASP.NET MVC is used to handle POST requests? A) HttpPost attribute B) HttpGet attribute C) HttpPut attribute D) HttpDelete attribute Answer: A) HttpPost attribute What is the purpose of IActionFilter in ASP.NET MVC? A) To execute code before or after an action method runs B) To manage database connections C) To define routing rules D) To handle session state Answer: A) To execute code before or after an action method runs What does TempData do in ASP.NET MVC? A) Stores data for the duration of a single request B) Stores data between different requests C) Stores data for the duration of a user session D) Manages authentication Answer: A) Stores data for the duration of a single request Which of the following is used to create reusable HTML components in ASP.NET MVC? A) Partial Views B) Master Pages C) Web User Controls D) Page Templates Answer: A) Partial Views What is the purpose of Web API in ASP.NET? A) To build HTTP services that can be consumed by various clients B) To manage user authentication C) To handle database operations D) To define routing rules Answer: A) To build HTTP services that can be consumed by various clients What does IQueryable represent in ASP.NET? A) A data source that supports querying B) A user interface component C) A method for data validation D) A caching mechanism Answer: A) A data source that supports querying What is Entity Framework used for in ASP.NET? A) To handle database operations using ORM B) To manage user sessions C) To define routing D) To create web forms Answer: A) To handle database operations using ORM Which of the following is a feature of ASP.NET Core that is not present in ASP.NET Framework? A) Cross-platform support B) Web Forms C) Web API D) Master Pages Answer: A) Cross-platform support How do you define a custom route in ASP.NET MVC? A) In RouteConfig.cs B) In Web.config C) Using RouteCollection D) Using Startup.cs Answer: A) In RouteConfig.cs Which of the following controls is used for displaying data in a tabular format in ASP.NET Web Forms? A) GridView B) TextBox C) Button D) Label Answer: A) GridView What is ViewState used for in ASP.NET Web Forms? A) To maintain the state of controls between postbacks B) To manage user authentication C) To handle routing D) To store configuration settings Answer: A) To maintain the state of controls between postbacks Which file is used to configure ASP.NET MVC application settings? A) Web.config B) App.config C) Startup.cs D) RouteConfig.cs Answer: A) Web.config What is the purpose of HtmlHelper methods in ASP.NET MVC? A) To generate HTML markup in views B) To manage user authentication C) To handle form submissions D) To define routing rules Answer: A) To generate HTML markup in views What does the ViewBag in ASP.NET MVC allow you to do? A) Pass data from controller to view dynamically B) Store session state C) Manage routing D) Handle form validation Answer: A) Pass data from controller to view dynamically What is Model Binding in ASP.NET MVC? A) The process of mapping HTTP request data to action method parameters B) The process of rendering HTML views C) The process of managing session state D) The process of configuring services Answer: A) The process of mapping HTTP request data to action method parameters How do you implement a custom authentication mechanism in ASP.NET? A) By implementing IAuthenticationProvider B) By extending FormsAuthentication C) By modifying Web.config D) By using CustomUserManager Answer: B) By extending FormsAuthentication Which class is used to manage HTTP requests and responses in ASP.NET Web Forms? A) HttpContext B) HttpRequest C) HttpResponse D) HttpSession Answer: A) HttpContext How do you specify a default route in ASP.NET MVC? A) In RouteConfig.cs B) In Web.config C) In Startup.cs D) In Global.asax Answer: A) In RouteConfig.cs What is WebForms in ASP.NET? A) A framework for building web applications with a drag-and-drop interface B) A method for handling HTTP requests C) A service for managing authentication D) A tool for data binding Answer: A) A framework for building web applications with a drag-and-drop interface Which of the following is a key feature of ASP.NET Web API? A) Provides RESTful services for various clients B) Manages state between postbacks C) Handles session state D) Provides a design-time environment for building web forms Answer: A) Provides RESTful services for various clients What is Server.Transfer used for in ASP.NET Web Forms? A) To transfer processing from one page to another on the server B) To redirect the user to a different page C) To send data to a client D) To bind data to a control Answer: A) To transfer processing from one page to another on the server Which control in ASP.NET Web Forms allows for creating a templated user interface? A) Repeater B) GridView C) DataList D) ListBox Answer: A) Repeater How does ASP.NET handle asynchronous processing? A) Using async and await keywords B) Using BackgroundWorker C) Using ThreadPool D) Using TaskFactory Answer: A) Using async and await keywords What is Cache used for in ASP.NET? A) To store data that can be reused across requests B) To handle form submissions C) To manage user sessions D) To define routing rules Answer: A) To store data that can be reused across requests Which of the following methods is used to handle HTTP GET requests in ASP.NET MVC? A) HttpGet attribute B) HttpPost attribute C) HttpPut attribute D) HttpDelete attribute Answer: A) HttpGet attribute What does the HttpContext.Current property provide in ASP.NET Web Forms? A) Access to the current HTTP request and response B) Access to the current database connection C) Access to the current session state D) Access to the current view state Answer: A) Access to the current HTTP request and response How is Request.Form used in ASP.NET Web Forms? A) To access form data submitted by the client B) To manage routing C) To handle session state D) To render views Answer: A) To access form data submitted by the client What is the purpose of Web API in ASP.NET Framework? A) To build HTTP-based services that can be consumed by clients B) To manage authentication C) To handle HTTP requests and responses D) To define routing rules Answer: A) To build HTTP-based services that can be consumed by clients Which of the following is a key concept of ASP.NET MVC? A) Separation of concerns B) State management C) ViewState D) SessionState Answer: A) Separation of concerns What does the Web.config file in ASP.NET Web Forms contain? A) Configuration settings for the web application B) HTML markup for the web page C) Code-behind logic D) Data access methods Answer: A) Configuration settings for the web application Which control in ASP.NET Web Forms allows for editing and displaying data in a tabular format? A) GridView B) Label C) Button D) DropDownList Answer: A) GridView
All Copyrights Reserved 2025 Reserved by T4Tutorials