Olete.in
Articles
Mock Tests
🧪 ASP.Net MCQ Quiz Hub
ASP.Net Mcq Question Set 3
Choose a topic to test your knowledge and improve your ASP.Net skills
1. You are developing a Web page that contains many validated controls. You want to provide a detailed message for each validation error, but the page doesn’t have sufficient space to provide the detailed message next to each control. What can you do to indicate an error at the control and list the detailed error messages at the top of the Web page?
- Set the Text property of the validator control to the detailed message. - Set the ErrorMessage property to an asterisk (*). - Place a ValidationSummary control at the top of the Web page.
Set the ErrorMessage property of the validator control to the detailed message. - Set the Text property to an asterisk (*). - Place a ValidationSummary control at the top of the Web page.
Set the ToolTip property of the validator control to the detailed message. - Set the ErrorMessage property to an asterisk (*). - Place a ValidationSummary control at the top of the Web page.
None of the above
2. A Master Page contains a ScriptManager control and a user wants the AJAX functionality on content page then which control is necessary on content page?
AsyncPostBackTrigger
ScriptManager
ScriptManagerProxy
None of the above.
3. You are writing a page that contains an UpdatePanel for partial-page updates. You want that user should get the message “Processing is going on, please wait.” that the update is processing only if the update takes longer than 5 seconds. Which actions should you take?
Add a ProgressBar control to the page. Set the Interval property to 5000. Set the text property as “Processing is going on, please wait.”
Add a Timer control to the page. Set the Interval property to 5000. Set its text property to Processing is going on, please wait.”
Add an UpdateProgress control to the UpdatePanel. Set its DisplayAfter property to 5000. Set its ProgressTemplate contents to read “Processing is going on, please wait.”
None of the above.
4. What are the basic steps to reference master page properties from a content page?
Create a property in the master page code-behind file. - Reference the master page property from the content page using the syntax Master.<Property_Name>
Create a property in the master page code-behind file. - Add the @ MasterType declaration to the .aspx content page. - Reference the master page property from the content page using the syntax Master.
Create a property in the master page code-behind file. - Reference the master page property from the content page using the syntax Master.<Property_Name>
none of the above
5. Which ADO.NET class provide Connected Environment?
DataReader
DataSet
Command
none of the above
6. Match the following List 1 to List 2 a. App_Code ------------------------ i. Assembly Resource Files (.resx) b. App_Data ------------------------ ii. .skin file, CSS files c. App_Themes -------------------- iii. .mdf file, .mdb file d. App_GlobalResources --------- iv. .wsdl files, typed datasets
a-iv, b-iii, c-ii, d-i
a-ii, b-iv, c-i, d-iii
a-ii, b-i, c-iii, d-iv
a-ii, b-iv, c-iii, d-i
7. In ASP.NET application DLL files are stored in which folder?
App_Code
App_Data
Bin
App_LocalResources
8. What types of data can you store in the Cache collection?
Only String Type of Data
You can store any type of data in the Cache collection.
Only DataSet Object
All of the above.
9. How many types of parameter supported by OutputCache?
VaryByParam
VaryByControl
VaryByHeader
All of the above
10. You want to secure the connection strings contained within your Web.config file to ensure that no one can open the file easily and see the connection information. Which tool must you use to encrypt the connection strings?
ASPNET_WP.EXE
ASPNET_REGSQL.EXE
ASPNET_REGIIS.EXE
None of the above.
11. What are the three primary kinds of parameters are used while working with the Stored Procedure in ASP.NET?
Input, Integer, String
int, varchar, nvarchar
Input, Output, InputOutput
All of the above.
12. How do you execute multiple SQL statements using a DataReader?
Call the ExecuteReader method of a single Command object twice.
Set the Command.CommandText property to multiple SQL statements delimited by a semicolon.
Set the Command.CommandType property to multiple result sets.
None of the above.
13. When a User’s Session times out which event should you respond to?
Application_Start
Session_End
Session_Start
Application_End
14. Which of the following Web.config files correctly enables the Web application to track the LastVisit of anonymous users in a variable of type DateTime?
<anonymousIdentification enabled="true"/> <profile> <properties> <add name="LastVisit" type="System.DateTime" allowAnonymous="true" /> </properties> </profile>
<anonymousIdentification enabled="true"/> <profile> <properties> <add name=" LastVisit " allowAnonymous="true" /> </properties> </profile
<anonymousIdentification enabled="true" /> <profile> < properties> < add name=" LastVisit " type="System. DateTime " /> </properties> </p
<profile> <properties> <add name="LastVisit" type="System. DateTime "/> </properties> </profile>
15. 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 implement this solution on a single Web page?
ImageMap
Panel
Wizard
None of the above.
16. Match the following List 1 (Controls) to List 2. a. Image ------------------------- i. Navigate, PostBack, Inactive HotSpotMode b. ImageButton ---------------- ii. Container control c. ImageMap ------------------- iii. Has command event d. MultiView ------------------- iv. Does not have click event
a-iv, b-iii, c-i, d-ii
a-ii, b-iv, c-i, d-iii
a-ii, b-i, c-iii, d-iv
a-iv, b-iii, c-i, d-ii
17. What are the steps to create a DataTable programmatically?
Instantiate a new DataTable and add DataColumn objects to the DataTable. Columns Collection.
Run the Data Source Configuration Wizard.
Instantiate a new DataSet object.
None of the above.
18. The three statements are given below about DataSet and DataReader, choose the correct option according to the statement. Statement 1: DataSet Provides Disconnected environment but DataReader provides Connected environment. Statement 2: DataSet Provides Connected environment but DataReader provides Disconnected environment. Statement 3: DataSet Can store multiple table simultaneously but DataReader Supports a single table based on a single SQL query.
Only Statement 1 is correct.
Statement 1 and 2 is correct.
Statement 2 and 3 is correct.
Statement 1 and 3 is correct.
19. The following group profile properties defined under a group name in Web.config file. How will you access Street and City property? <properties> <group name="Address"> <add name="Street" /> <add name="City" /> </group> </properties>
Profile.name.Street - Profile.name.City
Profile.Address.Street - Profile.Address.City
Address.Street - Address.City
None of the above.
20. The UpdatePanel supports two types of triggers: AsyncPostBackTrigger and PostBackTrigger. Choose the correct option regarding working of these triggers.
AsyncPostBackTrigger causes an asynchronous (Ajax) postback.
PostBackTrigger causes a normal entire-page postback.
AsyncPostBackTrigger causes a normal entire-page postback.
Option A and B are correct.
21. To implement a specified .NET Framework interface which directive is used?
@Register
@Control
@Reference
@Implements
22. Which of the following is not an ASP.NET page event?
Init
Load
Import
None of the above.
23. How will you store and retrieve value in viewstate?
// Storing the data in viewstate ViewState[“SiteName”]=”CareerRide”; // Retrieving Value from a View State Label1.Text = ViewState[&quot;SiteName &quot;].ToString();
// Storing the data in viewstate ViewState obj=new ViewState ViewState [obj]=”CareerRide”; // Retrieving Value from a View State Label1.Text = ViewState[obj].ToString();
// Storing the data in viewstate ViewState=”CareerRide”; // Retrieving Value from a View State Label1.Text = ViewState.ToString();
None of the above.
24. Which file is used to write the code to respond to the Application_Start event?
Any ASP.NET web page with an .aspx extension
Web.config
Global.asax
None of the above.
25. What is the difference between a Local Transaction and a Distributed Transaction?
Local transactions are performed on a single database table, but distributed transactions are performed on more than one database tables.
Local transactions are performed on a single database server, but distributed transactions can be performed across multiple database servers.
Local transactions are performed on a database on the local machine, but distributed transactions are performed on a database on a remote machine.
None of the above.
26. Choose the correct option about DataReader object.
DataReader object is a forward-only object.
It provides connection oriented environment.
DataReader is read only object.
All of the above
27. How do you create a TextBox for retrieving a password from a user?
Set TextMode property of the TextBox control to Secret.
Set Mode property of the TextBox control to Password.
Set Text property of the TextBox control to Password.
Set TextMode property of the TextBox control to Password.
28. What is/are the advantages of StateServer session mode?
Its keeps the data separate from IIS so; if any Issue comes with IIS it will not hamper Session data.
It is useful in web farm and web garden scenarios.
Process is fast due to serialization and de-serialization.
A and B are the correct option.
29. What is/are the advantages of Session State?
It helps to maintain user data to all over the application and can store any kind of object.
Stores every client data separately.
Session is secure and transparent from user.
All of the above
30. Choose the correct option about DataSet object.
Provides Disconnected mode
Can store multiple table simultaneously
Consumer Object
All of the above.
31. You are a Web developer for CareerRide. The data is stored in a Microsoft SQL Server 2005 database on a server named CareerPC and the Database name is TestDB. You connect to TestDB by using Windows Integrated authentication. You use a SqlConnection object to connect to the database. You need to create a connection string to TestDB in the instance of SQL Server named CareerPC. Which string should you use?
“Data Source= CareerPC; Database=TestDB; Integrated Security=SSP1”.
“Data Source= CareerPC; Initial Catalog=TestDB; Integrated Security=SSP1”.
“Server= CareerPC; Database=TestDB; Integrated Security=SSP1”.
All of the above.
32. Match the following List 1 with List 2: a. Control ------------------ i. Controls the output caching policies of a page or user control. b. MasterType ------------ ii. Page directive uses with user controls. c. PreviousPageType ---- iii. Enables an ASP.NET page to work with a postback from another page in the application. d. OutputCache ----------- iv. Associates a class name to a page to get references or members contained within the specified master page.
a-ii, b-i, c-iv, d-iii
a-ii, b-iv, c-i, d-iii
a-ii, b-i, c-iii, d-iv
a-ii, b-iv, c-iii, d-i
33. ASP.NET Validation Control works at ____
Client side only.
Server side only.
Both Client Side and Server Side
None of the above.
34. Some control, by default, does not cause an automatic PostBack, i.e TextChanged event of TextBox. Which property will you set for automatic postback of these types of controls?
isPostBack=”false”
isPostBack=”true”
PostBack=”true”
AutoPostBack=”true”
35. What is the easiest way in Design view to create an event handler for the default event of a server control?
Open the code-behind page and write the code.
Right-click the control and select Create Handler.
Drag an event handler from the Toolbox to the desired control.
Double-click the control.
36. What are the types of Web Server Button Controls that can be created?
Only Submit buttons
Only Command buttons
Submit and command buttons
None of the above.
37. Clicking a CheckBox does not cause an automatic PostBack. How do you make the CheckBox cause an automatic PostBack?
Set the AutoPostBack property to true.
Add JavaScript code to call the ForcePostBack method.
Set the PostBackAll property of the Web Page to true.
none of the above
38. What happen in the Web Page when Init event occur?
ViewState is loaded on the page.
Each child control of the page is initialized to its design time values.
HTML is rendered.
none of the above
39. If you want that command object should returns XML data then which method of Command Object will be used?
getXMLData
getXML
ExecuteXMLReader
None of the above.
40. Match the following List 1 to List 2: a. UpdatePanel ------------------ i. If Master Page contains a ScriptManager then content page will use this control. b. UpdateProgress -------------- ii. ContentTemplate c. Timer -------------------------- iii. ProgressTemplate d. ScriptManagerProxy -------- iv. Tick Event
a - iii b - ii c - iv d - i
a - ii b - iii c - iv d - i
a - i b - ii c - iv d - iii
a - i b - ii c - iii d – iv
41. Windows-Based Authentication is well suited for ______
Intranet environment
Public web site
Desktop application
none of the above
42. What are the minimum attribute is required to create a connection string using SqlConnection object?
Data Source - Initial Catalog - Integrated security=true
Server - Database - Integrated security=true
Option A and B both are correct
None of the above
43. What datatype is returned when calling the ExecuteScalar method of a command object?
System.Int32
Object
No. of effected records
none of the above
44. Which programming model should you implement if you want to separate your server-side code from your client-side layout code in a Web page?
Single-file model
Code-behind model
Inline model
Client-server model
45. Which object in ASP.NET provides a global storage mechanism for state data that needs to be accessible to all pages in a given Web application?
Session
Application
ViewState
none of the above
46. Which Session Mode Serialization is not required to store the data?
Off
InProc
StateServer
SQLServer
47. You are a Web developer for CareerRide. The data is stored in a Microsoft SQL Server 2005 database on a server named CareerPC and the Database name is TestDB. There is one GridView control on the page that you want to fill with table name Employee. Suppose that SqlConnection object is conObj and SqlCommand Object object is cmdObj. Which important properties of command object you will initialize to achieve this task?
cmdObj.CommandType = Text; cmdObj.Connection = conObj; cmdObj.CommandText = &quot;select * from Employee&quot;;
cmdObj.CommandConnection = conObj; cmdObj.CommandText = &quot;select * from Employee&quot;;
cmdObj.CommandType = CommandType.Text; cmdObj.Connection = conObj; cmdObj.CommandText = &quot;select * from Employee&quot;;
None of the above.
48. How will you create the SQL Server Connection Objects in Code? Choose the correct option.
SqlConnection con = new SqlConnection (&quot;Data Source=ServerName; Initial Catalog=DatabaseName;Integrated Security=True&quot;);
SqlConnection con = new SqlConnection(); con.ConnectionString = (&quot;Data Source=ServerName; Initial Catalog=DatabaseName;Integrated Security=True&quot;);
using (SqlConnection con = new SqlConnection(&quot;Data Source=ServerName; Initial Catalog=DatabaseName;Integrated Security=True&quot;)) { con.Open(); - - - - - - - - - - - - }
All of the above codes are correct.
49. Choose the correct option about Master Page and Theme.
A Master Page enables you to share content across multiple pages in a website and A Theme enables you to control the appearance of the content.
Theme enables you to share content across multiple pages in a website and A Master Page enables you to control the appearance of the content.
App_Themes folder contains skin files.
Option A and C are correct.
50. When should you use HTML Server control rather than Web Server controls?
You are migrating existing, classic ASP pages over to ASP.NET pages.
The control needs to have custom client-side JavaScript attached to the control’s events.
The Web page has lots of client-side JavaScript that is referencing the control.
All of the above.
Submit