Elance ASP.NET Test Answers 2015
·
Which file is used to configure an asp.net
website?
index.html
asp.settings
web.config
power.cs
settings.ini
The application event that is fired at the
beginning of each request to the server is called:
Application_OnStart
Application_Init
Application_Start
Application_BeginRequest
ASP server scripts are surrounded by
delimiters, which?
<script>...</script>
<&>...</&>
<%...%>
<%>...</%>
What is the different between int.Parse() and
Convert.ToInt32()
int.Parse take only string() but Convert.ToInt32()
take [object]
int.Parse take [object] but Convert.ToInt32() take
only string()
Where is the ViewState information stored?
in cookies
query string
in session variables
in database
in the HTML hidden fields.
Which of the following ASP.NET directories
stores class files (.cs) by default?
App_Data
App_GlobalResources
Bin
App_Code
Which of the following denote the web control
associated with Table control function of ASP.NET?
ListBox
TableRow
What is ASP.Net
Server Side Technology
Programming Language
ASP.NET separates the HTML output from program
logic using a feature named as
Code-front
None of the above
Code-behind
Exception
How to identify a postback
ViewState
MachineState
use Session
Postback
use IsPostback
Can you write serverside code inside aspx page
Yes use the <% %>
No cant it should inside .cs file
What is used to validate complex string
patterns? i.e email
Regular Expressions
Irregular expressions
Extended Expressions
Basic Expressions
When an .aspx page is requested from the web
server, the out put will be rendered to browser in following format.
WML
HTML
XML
JSP
The Asp.net server control, which provides an
alternative way of displaying text on web page, is
< asp:listitem >
< asp:button >
< asp:label >
The property of the Page class used to
determine if the page has posted back is:
IsPostBack
PostBack
HasPostedBack
Can you set which type of comparison you want
to perform by the CompareValidator control?
Yes
No
Which attribute must be set on the validator
control for the validator to work?
validate
controltobind
validatecontrol
ControlToValidate
Give One word: Common type system is built
into which of the following
CLR
RCT
Which of the following is a property all the
ASP.NET controls have?
runat
name
bgcolor
text
The logical and physical boundary created
around every .NET application is known as:
Application Domain
Process Domain
Thread Space
Process Space
Which is the parent class of Web server
control?
System.Web.Ul.Control
System.Web.Type
System.Web.Ul.BaseControl
System.Web.Ul.Type
What is the syntax to inherit from a class in
C#?
A class that cannot be instantiated
The signature of the virtual method must remain the
same
Place a colon and then the name of the base class.
How can I show the entire validation error
message in a message box on the client side?
Not supported
In the ValidationSummary control set property
called “ShowMessageBox” to true.
Write custom java script code and set ScriptEnabled
to "true"
What is the difference in Application State
and View State?
Application State is stored on the server while
ViewState is stored on the client machine.
Application State is stored on the client machine
while ViewState is stored on the server.
None of the above.
Which method of the ServiceController class
will allow you to send a command to the service?
Pause()
Start()
ExecuteCommand()
Stop()
Which of the following file types is associted
with ASP.NET User controls?
.aspx
.asmx
.ascx
.asax
What must be done before you can consume a web
service?
Build a proxy library by using the Disc.exe
utility.
Build a proxy library by using the csc.exe utility.
Build a proxy library by using the TblImp.exe
utility.
Build a proxy library by using the wsdl.exe utility
What is the extension of a web user control
file?
.Aspx
.Ascx
.Asmx
We can manage states in asp.net application
using
Application Objects
Session Objects
Viewstate
(all of these)
Page 1 has this link: <a
href="page2.asp?color=green">Go</a> How can page2.asp get
the "color" parameter?
Get("color")
Response.Parameter("color")
Response.QueryString("color")
Request.QueryString("color")
Which HTML control property should be set to
access control from code behind?
Runat = "Server"
ID = "TextBox2"
ClientID = "TextBox1"
RunatServer = "True"
Which of the following controls is used to
validate that two fields are equal?
CompareValidator
Required Field Validator
Equals() method
RegularExpressionValidator
In Asp.Net Server.MapPath(".")
points to which location
points to C:\\My Documents\Microsoft Visual Studio
folder
points to the location where your project stored
it will not point to any location
there is no such function in asp.net
The number of forms that can be added to a
aspx page is.
2
7
3
4
1
Where are private assemblies stored in
ASP.NET?
application root directory
windows directory
root directory of bootable drive
application / bin directory
Which of the following is a navigation
control:
Pager
Repeater
None of these
Menu
What is default timeout of session in asp.net?
10ns
20 ns
1 hr
20 min
10min
The feature in ASP.NET 2.0 that is used to
fire a normal postback to a different page in the application is called
Cross Page Posting
None of the above
Code-front
Theme
What’s the difference between localization and
globalization?
Localization is local issues while globalization is
global issues
They’re both the same
Different namespaces
Localization is from the client perspective while
globalization is from the server perspective
Which version of ASP .NET MVC has built-in
support for mobile targeting?
MVC 2
MVC 4
MVC 3
MVC 1
Which of the following is not a .NET
compatible language?
Java
Managed C++
COBOL.NET, Perl.NET
C#, J#
VB.NET
What is the name of the property to get client
side id for a control at run time?
Name
ClientID
ClientSideID
ID
How do you enable impersonation in the
web.config file?
<setImpersonate = "true" />
<identity impersonate = "true" />
<impersonate = "true" />
<identity setImpersonate = "true"
/>
In ASP.Net, session is maintained using the
methods:
(all of these)
Only SQL Server
Only In-Process storage
Only Session State Service
In which event are the controls fully loaded?
Page.Load()
Page.Init()
Page.OnLoad()
Page.PreInit()
Why should you close all database objects and
set them to NULL before leaving the method where the objects were created?
To ensure that the connection to the database is
closed as soon as possible
To ensure that the object’s destructors are called.
To ensure that the objects can be reused.
ASP.NET stores membership, role management,
and profile information in which database?
aspdotnetdb
aspdotnetdatabaase
aspnetdb
netdb
The first method that is executed in the Page
life cycle in ASP.NET is:
Page.Load
Init
PreInit
PreLoad
Which method do you use to kill explicitly a
users session?
Session.Flush() method
Session.Kill(true) method
Session.Kill() method
Session.Abandon() method
Can Web API be hosted in its own process
without IIS?
Yes
No
.NET remote server object must implement?
ISingleCall
IMarshalByRef
ISerializable
IUnknown
IMarshalByValue
How do you get info from a form that is
submitted using the post method?
Response.Write
Response.WriteLine
Request.Form
Request.QueryString
To load an assembly dynamically, the method
used is:
Assembly.Memory.Load()
Assembly.Dynamic.Load()
Assembly.Load()
Assembly.LoadDynamic()
What is the method name to make upper case to
string value?
toUpperCase()
Toupper()
ToUpperString()
ToUpperCase()
ToUpper()
How ASP.Net Different from classic ASP?
Scripting is separated from the HTML, Code is
compiled as a DLL, the DLLs can be executed on server
Code is separated from the HTML and interpreted
Code is interpreted separately
Scripting is separated from the HTML, Code is
interpreted seperately
How do you disable client side script in
validators?
Set EnableClientScript property to false.
Set EnableScript property to false
Delete the EnableClientScript property in the
markup code
Set DisableClientScript property to true.
Which of the following is/are applicable while
using Server Socket Level communications?
A certificate must be installed on the server.
All of these choices
The certificate must match the web address to
prevent a browser warning or error.
The certificate must be issued by an authority
recognized by the client computer to prevent a browser warning or error.
What is the different between int.Parse() and
Convert.ToInt32()
int.Parse() take any object but Convert.ToInt32()
take only string()
int.Parse() take only string() but
Convert.ToInt32() take any object
No different between its
What is/are the methods to author pages in
ASP.NET?
Outline Code
By-Directional Code
In-Line Code
Both In-Line Code and Code Behind
Code Behind
What class does the ASP.NET web form class inherit
from by default?
System.Web. UI.Page
System.Web.Form
System.Web. UI.Form
System. Web. GUI.Page
Can MVC, Web Forms and Web API be mixed in the
same project?
Only MVC and Web Forms, not Web API
No
Yes
Only in .NET 4.5
By default, ASP.NET store SessionIDs in
Cookies
Cache
Global variable
Database
What is the default scripting language in ASP?
JavaScript
VBScript
PERL
Can ASP.NET run on a linux server?
No
Linux doesn’t have server variants
Yes, via the Mono project
Microsoft is planning to change ASP.NET to run on
linux in the future
Which formats can Web API work with?
XML
All of these
ATOM Pub
xVx
Contents of assembly file can be investigated
using
ILDASM.inc
ILDASM.dll
ILDASM.aspx
ILDASM.exe
Which of the following statements best
describes setting up an async page in .NET 4.5?
async=true on page directive, RegisterAsyncTask in
page load and async method
async=true on page directive
async method
TaskFactory.StartNew(method1)
How can an MVC View be protected from CSRF?
@Html.AntiForgeryToken() in View
Web.Config app setting AntiForgeryToken true
not possible
@Html.AntiForgeryToken() in View and
ValidateAntiForgeryToken attribute on controller action
How do you make a controller action async?
return an async Task from controller action while
awaiting within the method
Register async controller action in Global.asax
return an async Task from controller action
return an async Task<ActionResult> from
controller action while awaiting within the method
In LINQ what is the difference in .Ancestor
and .Parent?
Parent is the immediate node below, Ancestors is
all nodes above and below.
Parent is the immediate node a level above,
Ancestors is all nodes above and below.
Parent is the immediate node a level above,
Ancestors is all nodes all levels above.
None of the above
Can you run a web application without the
web.config file?
No
Yes
Runtime error
It will not compile if there is no web.config file
What method(s) must be used with the
Application object to ensure that only one process accesses a variable at a
time?
ThreadLock
Lock() and UnLock()
Synchronize()
"<%=" is the same as:
<%
<&
Response.Write
Document.Write
The property used to access user's locale
information is:
System.Web.UI.Page.User
System.Web.UI.Page.Locale
System.Web.Locale
System.Web.UI.Page.Culture
which of the following is not ASP.NET
directives?
web
page
import
register
Which of the following contains one or more
variables that are accessed through sequential indices?
Arrays
Nullable Types
Delegates
Indexers
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?
INamingContainer
IExtenderCtonrol
IDataItemContainer
IDataKeysControl
True or False: Without Web.config file
application will not compile or Run.
True
False
When would WCF be a better solution than Web
API?
Need for XML
Need for metadata
Need for SOAP
Need for REST
_______ is a special subfolder within the
windows folder that stores the shared .NET component?
Root
/bin
GAC
Where is the default Session data stored in
ASP.Net?
InProcess
Session Object
StateServer
Which two new properties are added in ASP.NET
4.0 Page class?
Culture and Locale
MetaKeyword and MetaDescription
Culture and Description
Keyword and Description
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); }
Yes
No
Only in .NET 4+
Only if LabelTest.Text is changed in following
events before PreRender
In which of the following SessionState Modes
the Session_End event fires?
StateServer
None
SQL Server
Inproc
How can you disable client-side validation in
ASP.NET?
By setting ValidateScripting to false
By setting EnableScripting to false
By setting ValidateClientScript to false
by setting CauseValidation to false
By setting the EnableClientScript property to false
What is the role of the Web API Media Type
Formatter?
Reads the message body and serializes the response
Reads from the URI path and querystring
Reads the message body only
A custom parameter binding that can read any part
of the HTTP request
What’s the difference between Response.Write()
andResponse.Output.Write()?
Response.Output.Write() allows you to stream output
Response.Output.Write() allows you to flush output
Response.Output.Write() allows you to write
formatted output
Response.Output.Write() allows you to buffer output
Which of the following denotes the web control
associated with Table control function of ASP.NET?
DataList
TableRow (ANS)
ListBox
The low level Request and Response API to
service incoming Http requests in ASP.NET is called:
HttpResponse
HttpRequest
HttpHandler
HttpAPI
The property used to support Cross Page
Scripting in ASP.NET is:
AutoPostBack
AutoPostBackUrl
PostBackUrl
How do you sign out from forms authentication?
Using FormsAuthentication.Logout() method
Using FormsAuthentication.Logoff() method
Using FormsAuthentication.Signout() method
The threading model used in ASP.NET is:
STA
Single Threaded
Not supported
MTA
Which method has been introduced in ASP.NET
4.0 to redirect a page permanently?
Redirect(true) method
RedirectPermanent() method
Page.Redirect(true) method
PermanentRedirect() method
Which property is used to retrieve a username
in Windows Authentication?
System.Environment.GetUserName
System.Environment.UserName
System.UserName
System.Environment.User
What is the maximum number of cookies that can
be allowed to a web site?
20
more than 30
10
1
Caching in ASP.NET is used to:
Reduce redundant object creation
Reduce database hits
Load pages from memory
Reduce server round trips
What are the three IIS isolation levels?
Base, Custom and Enhanced
Base, Custom and High
Pooled, Non pooled, Not set
Low, Medium and High
To prevent a browser from caching an .aspx
page the statement used is:
Response.Cache.SetNoStore ();
Response.NoCache = "true";
Response.Cache = "false";
Response.Cache = "Yes"
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?
Change sessionstate mode to InProc
Add the Serializable attribute to Custom class
Change the property type to HashSet<Custom>
instead of Custom
All of these will work
How can you protect the asp:login object from
SQL Injection attacks?
Create a SqlFilter object and pass the inputs
through it.
Make sure the connection string used only has read
access to the database.
It is protected by default.
Use a regular expression to filter the inputs
before login.
Set the SqlFilter property to true.
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" />
Trigger attribute on Button control
Triggers tag with AsyncPostBackTrigger
TriggerControl attribute on UpdatePanel
Trigger element in UpdatePanel
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()) { ...
the string email will not have the right value.
There is nothing wrong in this code.
the SQL is subject to injection attacks.
the string email will not have the right value and
the SQL is subject to injection attacks.
a SqlDataReader can't be instantiated from a
SqlCommand object.
The property used to ensure that the encoded
and encrypted viewstate is not tampered is:
ViewStateSecure
ViewStateSafe
EnableViewState
EnableViewStateMac
What are the primary request headers involved
in Web API content negotiation?
Accept-Charset, Accept-Encoding
Accept, Accept-Charset, Accept-Encoding,
Accept-Language
X-Requested-With, Accept, Accept-Charset,
Accept-Encoding, Accept-Language
Accept-Charset, Accept-Encoding, Accept-Language
Which of the following is not a Web Form Event
in ASP.NET: Page_Dispose Page_Error Page_AbortTransaction
Page_CommitTransaction
Page_Dispose
All of these
None of these
Page_Error
The infrastructure that supports these dynamic
operations at run time is called the__________.
CLR
CTS
DLR
CLS
Which of the following events are correctly ordered
according to the Application lifecycle?
BeginRequest, AuthenticateRequest,
AuthorizeRequest, AcquireRequestState, ResolveRequestCache, ProcessRequest,
UpdateRequestCache, ReleaseRequestState, EndRequest.
BeginRequest, ResolveRequestCache, AuthenticateRequest,
AuthorizeRequest, AcquireRequestState, ProcessRequest, ReleaseRequestState,
UpdateRequestCache, EndRequest.
BeginRequest, AuthorizeRequest,
AuthenticateRequest, ResolveRequestCache, AcquireRequestState, ProcessRequest,
ReleaseRequestState, UpdateRequestCache, EndRequest.
BeginRequest, AuthenticateRequest,
AuthorizeRequest, ResolveRequestCache, AcquireRequestState, ProcessRequest,
ReleaseRequestState, UpdateRequestCache, EndRequest.
How can Web API OData support be implemented?
Controller extends EntitySetController<T>
Return IQueryable or IEnumerable
Controller extends ODataController
All of these
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
ProxyWebPartManager
WebPartManager
None of the Above
System.Activator
What is the use of "_" in asp.net?
space
concatenate
line break
link
separate
Which of the following statements is true
about the GridView in .NET 4.5?
Strongly typed object binding
Uses CSS div’s instead of html table based layout
Can only be bound to a data sources or objects that
are data bound in code behind
Uses AJAX functionality by default
What is correct Syntax for applying FAViCON
ICON to your web page.
<link rel="icon" href="/favicon.ico"
type="image/x-icon"/>
<link rel="shortcut icon"
href="/favicon.ico" type="image/x-icon"/> <link
rel="icon" href="/favicon.ico"
type="image/x-icon"/>
<link rel="shortcut icon"
href="/favicon.ico" type="image/x-icon"/>
Which of the following is not a WCF service
behaviour?
Endpoint addresses
Adding security features to a service, such as
impersonation, authorization, or managing tokens
Recording information about messages, such as
tracking, tracing, or logging
Message and validation
What is the default timeout for a Cookie?
30 minutes
40 minutes
20 minutes
60 minutes
What can we specify in the web.config to apply
Themes to an ASP.NET application?
<pages applyTheme="Windows7" />
<pages theme="Windows7" />
<pages theme="true" />
<pages themesEnabled="true" />
Under what condition(s) should a controller
action be made async?
CPU & IO intensive
IO intensive
CPU intensive
All controller actions should be made async
To check for integrity of data in a Request
object, the method used is:
HttpRequest.Current.Validate()
HttpRequest.ValidateUserInput()
HttpRequest.ValidateInput()
HttpRequest.Validate()
Asynchronous behavior is related to
Parallel Programming
Threading
None of these
Multi-core Processors
To enforce compatibility between ASP.NET and
old COM components that does not support MTA model the attribute used in the
@Page directive is:
backwardcompatibility
aspcompat
aspcompatibility
aspnetcompat
Which of the following locking techniques is
considered speculative?
MemoryBarrier
SpinLock
lock
SpinWait
How do you turn off cookies for a page?
Set Cookie.Discard property to true
Set Cookie to false in all pages
Set IsCookieEnabled to false in all pages
Set CookieEnabled = false in all pages
How does Web API OData support partial updates?
Patch<T> parameter in controller action
Delta<T> parameter in controller action
PartialUpdatesEnabled setting in web.config
PartialUpdatesEnabled in global.asax.cs
What are the strategies for partitioning
threads in a PLINQ query?
Auto or manual
IEnumerable or IQueryable
AsParallel().WithDegreeOfParallelism()
Chunked, ranged or hashed
Postback occurs in which of the following
forms.
HTMLForms
Webforms
Winforms
Which of the following statements is true?
IEnumerable is thread safe by default because each
iterator gets an IEnumerator
IEnumerable is both push and pull based
IEnumerable is a pull based sequence
IEnumerable is a push based sequence
The XML format that you can use to render
DataSet object contents to XML is called:
DiffGram
RenderXML
XMLRender
RenderDataSet
What are the built-in WCF message encoder
implementations?
TextMessageEncoder, BinaryMessageEncoder &
MtomMessageEncoder
TextMessageEncoder, BinaryMessageEncoder &
AtomMessageEncoder
All of these
StringMessageEncoder, BinaryMessageEncoder &
MtomMessageEncoder
The property used to set absolute cache
expiration in ASP.NET is:
Cache.NoSlidingExpiration
Cache.SetAbsoluteExpiration
Cache.AbsoluteExpiration
Cache.NoExpiration
When decorating a function with async, what is
the appropriate return type?
Task<>
Task<object>
List<Object>
async
Subscribe to:
Posts (Atom)