Explore topic-wise MCQs in Computer Science.

This section includes 220 Mcqs, each offering curated multiple-choice questions to sharpen your Computer Science knowledge and support exam preparation. Choose a topic below to get started.

1.

Which of the following works on client side?

A. ViewState
B. HiddenField
C. ControlState
D. All of the above
Answer» E.
2.

Which of the following works on server side?

A. ViewState
B. HiddenField
C. Application and session
D. All of the above
Answer» D. All of the above
3.

Which of these data source controls do not implement Caching?

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

Which one of the following has a parameter called as “preserveForm”?

A. Server.transfer
B. Response.redirect
C. Both A & B
D. None of the above
Answer» B. Response.redirect
5.

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» E.
6.

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» C. Inline model
7.

Which property and method of the Page object do you use to register client script dynamically from code?

A. ScriptManager control is used to dynamically register client script from code.
B. The Page.ClientScript.RegisterClientScriptBlock is used to dynamically register client script from code.
C. ScriptManagerProxy control is used to dynamically register client script from code.
D. None of the above.
Answer» C. ScriptManagerProxy control is used to dynamically register client script from code.
8.

Which property will you set for each RadioButton Control in the group?

A. Specify the same GroupName for each RadioButton.
B. Specify the different GroupName for each RadioButton.
C. Specify the same GroupID for each RadioButton.
D. Specify the same ID for each RadioButton.
Answer» B. Specify the different GroupName for each RadioButton.
9.

Which protocol is used for requesting a web page in ASP.NET from the Web Server?

A. HTTP
B. TCP
C. SMTP
D. None of the above.
Answer» B. TCP
10.

Which query expression is used to limit the number of results?

A. Skip
B. Take
C. Where
D. Select
Answer» C. Where
11.

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

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

Which Session Mode stores session Information in Current Application Domain?

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

Which session modes stores session Information in Current Application Domain?

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

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

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

Which SqlCommand execution returns the value of the first column of the first row from a table?

A. ExecuteNonQuery
B. ExecuteReader
C. ExecuteXmlReader
D. ExecuteScalar
Answer» E.
16.

Which type of processing model does asp.net stimulate?

A. Static
B. Linear
C. Bottom­ up
D. Event­-driven
Answer» E.
17.

Which validation control in ASP.NET can be used to determine if data that is entered into a TextBox control is of type Currency?

A. ValidationSummary
B. CompareValidator
C. RequiredFieldValidator
D. None of the above.
Answer» C. RequiredFieldValidator
18.

Which validation control in ASP.NET can be used to determine if the data is entered into a TextBox control is of type Currency?

A. ValidationSummary
B. CompareValidator
C. RequiredFieldValidator
D. None of the above.
Answer» C. RequiredFieldValidator
19.

Why should you write the cleanup code in Finally block?

A. Compiler throws an error if you close the connection in try block.
B. Resource cannot be destroyed in catch block.
C. Finally blocks run whether or not exception occurs.
D. All of the above
Answer» D. All of the above
20.

Windows-Based Authentication is well suited for.

A. Intranet environment.
B. Public web site.
C. Desktop application.
D. None of the above.
Answer» B. Public web site.
21.

Windows-Based Authentication is well suited for ___________ .

A. Intranet environment
B. Public web site
C. Desktop application
D. None of the above
Answer» B. Public web site
22.

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?

A. “Data Source= CareerPC; Database=TestDB; Integrated Security=SSP1”.
B. “Data Source= CareerPC; Initial Catalog=TestDB; Integrated Security=SSP1”.
C. “Server= CareerPC; Database=TestDB; Integrated Security=SSP1”.
D. All of the above.
Answer» E.
23.

You are creating an ASP.NET application for company CareerRide. You use form based authentication to validate users. You need to prevent unauthenticated users from accessing the application. What should you do?

A. In the authorization section of the Web.config file, set the users attribute of the deny element to “?”
B. Set In the authorization section of the Web.config file, set the users attribute of the deny element to “*”
C. In the authorization section of the Machine.config file, set the users attribute to the allow element to “?”.
D. None of the above.
Answer» B. Set In the authorization section of the Web.config file, set the users attribute of the deny element to “*”
24.

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?

A. Add a ProgressBar control to the page. Set the Interval property to 5000. Set the text property as “Processing is going on, please wait.”
B. Add a Timer control to the page. Set the Interval property to 5000. Set its text property to Processing is going on, please wait.”
C. Add an UpdateProgress control to the UpdatePanel. Set its DisplayAfter property to 5000. Set its ProgressTemplate contents to read “Processing is go
D. None of the above.
Answer» D. None of the above.
25.

You have to log the data into database if your session times out. Which event you will use?

A. Session_End
B. Application_End
C. Application_Start
D. Application_SessionTimeout
Answer» B. Application_End
26.

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» D. Page_PreRender
27.

You need to identify a type that meets the following criteria: • Is always a number. • Is not greater than 65,535. Which type should you choose?

A. System.UInt16
B. int
C. System.String
D. System.IntPtr
Answer» B. int
28.

You need to initialize some variable only when the first user accesses the application. What should you do?

A. Add code to the Application_OnStart event handler in the Global.asax file.
B. Add code to the Application_BeginRequest event handler in the Global.asax
C. Add code to the Session_OnStart event handler in the Global.asax file
D. None of the above
Answer» B. Add code to the Application_BeginRequest event handler in the Global.asax
29.

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

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

You need to select a class that is optimized for key - based item retrieval from both small and large collections. Which class should you choose?

A. OrderedDictionary class
B. HybridDictionary class
C. ListDictionary class
D. Hashtable class
Answer» C. ListDictionary class
31.

You want to enable Page Output Caching in ASP.NET. What code you will write in ASPX page.

A. <%@ OutputCache Duration="30" VaryByParam="none" %>
B. <%@ OutputCache VaryByParam="none" %>
C. <%@ OutputCache Duration="30" %>
D. None of the above.
Answer» B. <%@ OutputCache VaryByParam="none" %>
32.

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» B. LoginPage.aspx
33.

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. All of the above
Answer» C. Machine.config
34.

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. None of the above.
Answer» D. None of the above.
35.

Which of the following statements are correct? 1. Indexers enable objects to be indexed in a similar manner to arrays. 2. The this keyword is used to define the indexers. 3. Indexers can be overloaded. 4. Indexer cannot be used in interface

A. 1, 2
B. 3
C. 1,2,3
D. None of the above
Answer» D. None of the above
36.

Which of the following statements about referencing master page methods and properties is true?

A. Content pages can reference controls in the master page.
B. Content pages can reference public properties in the master page.
C. Content pages can reference public methods in the master page.
D. All of the above.
Answer» E.
37.

Which of the following statement / s is / are true?

A. CommitChanges is a method of SqlDataContext.
B. CommitChanges is a method of DataContext.
C. CommitChanges is a method of DbDataContext.
D. CommitChanges is a method of OleDbData Context
Answer» C. CommitChanges is a method of DbDataContext.
38.

Which of the following objects represents a LINQ to SQL O / R map?

A. DataSet
B. XElement
C. ObjectContext
D. DataContext
Answer» E.
39.

Which of the following is true when referencing master page from content page?

A. Content pages can reference private indexer in the master page.
B. Content pages can reference private Properties in the master page.
C. Contentpages can reference public Properties in the master page.
D. Content pages can reference private Methods in the master page.
Answer» D. Content pages can reference private Methods in the master page.
40.

Which of the following is true ? 1. AJAX is a platform-independent technology 2. AJAX can work with web application 3. AJAX can only work with ASP.NET 4. AJAX is a platform-dependent technology

A. 1, 2
B. 1,2,3
C. 1,3,4
D. None of the above
Answer» B. 1,2,3
41.

Which of the following is the way to monitor the web application?

A. MMC Event viewers
B. Performance logs
C. Alerts Snap-ins
D. ALL
Answer» E.
42.

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

A. Anonymous
B. Windows
C. Basic Authentication
D. None
Answer» B. Windows
43.

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

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

Which of the following is dictionary object?

A. HashTable
B. SortedList
C. NameValueCollection
D. All of the above
Answer» E.
45.

Which of the following is a valid skin code inside a skin file?

A. < asp:TextBox BackColor=”Yellow” BorderStyle=”Dotted” ID=”colorTxt” Runat=”Server”/>
B. < asp:TextBox BackColor=”Yellow” BorderStyle=”Dotted” Runat=”Server” />
C. < asp:TextBox BackColor=”Yellow” BorderStyle=”Dotted” ID=”colorTxt” />
D. None of the above.
Answer» C. < asp:TextBox BackColor=”Yellow” BorderStyle=”Dotted” ID=”colorTxt” />
46.

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

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

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» D. WebPart
48.

Which of the following are reference types?

A. String
B. Exception
C. Class
D. All of the above
Answer» E.
49.

Which of the following are correct? 1. An interface can be instantiated directly. 2. Interfaces can contain constructor. 3. Interfaces contain no implementation of methods. 4. Classes and structs can implement more than one interface. 5. An interface itself can inherit from multiple interfaces.

A. 3,4,5
B. 1,2,3
C. 2,3,4
D. All of the above
Answer» B. 1,2,3
50.

Which of the following are correct? 1. Delegates are like C++ function pointers. 2. Delegates allow methods to be passed as parameters. 3. Delegates can be used to define callback methods. 4. Delegates are not type safe.

A. 1,3,4
B. 1,2,3
C. 2,3,4
D. All of the above
Answer» C. 2,3,4