ASP.NET Introduction - ASP.NET (MCQ) questions and answers
Here, you can read ASP.NET Introduction multiple choice questions and answers with explanation.
1) ByDefault ASP.Net SessionID is stored in _________. - Published on 19 Oct 15
a. Application
b. Session
c. Cookies
d. ViewState
Answer
Explanation
|
ANSWER: Cookies
Explanation: ByDefault ASP.Net SessionID is stored in cookies. SessionID enables you to retrieve the unique session identifier of a particular user. By default, Session state depends on cookies. SessionID is stored in a cookie named ASP.NET_SessionId to identity a user. If a user disables cookies in the browser, then Session state doesn’t work. The ASP.NET_SessionId cookie is used to associate the correct data with the correct user.
|
|
2) A web application can contain _______ . - Published on 19 Oct 15
a. Only One Web.Config File
b. Only Two Web.Config File
c. more than one Web.config file
d. No file.
Answer
Explanation
|
ANSWER: more than one Web.config file
Explanation: A web application can contain more than one Web.config file. When you create a web application, visual studio provide a default Web.config file in the root for you. For using more than one Web.config file, first you have to add a folder than you can add new Web.config file in this sub folder. There can be one web.config file in every sub folder of the application.
|
|
3) If you want to access a web service method, which attribute it must have? - Published on 19 Oct 15
a. [WebMethod]
b. [PageMetod]
c. [Web.Service]
d. [WebSupport]
Answer
Explanation
|
ANSWER: [WebMethod]
Explanation: A web service is a web-based functionality that is used by other web application. WebMethod attribute is used with methods within an XML Web service. This attribute makes the method callable from remote Web clients.
Example: [WebMethod()]
public int Add(int a, int b) { return (a + b); }
|
|
4) What is the file extension of web service in ASP.NET? - Published on 19 Oct 15
a. .ascx
b. .asmx
c. .aspx
d. .docx
Answer
Explanation
|
ANSWER: .asmx
Explanation: .asmx is the file extension of web service in ASP.NET
|
|
5) What component do you need to enable for a user to add new web parts? - Published on 19 Oct 15
a. WebpartZone
b. CatalogZone
c. WebPartManager
d. WebManager
Answer
Explanation
|
ANSWER: CatalogZone
Explanation: CatalogZone control is required to add new web parts. This control is works like a container for other controls. CatalogPart control can be added on CatalogZone only.
|
|
6) If you are using Webparts in your web page then which control is necessary? - Published on 19 Oct 15
a. WebpartController
b. WebPartmanager
c. WebpartZone
d. None of the above
Answer
Explanation
|
ANSWER: WebPartmanager
Explanation: WebPartmanager control is necessary for using webparts in ASP.NET. This control will manage different webpart in web page. When you run the application you will not see any WebPartmanager control because it is a non - visual control. It is most important control while using weparts. It provides the functionality for adding, deleting, and closing WebPart controls on a page.
|
|
7) Which of the following is true when referencing master page from content page? - Published on 19 Oct 15
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
Explanation
|
ANSWER: Contentpages can reference public Properties in the master page.
Explanation: You can access the Properties and Controls of Master Pages from content pages. You can set value inside the master page and then make it available to content pages as a property of the master page.
|
|
8) You have to log the data into database if your session times out. Which event you will use? - Published on 19 Oct 15
a. Session_End
b. Application_End
c. Application_Start
d. Application_SessionTimeout
Answer
Explanation
|
ANSWER: Session_End
Explanation: The Session_End Event is fired whenever a single user Session ends or times out. By using timeout property of session state you can control the session expire time. A session expires when the time specified by the Timeout property passes without a request came from the user.
|
|
9) Application_Start event is available in which file? - Published on 19 Oct 15
a. Global.asax
b. Local.asax
c. Web.config
d. None of the above
Answer
Explanation
|
ANSWER: Global.asax
Explanation: Application_Start event is available in Global.asax file. Application_Start event runs only ones when the application started. It is used to serve application-level and session-level events. The following are some of the important events in the Global.asax file. • Application_Start • Session_Start • Application_BeginRequest • Application_EndRequest • Application_Error • Session_End • Application_End
|
|
10) Which of the following works on server side? - Published on 19 Oct 15
a. ViewState
b. HiddenField
c. Application and session
d. All of the above
Answer
Explanation
|
ANSWER: Application and session
Explanation: Application and session objects works on the server side and more secure than client side objects.
• Application State: This object stores the data that is accessible to all pages in a given Web application. • Session State: Session object store user - specific data between individual requests. This object is same as application object but it stores the data about particular user.
|
|