ASP.NET HTML and Web Server Control - ASP.NET (MCQ) questions and answers

Here, you can read ASP.NET HTML and Web Server Control multiple choice questions and answers with explanation.

1)   How will you add a TextBox control at runtime on the form? Choose the correct one.
- Published on 27 Jul 15

a. TextBox obj = new TextBox();
    obj.ID = "txtUserName";
    form1.Controls.Add(obj);
b. form1.Controls.Add(TextBox);
c. this.FindControl.add(TextBox);
d. None of the above.
Answer  Explanation 

ANSWER: TextBox obj = new TextBox();
    obj.ID = "txtUserName";
    form1.Controls.Add(obj);

Explanation:
No explanation is available for this question!


2)   If a user wants to create controls at runtime which event should be used to write code?
- Published on 27 Jul 15

a. PreLoad
b. Load
c. Init
d. PreInit
Answer  Explanation 

ANSWER: PreInit

Explanation:
No explanation is available for this question!


3)   Which attribute is necessary for HTML control to work as a HTML server control?
- Published on 24 Jul 15

a. runat=”server”
b. runat=”web-server”
c. ID=”server”
d. ID=”web-server”
Answer  Explanation 

ANSWER: runat=”server”

Explanation:
No explanation is available for this question!


4)   Which is the first event of ASP.NET page, when user requests a web page ?
- Published on 24 Jul 15

a. PreLoad
b. Load
c. Preinit
d. Init
Answer  Explanation 

ANSWER: Preinit

Explanation:
No explanation is available for this question!


5)   What is the fully qualified name of the base class of all server controls?

- Published on 24 Jul 15

a. System.Web.UI.Control
b. System.Web.UI
c. System.Control
d. All of the above
Answer  Explanation 

ANSWER: System.Web.UI.Control

Explanation:
No explanation is available for this question!


6)   Using which type of stylesheet we can change the style of an element in the entire website?
- Published on 16 Jun 15

a. Internal Stylesheet
b. External Stylesheet
c. Inline stylesheet
d. None of above
Answer  Explanation 

ANSWER: External Stylesheet

Explanation:
No explanation is available for this question!


7)   A web page has lots of input data, and you want the data input to be spread across multiple screens. What is the best control to use to implement this solution on a single Web page?
- Published on 16 Jun 15

a. ImageMap
b. Panel
c. Wizard
d. None of the above
Answer  Explanation 

ANSWER: Wizard

Explanation:
The Wizard control is used to divide a large form, which has the lots of data, into multiple sub-forms. The Wizard control contains one or more WizardStep child controls. Only one WizardStep is displayed at a time.


8)   What property do you modify on a server control to minimize the size of the ViewState data?
- Published on 16 Jun 15

a. ViewState=”true”
b. Set EnableViewState to false.
c. Set EnableViewState to true.
d. None of the above
Answer  Explanation 

ANSWER: Set EnableViewState to false.

Explanation:
In ASP.NET when a form is postback to server it reappears in the browser with all form values. ASP.NET page and controls maintain their state by in hidden form field named _ViewState. By default it is enable for all server controls and sometimes create problem because unnecessary data are stored in this field. To minimize the size of the ViewState data, set EnableViewState to false.


9)   If we want to add graphics using asp.net which of the following web control will you use?
- Published on 16 Jun 15

a. Link Button
b. AdRotator
c. Grid View
d. Layout
Answer  Explanation 

ANSWER: AdRotator

Explanation:
The AdRotator web server control cycles through a series of clickable ad banner and allows some ads to be weighted more heavily.


10)   Which validation control in ASP.NET can be used to determine if data that is entered into a TextBox control is of type Currency?
- Published on 16 Jun 15

a. ValidationSummary
b. CompareValidator
c. RequiredFieldValidator
d. None of the above.
Answer  Explanation 

ANSWER: CompareValidator

Explanation:
You can use the CompareValidator control to do a data type check. Set its operator property to DataTypeCheck and its Type property to Currency.


1 2