ASP.
NET MCQ
Topic: ASP.NET Fundamentals
ASP.NET is primarily used for developing:
A) Web applications
B) Desktop applications
C) Mobile applications
D) Cloud services
Which of the following is a core feature of ASP.NET?
A) State management
B) Machine learning
C) 3D rendering
D) Image processing
The lifecycle of an ASP.NET page begins with:
A) Page request
B) Page rendering
C) Event handling
D) Data binding
Which of the following is true about ASP.NET Web Forms?
A) They are event-driven
B) They don't support server-side controls
C) They require manual request handling
D) They don’t support data binding
Topic: Visual Studio and ASP.NET
The Visual Studio IDE provides which feature for ASP.NET development?
A) Drag-and-drop controls onto web pages
B) Compile only native Windows applications
C) Integrates with only third-party databases
D) Debugging mobile apps
In Visual Studio, ASP.NET applications are typically tested using:
A) IIS Express
B) Localhost without any server
C) Apache Server
D) Node.js runtime
Which of the following is a default ASP.NET project template in Visual Studio?
A) Web Application (MVC)
B) Console App (.NET Core)
C) Windows Forms App
D) Android App
Visual Studio supports integrating ASP.NET applications with version control using:
A) Git
B) FTP
C) SCP
D) Rsync
Topic: Events and Controls
An ASP.NET Button control triggers an event when:
A) The button is clicked
B) The page is rendered
C) Data is bound to a grid
D) The form is submitted automatically
ASP.NET events such as Page_Load are triggered:
A) When the page is requested
B) After a database query is executed
C) When the session ends
D) When the user logs out
Which ASP.NET control is used to display tabular data on a webpage?
A) GridView
B) DropDownList
C) CheckBoxList
D) RadioButtonList
Which event is typically used to bind data to controls during an ASP.NET page lifecycle?
A) Page_Load
B) Page_PreInit
C) Page_Unload
D) Session_Start
Topic: Validating Data
The RequiredFieldValidator control in ASP.NET ensures that:
A) The user does not skip a form field
B) The input follows a specific pattern
C) The value is numeric
D) The field is not over a certain length
Client-side validation in ASP.NET is performed:
A) In the user’s browser
B) On the server after submission
C) Only in the Page_Load event
D) On the database level
Which validator control ensures that the input is within a specific range?
A) RangeValidator
B) RegularExpressionValidator
C) CustomValidator
D) CompareValidator
The ValidationSummary control is used to:
A) Display a summary of validation errors
B) Provide default form values
C) Validate input using regex
D) Connect to the database
Topic: Data Binding
Data binding in ASP.NET refers to:
A) Automatically populating controls with data
B) Creating event handlers for controls
C) Binding controls to CSS styles
D) Automatically binding views to models
Which control is commonly used to bind a collection of data in ASP.NET?
A) Repeater
B) Label
C) TextBox
D) Button
To perform two-way data binding in ASP.NET, you typically use:
A) Bind()
B) Eval()
C) DataSource()
D) DataSet()
The GridView control in ASP.NET supports:
A) Automatic paging and sorting
B) Multi-threaded database queries
C) Server-side image rendering
D) Custom server-side events
Topic: Using Databases with ASP.NET
ADO.NET is used in ASP.NET to:
A) Access databases
B) Serve dynamic images
C) Validate form data
D) Handle CSS styling
To bind a SQL Server database to a GridView in ASP.NET, you typically use:
A) SqlDataSource
B) CustomValidator
C) RequiredFieldValidator
D) RangeValidator
The SqlConnection object in ASP.NET is used for:
A) Opening a connection to a SQL Server database
B) Retrieving images from the file system
C) Compiling the ASP.NET code
D) Sending emails
In ASP.NET, to execute a stored procedure, you use:
A) SqlCommand
B) DataList
C) DataAdapter
D) DataReader
Topic: ASP.NET Objects
The Application object in ASP.NET is used to:
A) Share data across all sessions and users
B) Store user-specific data
C) Log errors into a database
D) Manage HTML templates
The Session object in ASP.NET is used to:
A) Store user-specific data temporarily
B) Maintain global application data
C) Handle real-time events
D) Bind data to a grid
The Cache object in ASP.NET allows you to:
A) Store frequently used data temporarily for performance improvements
B) Manage page requests in a queue
C) Handle session state across multiple browsers
D) Bind static HTML pages to dynamic content
Which object is used to store data across multiple pages within an ASP.NET application?
A) ViewState
B) ButtonState
C) FormControl
D) DataSource
Topic: Distributing ASP.NET Applications
To distribute an ASP.NET application, you typically deploy it to:
A) IIS (Internet Information Services)
B) Apache Server
C) Tomcat Server
D) XAMPP
Which tool in Visual Studio helps deploy an ASP.NET application to the cloud?
A) Publish tool
B) Package Manager Console
C) Solution Explorer
D) Error List
Topic: Model View Controller (MVC)
In the MVC pattern, the View is responsible for:
A) Displaying the data to the user
B) Handling database operations
C) Routing requests
D) Managing session state
In ASP.NET MVC, the controller is responsible for:
A) Handling user input and updating the model
B) Defining how data is displayed
C) Performing validation of controls
D) Managing user sessions
Which of the following is an advantage of using ASP.NET MVC over Web Forms?
A) Clear separation of concerns
B) Built-in support for session state
C) Easier to implement server controls
D) Greater control over ViewState
In ASP.NET MVC, the model is typically responsible for:
A) Managing the business logic and data
B) Rendering the UI
C) Handling HTTP requests
D) Logging errors
Topic: Distributing ASP.NET Applications (Continued)
To deploy an ASP.NET MVC application to IIS, you need to ensure:
A) IIS is configured with the appropriate .NET runtime version
B) Apache server is installed
C) A custom deployment script is written
D) The database is embedded within the project