50+ ASP.NET Solved MCQs

1.

Which file you should write for the connection string so that you can access it in all the web pages for the same application?

A. In App_Data folder
B. In Web.config file
C. In MasterPage file
D. None of the above
Answer» B. In Web.config file
2.

You need to allow users to choose their own themes. In which page event will you write the user-selected theme?

A. Page_Load
B. Page_Render
C. Page_PreInit
D. Page_PreRender
Answer» C. Page_PreInit
3.

Which is the first event of the ASP.NET page, when the user requests a web page?

A. PreLoad
B. Load
C. PreInit
D. Init
Answer» C. PreInit
4.

What is the name of the Page object’s property that determines if a Web page is being requested without data being submitted to the server?

A. IsCallback
B. IsReusable
C. IsValid
D. IsPostBack
Answer» D. IsPostBack
5.

How will you specify the Cache Location?

A. You can use browser settings to specify where a page is cached.
B. You can use the Location attribute of the <%@ OutputCache %> directive to specify where a page is cached.
C. You can use the Location attribute in QueryString to specify where a page is cached.
D. None of the above.
Answer» B. You can use the Location attribute of the <%@ OutputCache %> directive to specify where a page is cached.
6.

Which of the following is not a member of ADODBCommand object?

A. ExecuteScalar
B. ExecuteStream
C. Open
D. ExecuteReader
Answer» C. Open
7.

__________________ is a special subfolder within the windows folder that stores the shared .NET component.

A. /bin
B. GAC
C. Root
D. Sub
Answer» B. GAC
8.

Which file contains settings for all .NET application types, such as Windows, Console, ClassLibrary, and Web applications?

A. Web.config
B. Machine.config
C. Global.asax
D. System .config
Answer» B. Machine.config
9.

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?

A. Single-file model
B. Code-behind model
C. Inline model
D. Client-server model
Answer» B. Code-behind model
10.

You want to make a configuration setting change that will affect only the current Web application. Which file will you change?

A. Global.asax
B. Web.config in the root of the Web application
C. Machine.config
D. System.config
Answer» B. Web.config in the root of the Web application
11.

Which of the following is not an ASP.NET page event?

A. Init
B. Load
C. Import
D. Message
Answer» C. Import
12.

To implement a specified .NET Framework interface which directive is used?

A. @Register
B. @Control
C. @Reference
D. @Implements
Answer» D. @Implements
13.

In ASP.NET application DLL files are stored in which folder?

A. App_Code
B. App_Data
C. Bin
D. App_LocalResources
Answer» C. Bin
14.

To create your application on a remote server which option you will choose in ASP.NET?

A. File System
B. FTP
C. HTTPS
D. TCP
Answer» B. FTP
15.

Which one of the following HTTP verbs indicates that you are creating and writing a file on the Web server?

A. POST
B. SET
C. GET
D. PUT
Answer» D. PUT
16.

What is the name of the Page object’s property that determines if a Web page is being requested without data being submitted to server?

A. IsCallback
B. IsReusable
C. IsValid
D. IsPostBack
Answer» D. IsPostBack
17.

If a user wants to create controls at runtime which event should be used to write code?

A. PreLoad
B. Load
C. Init
D. PreInit
Answer» D. PreInit
18.

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

A. System.Web.UI.Control
B. System.Web.UI
C. System.Control
D. All of the above
Answer» A. System.Web.UI.Control
19.

Which of the following are required to enable users to change the title of web part?

A. CatalogZone
B. TitleZone
C. EditorZone, AppearanceEditorPart
D. WebPart
Answer» C. EditorZone, AppearanceEditorPart
20.

What is Caspol?

A. Command line tool
B. Code access security policy tool
C. Case Tool
D. Command line tool & Code access security policy tool
Answer» D. Command line tool & Code access security policy tool
21.

What are the element of code access security?

A. Evidence,Permission
B. SQLSecurity
C. UserInterface
D. SQL Injection
Answer» A. Evidence,Permission
22.

What is the recommended method for securing sensitive connection string information?

A. Encrypting the data in the application configuration file
B. Using a code obfuscator
C. Using Integrated Security (Windows Authentication)
D. Querying the user for his or her credentials at run time
Answer» C. Using Integrated Security (Windows Authentication)
23.

Windows-Based Authentication is well suited for ___________ .

A. Intranet environment
B. Public web site
C. Desktop application
D. system
Answer» A. Intranet environment
24.

Which of the following control provides a link for unauthenticated users to log on?

A. Login
B. LoginView
C. LoginStatus
D. LoginName
Answer» C. LoginStatus
25.

Where do we include the user lists for Form authentication?

A. < credential>
B. < authorization>
C. < Identity>
D. < authentication>
Answer» A. < credential>
26.

How to implement authentication via web.config?

A. Include the authentication element.
B. Include the authorization element.
C. Include the identity element.
D. Include the deny element.
Answer» B. Include the authorization element.
27.

You use the ASP.NET Web Site Administration Tool to configure ASP.NET membership with forms authentication. What should you name your login form so that you do not have to modify the Web.config file?

A. Login.aspx
B. LoginPage.aspx
C. Default.aspx
D. Auth.aspx
Answer» A. Login.aspx
28.

Which of the following is the default authentication mode for IIS?

A. Anonymous
B. Windows
C. Basic Authentication
D. Data
Answer» A. Anonymous
29.

You need to programmatically configure page output caching. Which object would you use?

A. Request
B. Response
C. Application
D. Server
Answer» B. Response
30.

Which of these data source controls do not implement Caching?

A. LinqDataSource
B. ObjectDataSource
C. SqlDataSource
D. XmlDataSource
Answer» A. LinqDataSource
31.

Which object data is included in bookmarks and e-mailed URLs?

A. ViewState
B. cookies
C. Query strings
D. session
Answer» C. Query strings
32.

Which Session Mode Serialization is not required to store the data?

A. Off
B. InProc
C. StateServer
D. SQLServer
Answer» B. InProc
33.

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?

A. Session
B. Application
C. ViewState
D. cache
Answer» B. Application
34.

Which file is used to write the code to respond to the Application_Start event?

A. Any ASP.NET web page with an .aspx extension
B. Web.config
C. Global.asax
D. Web.UI
Answer» C. Global.asax
35.

When a User’s Session times out which event should you respond to?

A. Application_Start
B. Session_End
C. Session_Start
D. Application_End
Answer» B. Session_End
36.

Which Session Mode stores session Information in Current Application Domain?

A. InProc
B. StateServer
C. SQLServer
D. Off
Answer» A. InProc
37.

What are the client-side state management options that ASP.NET supports?

A. Application
B. Session
C. Querystring
D. schedule
Answer» C. Querystring
38.

What type of data can Cookies store?

A. String
B. DateTime
C. System.Int32
D. Data
Answer» A. String
39.

From the following which is not a valid state management object?

A. Querystate
B. Cookies
C. Application state
D. Hidden form fields
Answer» A. Querystate
40.

To kill a users session explicitly which of the following will you use?

A. Session.Close()
B. Session.End()
C. Session.Abondon()
D. Session.Discard()
Answer» C. Session.Abondon()
41.

What ASP.NET object encapsulates the state of the client and the browser?

A. Application Object
B. Session Object
C. Response Object
D. Request Object
Answer» B. Session Object
42.

Default Session data is stored in ASP.Net.

A. StateServer
B. Session Object
C. InProcess
D. Schedule object
Answer» B. Session Object
43.

If you are using the DataSet and you have to display the data in sorted order what will you do?

A. Use Sort method of DataTable
B. Use Sort method of DataSet
C. Use DataViev object with each sort
D. Use datapaging and sort the data.
Answer» C. Use DataViev object with each sort
44.

How do you determine the actual SQL data type of a SqlParameter (the type expected by the SQL Server)?

A. It is the .NET Framework data type in your application that the parameter represents.
B. It is the type of column or data in SQL Server that the command expects.
C. It is the type of column in a DataTablethat it represents.
D. It is any type defined in the SqlDbDataTypeenumeration.
Answer» B. It is the type of column or data in SQL Server that the command expects.
45.

What are the three primary kinds of parameters?

A. Input, Integer, String
B. Integer, String, DateTime
C. int, varchar, nvarchar
D. Input, Output, InputOutput
Answer» D. Input, Output, InputOutput
46.

Which SqlCommand execution returns the number of effected records in the table?

A. ExecuteNonQuery
B. ExecuteReader
C. ExecuteXmlReader
D. ExecuteScalar
Answer» A. ExecuteNonQuery
47.

Which CommandType value is incorrect?

A. StoredProcedure
B. TableDirect
C. TableSchema
D. Text
Answer» C. TableSchema
48.

Which data provider gives the maximum performance from a connection to SQL Server?

A. The OLE DB data provider.
B. The JDBC data provider.
C. The SqlClient data provider.
D. The Oracle data provider
Answer» C. The SqlClient data provider.
49.

In a SQL Statement while working with SqlCommand it returns a single value, at that time which method of Command Object will be used?

A. ExecuteNonQuery
B. ExecuteReader
C. ExecuteScalar
D. NonQuery
Answer» C. ExecuteScalar
50.

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?

A. ASPNET_WP.EXE
B. ASPNET_REGSQL.EXE
C. ASPNET_REGIIS.EXE
D. ASP.NET SYSTEM
Answer» C. ASPNET_REGIIS.EXE
51.

Which ADO.NET class provide Connected Environment?

A. DataReader
B. DataSet
C. Command
D. DataWriter
Answer» A. DataReader
52.

On what object would you set the properties to create a primary key for a DataTable?

A. DataRelation
B. DataColumn
C. DataSet
D. DataTable
Answer» C. DataSet
Tags
Question and answers in ASP.NET, ASP.NET multiple choice questions and answers, ASP.NET Important MCQs, Solved MCQs for ASP.NET, ASP.NET MCQs with answers PDF download