Wednesday, December 16, 2015

ASP.NET test answers of 2016.

Find Complete and recently updated Correct Question and answers of ASP.NET. All Answers updated regularly with new questions. Upwork ASP.NET test answers of 2016.



Question:* Which file is used to configure an asp.net website?

Answer: • web.config

Question:* Contents of assembly file can be investigated using

Answer: • ILDASM.exe

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

Answer: • (all of these)

Question:* What is/are the methods to author pages in ASP.NET?

Answer: • Both In-Line Code and Code Behind

Question:* What’s the difference between Response.Write() andResponse.Output.Write()?

Answer: • Response.Output.Write() allows you to write formatted output

Question:* What class does the ASP.NET web form class inherit from by default?

Answer: • System.Web. UI.Page

Question:* What is the different between int.Parse() and Convert.ToInt32()

Answer: • int.Parse() take only string() but Convert.ToInt32() take any object

Question:* Which formats can Web API work with?

Answer: • XML

Question:* In which event are the controls fully loaded?

Answer: • Page.Load()

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

Answer: • ExecuteCommand()

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

Answer: • .ascx

Question:* The logical and physical boundary created around every .NET application is known as:

Answer: • Application Domain

Question:* When an .aspx page is requested from the web server, the out put will be rendered to browser in following format.

Answer: • HTML

Question:* How to identify a postback

Answer: • use IsPostback

Question:* The Asp.net server control, which provides an alternative way of displaying text on web page, is

Answer: • < asp:label >

Question:* Can you write serverside code inside aspx page

Answer: • Yes use the <% %>

Question:* What is used to validate complex string patterns? i.e email

Answer: • Regular Expressions

Question:* The property of the Page class used to determine if the page has posted back is:

Answer: • IsPostBack

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

Answer: • Yes

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

Answer: • runat

Question:* Give One word: Common type system is built into which of the following

Answer: • CLR

Question:* What is ASP.Net

Answer: • Server Side Technology

Question:* Which is the parent class of Web server control?

Answer: • System.Web.Ul.Control

Question:* How can I show the entire validation error message in a message box on the client side?

Answer: • In the ValidationSummary control set property called “ShowMessageBox” to true.

Question:* Which of the following denote the web control associated with Table control function of ASP.NET?

Answer: • TableRow

Question:* What is the syntax to inherit from a class in C#?

Answer: • Place a colon and then the name of the base class.

Question:* ASP.NET separates the HTML output from program logic using a feature named as

Answer: • Code-behind

Question:* The number of forms that can be added to a aspx page is.

Answer: • 1

Question:* What must be done before you can consume a web service?

Answer: • Build a proxy library by using the wsdl.exe utility

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

Answer: • ControlToValidate

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

Answer: • points to the location where your project stored

Question:* What is the difference in Application State and View State?

Answer: • Application State is stored on the server while ViewState is stored on the client machine.

Question:* We can manage states in asp.net application using

Answer: • (all of these)

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

Answer: • CompareValidator

Question:* Where are private assemblies stored in ASP.NET?

Answer: • application / bin directory

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

Answer: • Runat = "Server"

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

Answer: • .Ascx

Question:* What’s the difference between localization and globalization?

Answer: • Localization is from the client perspective while globalization is from the server perspective

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

Answer: • MVC 4

Question:* What is the name of the property to get client side id for a control at run time?

Answer: • ClientID

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

Answer: • App_Code

Question:* What is the different between int.Parse() and Convert.ToInt32()

Answer: • int.Parse take only string() but Convert.ToInt32() take [object]

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

Answer: • Java

Question:* Which of the following is a navigation control:

Answer: • Menu

Question:* Page 1 has this link: <a href="page2.asp?color=green">Go</a> How can page2.asp get the "color" parameter?

Answer: • Request.QueryString("color")

Question:* What is default timeout of session in asp.net?

Answer: • 20 min

Question:* The feature in ASP.NET 2.0 that is used to fire a normal postback to a different page in the application is called

Answer: • Cross Page Posting

Question:* Which of the following is/are applicable while using Server Socket Level communications?

Answer: • All of these choices

Question:* ASP server scripts are surrounded by delimiters, which?

Answer: • <%...%>

Question:* .NET remote server object must implement?

Answer: • ISerializable

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

Answer: • aspnetdb

Question:* Which method do you use to kill explicitly a users session?

Answer: • Session.Abandon() method

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

Answer: • <identity impersonate = "true" />

Question:* Why should you close all database objects and set them to NULL before leaving the method where the objects were created?

Answer: • To ensure that the connection to the database is closed as soon as possible

Question:* How ASP.Net Different from classic ASP?

Answer: • Scripting is separated from the HTML, Code is compiled as a DLL, the DLLs can be executed on server

Question:* To load an assembly dynamically, the method used is:

Answer: • Assembly.Load()

Question:* What is the default scripting language in ASP?

Answer: • VBScript

Question:* How do you disable client side script in validators?

Answer: • Set EnableClientScript property to false.

Question:* How do you get info from a form that is submitted using the post method?

Answer: • Request.Form

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

Answer: • PreInit

Question:* Can ASP.NET run on a linux server?

Answer: • Yes, via the Mono project

Question:* The property used to support Cross Page Scripting in ASP.NET is:

Answer: • PostBackUrl

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

Answer: • GAC

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

Answer: • async=true on page directive, RegisterAsyncTask in page load and async method

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

Answer: • Yes

Question:* By default, ASP.NET store SessionIDs in

Answer: • Cookies

Question:* 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?

Answer: • INamingContainer

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

Answer: • Arrays

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

Answer: • Lock() and UnLock()

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

Answer: • Yes

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

Answer: • MetaKeyword and MetaDescription

Question:* How can an MVC View be protected from CSRF?

Answer: • @Html.AntiForgeryToken() in View and ValidateAntiForgeryToken attribute on controller action

Question:* "<%=" is the same as:

Answer: • Response.Write

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

Answer: • web

Question:* In the following example, is viewstate being set? (Test.aspx - viewstate enabled) <asp:Label id=”LabelTest” runat=”server” /> (Test.aspx.cs) protected override void OnLoad(EventArgs args) { this.LabelTest.Text = “changed”; base.OnLoad(e); }

Answer: • Yes

Question:* Which of the following denotes the web control associated with Table control function of ASP.NET?

Answer: • TableRow (ANS)

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

Answer: • False

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

Answer: • Parent is the immediate node a level above, Ancestors is all nodes all levels above.

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

Answer: • Yes

Question:* How do you make a controller action async?

Answer: • return an async Task<ActionResult> from controller action while awaiting within the method

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

Answer: • By setting the EnableClientScript property to false

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

Answer: • Inproc

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

Answer: • Need for SOAP

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

Answer: • InProcess

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

Answer: • System.Web.UI.Page.Culture

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

Answer: • 20

Question:* The low level Request and Response API to service incoming Http requests in ASP.NET is called:

Answer: • HttpHandler

Question:* The threading model used in ASP.NET is:

Answer: • MTA

Question:* What is the role of the Web API Media Type Formatter?

Answer: • Reads the message body and serializes the response

Question:* The application event that is fired at the beginning of each request to the server is called:

Answer: • Application_BeginRequest

Question:* The property used to ensure that the encoded and encrypted viewstate is not tampered is:

Answer: • EnableViewStateMac

Question:* In ASP.NET if you want to allows page developers a way to specify static connections in a content page then the class used is

Answer: • ProxyWebPartManager

Question:* The infrastructure that supports these dynamic operations at run time is called the__________.

Answer: • DLR

Question:* Which of the following is not a Web Form Event in ASP.NET: Page_Dispose Page_Error Page_AbortTransaction Page_CommitTransaction

Answer: • Page_Dispose

Question:* What can we specify in the web.config to apply Themes to an ASP.NET application?

Answer: • <pages theme="Windows7" />

Question:* Which of the following events are correctly ordered according to the Application lifecycle?

Answer: • BeginRequest, AuthenticateRequest, AuthorizeRequest, ResolveRequestCache, AcquireRequestState, ProcessRequest, ReleaseRequestState, UpdateRequestCache, EndRequest.

Question:* What is the use of "_" in asp.net?

Answer: • line break

Question:* What are the primary request headers involved in Web API content negotiation?

Answer: • Accept, Accept-Charset, Accept-Encoding, Accept-Language

Question:* Which method has been introduced in ASP.NET 4.0 to redirect a page permanently?

Answer: • RedirectPermanent() method

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

Answer: • System.Environment.UserName

Question:* What is wrong with this code? string email = emailTextbox; string SQL = "select * from users where username = '"+email+"' "; SqlCommand myCommand = new SQLCommand(SQL, myConnection) try { myConnection.Open(); SqlDataReader myReader=myCommand.ExecuteReader(); if (myReader.Read()) { ...

Answer: • the string email will not have the right value and the SQL is subject to injection attacks.

Question:* How can Web API OData support be implemented?

Answer: • Controller extends ODataController

Question:* How can you protect the asp:login object from SQL Injection attacks?

Answer: • It is protected by default.

Question:* To prevent a browser from caching an .aspx page the statement used is:

Answer: • Response.NoCache = "true";

Question:* What are the three IIS isolation levels?

Answer: • Low, Medium and High

Question:* How do you sign out from forms authentication?

Answer: • Using FormsAuthentication.Signout() method

Question:* How can the button click work in the following code: <asp:ScriptManager EnablePartialRendering="true" ID="ScriptManager1" runat="server"></asp:ScriptManager> <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional"> <ContentTemplate> <asp:Label ID="Label1" runat="server" /><br /> </ContentTemplate> </asp:UpdatePanel> <asp:Button ID="Button1" runat="server" Text="Update Panel" OnClick="Button1_Click" />

Answer: • Triggers tag with AsyncPostBackTrigger

Question:* 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?

Answer: • All of these will work

Question:* What is the role of the Web API Media Type Formatter?

Answer: • Reads the message body and serializes the response

Question:* Asynchronous behavior is related to

Answer: • None of these

Question:* Which of the following statements is true about the GridView in .NET 4.5?

Answer: • Strongly typed object binding

Question:* What is the default timeout for a Cookie?

Answer: • 30 minutes

Question:* How do you make a controller action async?

Answer: • return an async Task<ActionResult> from controller action while awaiting within the method

Question:* What is correct Syntax for applying FAViCON ICON to your web page.

Answer: • <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon"/> <link rel="icon" href="/favicon.ico" type="image/x-icon"/>

Question:* Which of the following is not a WCF service behaviour?

Answer: • Endpoint addresses

Question:* "<%=" is the same as:

Answer: • Response.Write

Question:* Under what condition(s) should a controller action be made async?

Answer: • IO intensive

Question:* How do you turn off cookies for a page?

Answer: • Set Cookie.Discard property to true

Question:* To enforce compatibility between ASP.NET and old COM components that does not support MTA model the attribute used in the @Page directive is:

Answer: • aspcompat

Question:* To check for integrity of data in a Request object, the method used is:

Answer: • HttpRequest.ValidateInput()

Question:* How does Web API OData support partial updates?

Answer: • Delta<T> parameter in controller action

Question:* Which of the following locking techniques is considered speculative?

Answer: • SpinWait

Question:* What are the strategies for partitioning threads in a PLINQ query?

Answer: • Chunked, ranged or hashed

Question:* What can we specify in the web.config to apply Themes to an ASP.NET application?

Answer: • <pages theme="Windows7" />

Question:* The XML format that you can use to render DataSet object contents to XML is called:

Answer: • DiffGram

Question:* Which of the following statements is true?

Answer: • IEnumerable is a pull based sequence

Question:* What are the built-in WCF message encoder implementations?

Answer: • TextMessageEncoder, BinaryMessageEncoder & MtomMessageEncoder

Question:* Caching in ASP.NET is used to:

Answer: • Reduce server round trips

Question:* The property used to set absolute cache expiration in ASP.NET is:

Answer: • Cache.NoSlidingExpiration

Question:* Postback occurs in which of the following forms.

Answer: • Webforms

Question:* What class does the ASP.NET web form class inherit from by default?

Answer: • System.Web. UI.Page

Question:* What is the different between int.Parse() and Convert.ToInt32()

Answer: • int.Parse() take only string() but Convert.ToInt32() take any object

Question:* How ASP.Net Different from classic ASP?

Answer: • Scripting is separated from the HTML, Code is compiled as a DLL, the DLLs can be executed on server

Question:* How can I show the entire validation error message in a message box on the client side?

Answer: • In the ValidationSummary control set property called “ShowMessageBox” to true.

Question:* What is the different between int.Parse() and Convert.ToInt32()

Answer: • int.Parse take only string() but Convert.ToInt32() take [object]

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

Answer: • Runat = "Server"

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

Answer: • points to the location where your project stored

Question:* Page 1 has this link: <a href="page2.asp?color=green">Go</a> How can page2.asp get the "color" parameter?

Answer: • Request.QueryString("color")

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

Answer: • <identity impersonate = "true" />

Question:* Where is the ViewState information stored?

Answer: • in the HTML hidden fields.

Question:* What is the method name to make upper case to string value?

Answer: • ToUpper()

Question:* What is the different between int.Parse() and Convert.ToInt32()

Answer: • int.Parse() take only string() but Convert.ToInt32() take any object

Question:* What is wrong with this code? string email = emailTextbox; string SQL = "select * from users where username = '"+email+"' "; SqlCommand myCommand = new SQLCommand(SQL, myConnection) try { myConnection.Open(); SqlDataReader myReader=myCommand.ExecuteReader(); if (myReader.Read()) { ...

Answer: • the string email will not have the right value and the SQL is subject to injection attacks.

Question:* To prevent a browser from caching an .aspx page the statement used is:

Answer: • Response.NoCache = "true";

Question:* What is correct Syntax for applying FAViCON ICON to your web page.

Answer: • <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon"/> <link rel="icon" href="/favicon.ico" type="image/x-icon"/>

Question:* What can we specify in the web.config to apply Themes to an ASP.NET application?

Answer: • <pages theme="Windows7" />

Question:* When decorating a function with async, what is the appropriate return type?

Answer: • Task<>



No comments:

HTML5 Upwork (oDesk) TEST ANSWERS 2022

HTML5 Upwork (oDesk) TEST ANSWERS 2022 Question: Which of the following is the best method to detect HTML5 Canvas support in web br...

Disqus for upwork test answers