Server-side controls MCQs ASP.NET (e.g., TextBox, Button, DropDownList)

What is the purpose of the TextBox control in ASP.NET? A) To allow users to input text B) To display a list of options C) To submit forms D) To handle navigation Answer: A) To allow users to input text Which property of the TextBox control specifies the maximum number of characters that can be entered? A) MaxLength B) Length C) Size D) Text Answer: A) MaxLength What does the Button control’s Text property represent? A) The label displayed on the button B) The action performed on click C) The visibility of the button D) The alignment of the button Answer: A) The label displayed on the button How can you handle a button click event in ASP.NET? A) By using the Click event handler B) By setting the OnClick property C) By using JavaScript D) By configuring the Command property Answer: A) By using the Click event handler What control would you use to display a drop-down list of options? A) DropDownList B) ListBox C) CheckBoxList D) RadioButtonList Answer: A) DropDownList Which property of the DropDownList control specifies the list of items to display? A) Items B) List C) DataSource D) SelectedValue Answer: A) Items How do you retrieve the selected value from a DropDownList control? A) By accessing the SelectedValue property B) By using the SelectedItem property C) By calling the GetSelected() method D) By accessing the Text property Answer: A) By accessing the SelectedValue property What is the purpose of the CheckBox control? A) To allow users to select or deselect an option B) To display a list of items C) To submit forms D) To create navigation menus Answer: A) To allow users to select or deselect an option Which property of the CheckBox control indicates whether it is selected or not? A) Checked B) Selected C) Value D) Status Answer: A) Checked What is the primary use of the RadioButton control? A) To allow users to select a single option from a group B) To provide a list of options C) To handle form submissions D) To display multiple items Answer: A) To allow users to select a single option from a group How do you group RadioButton controls together? A) By placing them within the same container control B) By setting the same GroupName property C) By using the Checked property D) By setting the Selected property Answer: A) By placing them within the same container control What control is used to display a single line of text that cannot be edited by the user? A) Label B) TextBox C) DropDownList D) Literal Answer: A) Label What is the purpose of the Literal control in ASP.NET? A) To display static text or HTML without server-side processing B) To allow user input C) To create a list of options D) To handle form submissions Answer: A) To display static text or HTML without server-side processing Which property of the TextBox control is used to set or get its value? A) Text B) Value C) Content D) Input Answer: A) Text How do you enable or disable a Button control? A) By setting the Enabled property B) By setting the Visible property C) By setting the ReadOnly property D) By changing the Text property Answer: A) By setting the Enabled property What is the function of the TextBox control’s ReadOnly property? A) To make the control’s text uneditable B) To disable the control C) To hide the control D) To make the text unselectable Answer: A) To make the control’s text uneditable Which property of the DropDownList control returns the text of the selected item? A) SelectedItem.Text B) SelectedValue C) Text D) SelectedText Answer: A) SelectedItem.Text What control would you use to create a multi-line text input? A) TextBox with TextMode="MultiLine" B) Label C) DropDownList D) CheckBox **Answer: A) TextBox with TextMode="MultiLine" How do you add items to a ListBox control? A) By adding items to the Items collection B) By setting the DataSource property C) By modifying the Text property D) By using AddItem() method Answer: A) By adding items to the Items collection What is the purpose of the RequiredFieldValidator control? A) To ensure that a control is not left empty B) To compare values between two controls C) To validate data ranges D) To ensure data matches a regular expression Answer: A) To ensure that a control is not left empty Which control is used to create a calendar in ASP.NET Web Forms? A) Calendar B) DatePicker C) DateTimePicker D) DateSelector Answer: A) Calendar How can you retrieve the text entered in a TextBox control? A) By accessing the Text property B) By using the Value property C) By calling the GetText() method D) By accessing the Content property Answer: A) By accessing the Text property What does the AutoPostBack property do in a DropDownList control? A) It causes the page to post back to the server when the selected item changes B) It automatically updates the control’s text C) It prevents the control from posting back D) It updates the control’s data source Answer: A) It causes the page to post back to the server when the selected item changes How can you set the initial selected item in a DropDownList control? A) By setting the SelectedIndex or SelectedValue property B) By modifying the Text property C) By using the DefaultValue property D) By setting the DataSource property Answer: A) By setting the SelectedIndex or SelectedValue property What is the purpose of the TextMode property in the TextBox control? A) To specify the type of text input (single line, multi-line, password) B) To set the default text value C) To specify the text alignment D) To set the maximum length of input Answer: A) To specify the type of text input (single line, multi-line, password) Which property of the Button control specifies the command to be executed when the button is clicked? A) CommandName B) CommandArgument C) OnClick D) Text Answer: C) OnClick What control is best for displaying a list of items from which users can select multiple items? A) ListBox with SelectionMode="Multiple" B) DropDownList C) RadioButtonList D) CheckBoxList **Answer: A) ListBox with SelectionMode="Multiple" Which property of the Label control specifies the text to be displayed? A) Text B) Content C) Value D) DisplayText Answer: A) Text How does the CheckBoxList control differ from the ListBox control? A) It allows multiple selections and displays checkboxes instead of a list B) It displays items in a tabular format C) It handles single selection D) It allows users to input text Answer: A) It allows multiple selections and displays checkboxes instead of a list Which control provides a simple way to navigate through pages in a Web Forms application? A) HyperLink B) Button C) DropDownList D) Label Answer: A) HyperLink What is the function of the ImageButton control? A) To create a clickable image that can perform an action B) To display a static image C) To handle form submissions D) To display a list of images Answer: A) To create a clickable image that can perform an action How can you create a multi-step form process in ASP.NET Web Forms? A) By using the Wizard control B) By using the Panel control C) By using the MultiView control D) By using ListBox and Button controls Answer: A) By using the Wizard control Which property of the RadioButtonList control specifies the list of radio buttons? A) Items B) DataSource C) SelectedIndex D) Text Answer: A) Items What is the purpose of the RequiredFieldValidator control? A) To ensure a control is not left empty B) To validate the format of the input C) To compare the input value with another value D) To specify minimum and maximum values Answer: A) To ensure a control is not left empty Which control can be used to display a list of items with options to select multiple items? A) CheckBoxList B) RadioButtonList C) DropDownList D) ListBox Answer: A) CheckBoxList What does the AutoPostBack property do in the CheckBox control? A) It causes the page to post back to the server when the checkbox is checked or unchecked B) It updates the checkbox label C) It manages the checkbox state D) It prevents the checkbox from posting back Answer: A) It causes the page to post back to the server when the checkbox is checked or unchecked How can you set the default value for a DropDownList control? A) By setting the SelectedIndex or SelectedValue property B) By modifying the Text property C) By configuring the DataSource D) By adding a default item to the Items collection Answer: A) By setting the SelectedIndex or SelectedValue property What is the function of the ValidationSummary control? A) To display a summary of validation errors on the page B) To validate user input C) To manage control visibility D) To display user input Answer: A) To display a summary of validation errors on the page Which property of the Calendar control specifies the date to be initially displayed? A) SelectedDate B) DisplayDate C) DefaultDate D) CurrentDate Answer: A) SelectedDate What does the CommandArgument property of a Button control do? A) It provides additional information that is passed to the event handler B) It specifies the button’s label C) It determines the button’s visibility D) It handles the button’s click event Answer: A) It provides additional information that is passed to the event handler How can you make a TextBox control only accept numeric input? A) By setting the TextMode property to Number B) By using JavaScript validation C) By configuring the MaxLength property D) By using a RegularExpressionValidator control Answer: D) By using a RegularExpressionValidator control Which control allows you to create a data-bound list of items with a single selectable option? A) DropDownList B) ListBox C) CheckBoxList D) RadioButtonList Answer: A) DropDownList What does the SelectedIndex property of a ListBox control represent? A) The index of the currently selected item B) The number of items in the list C) The text of the selected item D) The value of the selected item Answer: A) The index of the currently selected item How can you validate that a TextBox control contains a valid email address? A) By using a RegularExpressionValidator control with an email pattern B) By using the TextMode property set to Email C) By setting the MaxLength property D) By using client-side validation with JavaScript Answer: A) By using a RegularExpressionValidator control with an email pattern What is the purpose of the HyperLink control? A) To navigate to a different page or URL B) To submit forms C) To display static text D) To handle server-side events Answer: A) To navigate to a different page or URL Which property of the Button control specifies the action to perform when clicked? A) OnClick B) CommandName C) Text D) CommandArgument Answer: A) OnClick What does the MultiView control do? A) It allows the display of different views on a single page, similar to tabs B) It creates a list of items C) It handles form submissions D) It validates user input Answer: A) It allows the display of different views on a single page, similar to tabs Which property of the TextBox control is used to set the input type as a password? A) TextMode B) MaxLength C) ReadOnly D) Text Answer: A) TextMode What does the Panel control do in ASP.NET Web Forms? A) It groups and organizes other controls on a page B) It handles form submissions C) It displays a list of items D) It manages validation Answer: A) It groups and organizes other controls on a page Which property of the RadioButtonList control determines which radio button is selected? A) SelectedIndex B) SelectedItem C) SelectedValue D) Value Answer: A) SelectedIndex
All Copyrights Reserved 2025 Reserved by T4Tutorials