ASP.
NET Multiple Choice Questions
1. Which of the following is the parent class of all web controls in ASP.NET?
A. System.Web.UI.Page
B. System.Web.UI.Control
C. System.Web.UI.WebControls.WebControl
D. System.Web.UI.UserControl
Answer: B. System.Web.UI.Control
2. What is ViewState used for in ASP.NET?
A. Storing data in session
B. Storing data in application
C. Maintaining state between postbacks
D. Storing cookies
Answer: C. Maintaining state between postbacks
3. Which file contains the Application_Start event in ASP.NET Web Forms?
A. Default.aspx
B. Web.config
C. Global.asax
D. Startup.cs
Answer: C. Global.asax
4. Which method is used to write directly to the HTTP output stream in ASP.NET?
A. Response.Redirect()
B. Response.Write()
C. Server.Transfer()
D. Server.Execute()
Answer: B. Response.Write()
5. What is the default authentication mode in ASP.NET?
A. Windows
B. Forms
C. Passport
D. None
Answer: A. Windows
6. Which of the following is true about Web.config file?
A. It is used to configure settings at the machine level.
B. There can be only one Web.config file per application.
C. It is used to configure application-specific settings.
D. It is only required in MVC applications.
Answer: C. It is used to configure application-specific settings
7. What is the purpose of the IsPostBack property in ASP.NET?
A. To check if the page is posting data to the database
B. To check if the page is loaded for the first time or in response to a client postback
C. To prevent the page from loading
D. To handle exceptions
Answer: B. To check if the page is loaded for the first time or in
response to a client postback
8. Which control is used to display data in a tabular format in ASP.NET?
A. GridView
B. DataList
C. DetailsView
D. ListBox
Answer: A. GridView
9. What is the purpose of the Server.Transfer() method?
A. Transfers execution to another page on the client side
B. Transfers execution to another page on the server without changing the URL
C. Redirects to a new site
D. None of the above
Answer: B. Transfers execution to another page on the server
without changing the URL
10. Which directive is used to bind a code-behind file with an .aspx page?
A. @Control
B. @Page
C. @Import
D. @Register
Answer: B. @Page