The following ASP.NET MCQs have been compiled by our experts through research, in order to test your knowledge of the subject of ASP.NET. We encourage you to answer these multiple-choice questions to assess your proficiency.
Please continue by scrolling down.

1: Where are private assemblies stored in ASP.NET?

A.   root directory of bootable drive

B.   windows directory

C.   application root directory

D.   application / bin directory

2: We can manage states in application using

A.   Session Objects

B.   Application Objects

C.   Viewstate

D.   (all of these)

3: Which of these forms is used in ASP.NET?

A.   Winforms

B.   Webforms

C.   HTMLForms

4: What is the extension of a web user control file?

A.   .Ascx

B.   .Asmx

C.   .Aspx

5: Which of the following is a property all the ASP.NET controls have?

A.   runat

B.   text

C.   name

D.   bgcolor

6: What is ASP.Net

A.   Programming Language

B.   Server Side Technology

7: Which method of the ServiceController class will allow you to send a command to the service?

A.   ExecuteCommand()

B.   Pause()

C.   Start()

D.   Stop()

8: Can you set which type of comparison you want to perform by the CompareValidator control?

A.   Yes

B.   No

9: Which version of ASP .NET MVC has built-in support for mobile targeting?

A.   MVC 4

B.   MVC 2

C.   MVC 3

D.   MVC 1

10: Which of the following ASP.NET directories stores class files (.cs) by default?

A.   Bin

B.   App_Code

C.   App_GlobalResources

D.   App_Data

11: Which HTML control property should be set to access control from code behind?

A.   Runat = "Server"

B.   ID = "TextBox2"

C.   ClientID = "TextBox1"

D.   RunatServer = "True"

12: Which attribute must be set on the validator control for the validator to work?

A.   validatecontrol

B.   ControlToValidate

C.   controltobind

D.   validate

13: Which of the following file types is associted with ASP.NET User controls?

A.   .ascx

B.   .aspx

C.   .asax

D.   .asmx

14: In Asp.Net Server.MapPath(".") points to which location

A.   it will not point to any location

B.   points to the location where your project stored

C.   there is no such function in

D.   points to C:\\My Documents\Microsoft Visual Studio folder

15: Which of the following controls is used to validate that two fields are equal?

A.   Equals() method

B.   RegularExpressionValidator

C.   CompareValidator

D.   Required Field Validator

16: In which event are the controls fully loaded?

A.   Page.Init()

B.   Page.Load()

C.   Page.OnLoad()

D.   Page.PreInit()

17: ASP.NET stores membership, role management, and profile information in which database?

A.   aspdotnetdatabaase

B.   aspnetdb

C.   aspdotnetdb

D.   netdb

18: Which of the following is not a .NET compatible language?


B.   Managed C++

C.   Java

D.   C#, J#


19: In ASP.Net, session is maintained using the methods:

A.   Only Session State Service

B.   (all of these)

C.   Only In-Process storage

D.   Only SQL Server

20: What is default timeout of session in

A.   20 ns

B.   20 min

C.   10ns

D.   10min

E.   1 hr

21: How do you enable impersonation in the web.config file?

A.   <identity impersonate = "true" />

B.   <setImpersonate = "true" />

C.   <impersonate = "true" />

D.   <identity setImpersonate = "true" />

22: Where is the ViewState information stored?

A.   in cookies

B.   in session variables

C.   in the HTML hidden fields.

D.   query string

E.   in database

23: The first method that is executed in the Page life cycle in ASP.NET is:

A.   Page.Load

B.   PreLoad

C.   Init

D.   PreInit

24: Can Web API be hosted in its own process without IIS?

A.   No

B.   Yes

25: Which of the following contains one or more variables that are accessed through sequential indices?

A.   Delegates

B.   Arrays

C.   Nullable Types

D.   Indexers

26: Which of the following statements best describes setting up an async page in .NET 4.5?

A.   async=true on page directive, RegisterAsyncTask in page load and async method

B.   async method

C.   TaskFactory.StartNew(method1)

D.   async=true on page directive

27: How do you make a controller action async?

A.   return an async Task from controller action while awaiting within the method

B.   return an async Task from controller action while awaiting within the method

C.   return an async Task from controller action

D.   Register async controller action in Global.asax

28: Can MVC, Web Forms and Web API be mixed in the same project?

A.   Only in .NET 4.5

B.   Only MVC and Web Forms, not Web API

C.   Yes

D.   No

29: How can an MVC View be protected from CSRF?

A.   not possible

B.   @Html.AntiForgeryToken() in View

C.   @Html.AntiForgeryToken() in View and ValidateAntiForgeryToken attribute on controller action

D.   Web.Config app setting AntiForgeryToken true

30: Which formats can Web API work with?

A.   XML

B.   All of these

C.   xVx

D.   ATOM Pub

31: True or False: It is true that lines are reference type?

A.   False

B.   True

32: What method(s) must be used with the Application object to ensure that only one process accesses a variable at a time?

A.   ThreadLock

B.   Synchronize()

C.   Lock() and UnLock()

33: The property used to access user's locale information is:

A.   System.Web.UI.Page.Culture

B.   System.Web.Locale

C.   System.Web.UI.Page.User

D.   System.Web.UI.Page.Locale

34: True or False: Without Web.config file application will not compile or Run.

A.   True

B.   False

35: _______ is a special subfolder within the windows folder that stores the shared .NET component?

A.   Root

B.   /bin

C.   GAC

36: In LINQ what is the difference in .Ancestor and .Parent?

A.   None of the above

B.   Parent is the immediate node a level above, Ancestors is all nodes all levels above.

C.   Parent is the immediate node a level above, Ancestors is all nodes above and below.

D.   Parent is the immediate node below, Ancestors is all nodes above and below.

37: You are developing ASP.NET templated server control. You need to ensure that a new ID namespace is created within the page control hierarchy when the control is added to the page. Which interface should you implement on the control?

A.   INamingContainer

B.   IExtenderCtonrol

C.   IDataKeysControl

D.   IDataItemContainer

38: Can you run a web application without the web.config file?

A.   Runtime error

B.   Yes

C.   It will not compile if there is no web.config file

D.   No

39: In the following example, is viewstate being set? (Test.aspx - viewstate enabled) (Test.aspx.cs) protected override void OnLoad(EventArgs args) { this.LabelTest.Text = “changed”; base.OnLoad(e); }

A.   Only in .NET 4+

B.   No

C.   Only if LabelTest.Text is changed in following events before PreRender

D.   Yes

40: Which one is the first step in Asp.Net MVC request cycle.

A.   Controller

B.   Mvc Handler

C.   Routing

D.   View Engine

E.   Action Execution

41: Where is the default Session data stored in ASP.Net?

A.   Session Object

B.   InProcess

C.   StateServer

42: Which two new properties are added in ASP.NET 4.0 Page class?

A.   Culture and Locale

B.   Keyword and Description

C.   MetaKeyword and MetaDescription

D.   Culture and Description

43: Contents of assembly file can be investigated using

A.   ILDASM.dll


C.   ILDASM.exe

D.   ILDASM.aspx

44: In which of the following SessionState Modes the Session_End event fires?

A.   SQL Server

B.   Inproc

C.   None

D.   StateServer

45: How can you disable client-side validation in ASP.NET?

A.   By setting the EnableClientScript property to false

B.   by setting CauseValidation to false

C.   By setting ValidateClientScript to false

D.   By setting EnableScripting to false

E.   By setting ValidateScripting to false

46: When would WCF be a better solution than Web API?

A.   Need for REST

B.   Need for XML

C.   Need for metadata

D.   Need for SOAP

47: which of the following is not ASP.NET directives?

A.   web

B.   page

C.   import

D.   register

48: What is the maximum number of cookies that can be allowed to a web site?

A.   20

B.   1

C.   more than 30

D.   10

49: I have a property in my code-behind get { return (Custom)Session["Custom"]; } set { Session["Custom"] = value; } and I receive a serialization error What are the possible solutions?

A.   Change sessionstate mode to InProc

B.   Change the property type to HashSet instead of Custom

C.   Add the Serializable attribute to Custom class

D.   All of these will work

50: Which property is used to retrieve a username in Windows Authentication?

A.   System.Environment.UserName

B.   System.UserName

C.   System.Environment.User

D.   System.Environment.GetUserName