63415398 testking web 70 515 csharp exam web applications development with microsoft net framework 4...
Post on 07-Apr-2018
229 Views
Preview:
TRANSCRIPT
-
8/4/2019 63415398 Testking Web 70 515 CSHARP Exam Web Applications Development With Microsoft NET Framework 4 CS
1/26
Total Questions:251
http://www.testkingweb.com/microsoft-70-515.html Page 1 of234
Questions and Answerswith
Detailed Explanations and Objectives
Vendor:Microsoft
Certification(s):MCTS, MCPD
Exam Code:70-515-CSHARP
Exam Name:
TS: Web Applications Development with Microsoft
.NET Framework 4 (CSHARP)
Total Questions:251
http://www.testkingweb.com/http://www.testkingweb.com/microsoft-70-515.htmlhttp://www.testkingweb.com/microsoft-70-515.htmlhttp://www.testkingweb.com/microsoft-certification-training.htmlhttp://www.testkingweb.com/microsoft-certification-training.htmlhttp://www.testkingweb.com/mcts-certification-training.htmlhttp://www.testkingweb.com/mcts-certification-training.htmlhttp://www.testkingweb.com/mcpd-certification-training.htmlhttp://www.testkingweb.com/microsoft-70-515.htmlhttp://www.testkingweb.com/microsoft-70-515.htmlhttp://www.testkingweb.com/microsoft-70-515.htmlhttp://www.testkingweb.com/microsoft-70-515.htmlhttp://www.testkingweb.com/microsoft-70-515.htmlhttp://www.testkingweb.com/microsoft-70-515.htmlhttp://www.testkingweb.com/http://www.testkingweb.com/microsoft-70-515.htmlhttp://www.testkingweb.com/microsoft-70-515.htmlhttp://www.testkingweb.com/microsoft-70-515.htmlhttp://www.testkingweb.com/microsoft-70-515.htmlhttp://www.testkingweb.com/microsoft-70-515.htmlhttp://www.testkingweb.com/microsoft-70-515.htmlhttp://www.testkingweb.com/mcpd-certification-training.htmlhttp://www.testkingweb.com/mcts-certification-training.htmlhttp://www.testkingweb.com/microsoft-certification-training.html -
8/4/2019 63415398 Testking Web 70 515 CSHARP Exam Web Applications Development With Microsoft NET Framework 4 CS
2/26
Total Questions:251
http://www.testkingweb.com/microsoft-70-515.html Page 2 of234
Objectives
A Developing Web Forms Pages (19%)
B Developing and Using Web Forms Controls (18%)
C Implementing Client-Side Scripting and AJAX (16%)
D Configuring and Extending a Web Application (15%)
E Displaying and Manipulating Data (19%)
F Developing a Web Application by Using ASP.NET MVC 2 (13%)
Note: Relevant objective of each question is mentioned with Question number.
-
8/4/2019 63415398 Testking Web 70 515 CSHARP Exam Web Applications Development With Microsoft NET Framework 4 CS
3/26
Total Questions:251
http://www.testkingweb.com/microsoft-70-515.html Page 3 of234
QUESTION NO: 1(A)
You work as an ASP.NET Web Application Developer for Testking Web Inc. The company uses Visual
Studio .NET 2010 as its application development platform. You create an ASP.NET Web application using
.NET Framework 4.0.
The company's employees in Chicago will use the application. The application includes a page named
Page1.aspx that displays the current climate conditions of the city. The application updates the climate
data on Page1.aspx by calling an XML Web service every five minutes. You want to cache the output of
the page for this time interval. You want to accomplish this by using a page directive in the HTML file
associated with Page1.aspx.
Use the appropriate markup that you will use in the @ OutputCache directive to accomplish the task.
ANSWER:
In order to accomplish the task, you will use the following page directive in Page1.aspx:
EXPLANATION:
ASP.NET provides a powerful technique called output caching. This technique allows subsequent
requests for a particular page to be fulfilled from the cache so the code that initially creates the page is
not required to be run upon subsequent requests. Caching your Web site's most frequently accessed
pages can increase your Web server's throughput.
The @ OutputCache directive is used to control the output caching rules of the ASP.NET page or a user
control included in the ASP.NET page. The Duration attribute of the OutputCache directive indicates the
amount of time, in seconds, for which a control is cached.
The VaryByParam attribute in a page @ OutputCache directive describes how the page will be cached
when it is requested with different parameters. This attribute accepts a semicolon-separated list of
parameters or one of the following special values:
*: This value indicates that different cached versions of the page will be created when the pageis requested with different parameters.
-
8/4/2019 63415398 Testking Web 70 515 CSHARP Exam Web Applications Development With Microsoft NET Framework 4 CS
4/26
-
8/4/2019 63415398 Testking Web 70 515 CSHARP Exam Web Applications Development With Microsoft NET Framework 4 CS
5/26
Total Questions:251
http://www.testkingweb.com/microsoft-70-515.html Page 5 of234
ANSWER:A
EXPLANATION:
In order to remove the error, you will use the following code segment in the application code:
using System.Globalization;
In the given code, you have used the CultureInfo class. The CultureInfo class is used to provide
information about a specific culture. It provides information about a culture such as name of the culture,
the writing system, the calendar used, and formatting for dates. It provides culture-specific information
such as the associated language, sub-language, country/region, calendar, and cultural conventions. It
also provides access to culture-specific instances of DateTimeFormatInfo, NumberFormatInfo,
CompareInfo, and TextInfo objects.
This class resides in the System.Globalization namespace. Therefore, in order to use this class withoutany error, you need to use the System.Globalization namespace. The System.Globalization namespace
contains the classes that define culture-related information.
Answer option b is incorrect. The System.Web.Security namespace contains classes that are used to
implement ASP.NET security in Web server applications.
Answer option c is incorrect. The System.Security.Permissions namespace defines classes that control
access to operations and resources based on policy.
Answer option d is incorrect. There is no such namespace as System.Internationalized.
REFERENCE:
MSDN - .NET Framework 4, Contents: .NET Framework Class Library, CultureInfo Class,
System.Globalization Namespace
QUESTION NO: 3(A)
You work as an ASP.NET Web Application Developer for Testking Web Inc. The company uses Visual
Studio .NET 2010 as its application development platform. You are creating an ASP.NET Web application
for airlines passengers using .NET Framework 4.0.
The passengers access the application over the Internet and from airport booths worldwide. Airport
booths do not permit users to alter browser settings. You have created language-specific resources for
all static text elements in the application. You have to ensure that the content is displayed in the
language chosen by the users, in spite of their physical location.
What will you do?
A. Set the value of the Thread.CurrentThread.CurrentUICulture property to CultureInfo.InvariantCulture.
-
8/4/2019 63415398 Testking Web 70 515 CSHARP Exam Web Applications Development With Microsoft NET Framework 4 CS
6/26
Total Questions:251
http://www.testkingweb.com/microsoft-70-515.html Page 6 of234
B. Set the value of the enableClientBasedCulture attribute to true within the globalization element of
the Web.config file.
C. Set the value of the Page.UICulture property to a value stored in a user profile property.
D. Set the value of the UICulture attribute to auto within the @ Page directive on each ASP.NET page.
ANSWER:C
EXPLANATION:
You will set the value of the Page.UICulture property to a value stored in a user profile property. The
UICulture property of the Page class sets the user interface ID and is defined with either neutral or
specific cultures. It determines the type of resource file to be loaded for a Web page.
The UICulture attribute can be set in the @ Page directive of the Web page. The following is the syntax
of this property:
A section can also be added to the Web.config file and set the uiculture attribute in it.
The following is the syntax of this property:
Answer option a is incorrect. The CurrentUICulture property of the Thread class is used to set or obtain
the current culture used by the Resource Manager for a Web page. The current culture is then used for
the culture-specific resources at runtime of the Web page.
Answer option b is incorrect. The EnableClientBasedCulture property of the GlobalizationSection class is
used to get or set a value showing whether the Culture and UICulture properties should be based on the
AcceptLanguage header field value that is sent by the client browser. In case, the value of the
AcceptLanguage header cannot be mapped to a specific culture, then the Culture and UICulture values
are used. By default, the EnableClientBasedCulture property is set to false.
Answer option d is incorrect. The @ Page directive is a directive syntax of a Web page. It is used to
define page-specific attributes that are used by the Web page parser and compiler. Some commonly
used attributes of the @ Page directive are AutoEventWireup, CodeBehind, CodeFile, Inherits, and
Language. The syntax of the @ Page directive is as follows:
REFERENCE:
MSDN - .NET Framework 4, Contents:CultureInfo,ASP.NET Globalization and Localization
http://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo.aspxhttp://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo.aspxhttp://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo.aspxhttp://msdn.microsoft.com/en-us/library/c6zyy3s9.aspxhttp://msdn.microsoft.com/en-us/library/c6zyy3s9.aspxhttp://msdn.microsoft.com/en-us/library/c6zyy3s9.aspxhttp://msdn.microsoft.com/en-us/library/c6zyy3s9.aspxhttp://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo.aspx -
8/4/2019 63415398 Testking Web 70 515 CSHARP Exam Web Applications Development With Microsoft NET Framework 4 CS
7/26
Total Questions:251
http://www.testkingweb.com/microsoft-70-515.html Page 7 of234
QUESTION NO: 4(A)
You work as an ASP.NET Web Application Developer for Testking Web Inc. The company uses Visual
Studio .NET 2010 as its application development platform. You create an ASP.NET Web application using
.NET Framework 4.0. You want to show the date in a format specific to the English language in the
Canada region. You want to set it programmatically. Which of the following code segments will you use
to accomplish the task?
A. System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("fr-
FA")
B. System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-
CA")
C. System.Threading.Thread.CurrentThread.CurrentUICulture = new
System.Globalization.CultureInfo("en-US")
D. System.Threading.Thread.CurrentThread.CurrentUICulture = new
System.Globalization.CultureInfo("en-CA")
ANSWER:B
EXPLANATION:
You can change the current culture of an application in code by setting the current culture to a new
instance of the CultureInfo class. The CurrentCulture property of the CultureInfo class gets the
CultureInfo that represents the culture used by the current thread. The format for the culture name is
-, where is the language code and
is the subculture code. For example, ja-JP for Japanese (Japan) and en-US for
English (United States).
The CultureInfo constructor takes a string that represents the appropriate culture code as an argument.The CurrentThread.CurrentCulture property controls the culture used to format the data. When you set
the CurrentThread.CurrentCulture property to a new instance of CultureInfo, the data formatted by the
application will be updated according to the new format. You will use the following code segment to
programmatically set the culture to the English language and Canada region:
System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(en-CA)
Answer option a is incorrect. The value passed to the CultureInfo is fr-Fr, which represents the French
language in the region France. This will set the culture to French in France region.
Answer option c is incorrect. The CurrentUICulture property of the Thread class is used to set or obtain
the current culture used by the Resource Manager for a Web page. The current culture is then used for
the culture-specific resources at runtime of the Web page.
The CurrentUICulture property determines the resources that will be loaded in the Web forms at run
time. The given code segment will set the UICulture to en-US and will load the resources specific to that
culture.
Answer option d is incorrect. The given code segment will set the UICulture to en-CA, i.e., English in the
Canada region. This will load the resources specific to the specified culture.
-
8/4/2019 63415398 Testking Web 70 515 CSHARP Exam Web Applications Development With Microsoft NET Framework 4 CS
8/26
Total Questions:251
http://www.testkingweb.com/microsoft-70-515.html Page 8 of234
REFERENCE:
MSDN, .NET Framework 4, Contents:ASP.NET Globalization and Localization
QUESTION NO: 5(A)
You work as an ASP.NET Web Application Developer for Testking Web Inc. The company uses Visual
Studio .NET 2010 as its application development platform. You are creating an ASP.NET Web application
using .NET Framework 4.0.
The Web application will be accessed by international audience. The Web application holds global and
local resources for display elements that must be translated into the language that is preferred by the
user. You are required to ensure that a Label control named CompanyLabel displays text in the user's
preferred language from the global resource file.
Which control markup will you use?
A.
B.
C.
D.
ANSWER:B
EXPLANATION:
You will use the following control markup:
Explicit localization is used where a user makes use of a resource expression. The user must use a
resource expression for each property that he wants to set. A Button control that is configured to set
the Text property from a global resource file might look like as follows:
The resource expression takes the following form, where Class is optional, except the resource is a
global one, and ResourceID is necessary:
The Class value recognizes the resource file to use when the user uses global resources. When .resx files
http://msdn.microsoft.com/en-us/library/c6zyy3s9.aspxhttp://msdn.microsoft.com/en-us/library/c6zyy3s9.aspxhttp://msdn.microsoft.com/en-us/library/c6zyy3s9.aspxhttp://msdn.microsoft.com/en-us/library/c6zyy3s9.aspx -
8/4/2019 63415398 Testking Web 70 515 CSHARP Exam Web Applications Development With Microsoft NET Framework 4 CS
9/26
Total Questions:251
http://www.testkingweb.com/microsoft-70-515.html Page 9 of234
are compiled, the base file name, excluding extensions, is used as the class name of the resultant
assembly, explicitly. If the user wants to use resources from a local resource file, he does not have to
contain a class name. This is for the reason that ASP.NET matches the page class to the resource class.
The ResourceID value is the identifier of the resource to read. The user can indicate an implicit resource
expression or an explicit resource expression for a control, but not both in any case. The following
declarative syntax on a Button control causes a parser error:
In the above example, an implicit local resource file is mentioned as well as an explicit resource file
named WebResources is also mentioned. To avoid a parser error for the Button control, eliminate one of
the resource expressions.
Answer option a is incorrect. If you create local resource files for a particular page, you can employ
implicit localization to fill a control's property values from the resource file. In case of implicit
localization, ASP.NET interprets a resource file and matches resources to property values.
Answer options c and d are incorrect. These are syntactically incorrect markups as mentioned in the
answer option b .
REFERENCE:
MSDN - .NET Framework 4, Contents:ASP.NET Web Page Resources Overview
QUESTION NO: 6(A)
You work as an ASP.NET Web Application Developer for Testking Web Inc. The company uses Visual
Studio .NET 2010 as its application development platform. You create an ASP.NET Web application
named MyWebApp using .NET Framework 4.0.
MyWebApp holds an .aspx page named MyPage.aspx that is used to display information about the
company products. You deploy a copy of MyWebApp on a server for unit testing. You need to view the
trace output information for MyPage by browsing trace.axd URL for MyWebApp. You set the Trace
attribute of the @ Page directive for MyPage.aspx to true.
Which of the following elements will you add to the Web.config file to accomplish this?
A.
B.
C.
D.
ANSWER:C
http://msdn.microsoft.com/en-us/library/ms227427.aspxhttp://msdn.microsoft.com/en-us/library/ms227427.aspxhttp://msdn.microsoft.com/en-us/library/ms227427.aspxhttp://msdn.microsoft.com/en-us/library/ms227427.aspx -
8/4/2019 63415398 Testking Web 70 515 CSHARP Exam Web Applications Development With Microsoft NET Framework 4 CS
10/26
Total Questions:251
http://www.testkingweb.com/microsoft-70-515.html Page 10 of234
EXPLANATION:
You will add element to the Web.config file. Tracing can be
enabled for an application by using the element. The settings of the Web.config file override the
settings of the Machine.config file. Therefore, setting the enabled attribute of the element to
true in the Web.config file will enable tracing. The enabled attribute of the trace element is an optional
Boolean attribute. It is used to state whether tracing is enabled for an application. In order to use the
Trace.axd viewer, it is necessary to enable tracing. By default, the Trace.axd viewer is added to the
httpHandlers element. Its default value is set to false.
The pageOutput attribute of the trace element is an optional boolean attribute. It is used to identify
whether trace output is rendered at the end of each page. If false, trace output is accessible all the way
through the trace utility only. By default, the pageOutput attribute is set to false.
This attribute should be set to false because you do not want to render the trace output at the end of
MyPage.
The @ Page directive is used to specify control-specific attributes that are used by the ASP.NET page
compiler. The Trace attribute of the @ Page directive specifies whether or not tracing is enabled.
What is the trace element?
The trace element is an ASP.NET Settings Schema. It is used to configure the ASP.NET code tracing
service that controls how trace results are assembled, stored, and displayed. It consists of attributes,
child elements, and parent elements. An example of the trace element is as follows:
REFERENCE:
MSDN - .NET Framework 4, Contents:trace Element (ASP.NET Settings Schema)
QUESTION NO: 7(A)
You work as an ASP.NET Web Application Developer for Testking Web Inc. The company uses Visual
Studio .NET 2010 as its application development platform. You are creating an ASP.NET Web application
using .NET Framework 4.0.
http://msdn.microsoft.com/en-us/library/6915t83k.aspxhttp://msdn.microsoft.com/en-us/library/6915t83k.aspxhttp://msdn.microsoft.com/en-us/library/6915t83k.aspxhttp://msdn.microsoft.com/en-us/library/6915t83k.aspx -
8/4/2019 63415398 Testking Web 70 515 CSHARP Exam Web Applications Development With Microsoft NET Framework 4 CS
11/26
-
8/4/2019 63415398 Testking Web 70 515 CSHARP Exam Web Applications Development With Microsoft NET Framework 4 CS
12/26
Total Questions:251
http://www.testkingweb.com/microsoft-70-515.html Page 12 of234
QUESTION NO: 8(A)
You work as an ASP.NET Web Application Developer for Testking Web Inc. The company uses Visual
Studio .NET 2010 as its application development platform. You create an ASP.NET Web application using
.NET Framework 4.0. The application contains an ASP.NET Web page named MyPage.aspx. You need to
determine whether the page is rendering for the first time or is responding to a post back. You write the
following code segment:
if(!IsPostback)
{
Validate();
}
In which of the following events will you place this code segment to accomplish this?
A. Page_Init
B. Page_PreRenderC. Page_Load
D. Page_PreRenderComplete
ANSWER:C
EXPLANATION:
You will place this code in Page_Load event. You can determine whether a page is being rendered for
the first time or is responding to a post back by checking the value of IsPostBack property when the
page is loaded.
In the Page.Load event, a page is used to call the OnLoad event method on the page. Later, it recursivelyperforms the same task for each and every child control. The child control performs the same task for
each of its child controls until the page and all controls are loaded. The OnLoad event method is used to
set properties in controls as well as database connections.
Answer option a is incorrect. The Page.Init event is raised only if all controls have been initialized and
any skin settings have also been applied. The Init event of individual controls occurs before the Init
event of the page. The Page.Init event can be used to read or initialize control properties.
Answer option b is incorrect. The Page.PreRender event is used for each and every control on a page. It
is used to make ultimate changes to the contents of the page or its controls. However, before this event
occurs, the following actions are performed:
The Page object calls the EnsureChildControls method for each and every control as well as forthe page.
Each data bound control calls its DataBind method if DataSourceID property is set.Answer option d is incorrect. The Page.PreRenderComplete event occurs before the page content is
rendered. In other words, the PreRenderComplete event is raised when the pre-render stage of the
-
8/4/2019 63415398 Testking Web 70 515 CSHARP Exam Web Applications Development With Microsoft NET Framework 4 CS
13/26
Total Questions:251
http://www.testkingweb.com/microsoft-70-515.html Page 13 of234
page life cycle is complete. At this stage, all controls are created, any pagination needed is completed,
and the page is all set to render to the output. The PreRenderComplete event is the last event that
occurs before the page's view state is saved.
REFERENCE:
MSDN - .NET Framework 4, Contents:ASP.NET Page Life Cycle Overview
QUESTION NO: 9(A)
Which of the following classes is used to define the properties, methods, and events that are shared by
all ASP.NET server controls?
A. ControlBuilder
B. ControlCollection
C. Control
D. UserControl
ANSWER:C
QUESTION NO: 10(A)
You work as an ASP.NET Web Application Developer for Testking Web Inc. The company uses Visual
Studio .NET 2010 as its application development platform. You are creating an ASP.NET Web application
using .NET Framework 4.0.
You create a Web page named MyPage.aspx that holds validation controls. You are required to
authenticate that all input values submitted by a user have been validated by using the IsValid propertyof the page.
In which of the following Page events will you add an event handler to accomplish this?
A. Page.Init
B. Page.Load
C. Page.PreRender
D. PreInit
ANSWER:B
EXPLANATION:
Yow will add an event handler to the Page.Load event. In the Page.Load event, a page is used to call the
OnLoad event method on the page. Later, it recursively performs the same task for each and every child
control. The child control performs the same task for each of its child controls until the page and all
controls are loaded. The OnLoad event method is used to set properties in controls as well as database
connections.
http://msdn.microsoft.com/en-us/library/ms178472.aspxhttp://msdn.microsoft.com/en-us/library/ms178472.aspxhttp://msdn.microsoft.com/en-us/library/ms178472.aspxhttp://msdn.microsoft.com/en-us/library/ms178472.aspx -
8/4/2019 63415398 Testking Web 70 515 CSHARP Exam Web Applications Development With Microsoft NET Framework 4 CS
14/26
Total Questions:251
http://www.testkingweb.com/microsoft-70-515.html Page 14 of234
Answer option a is incorrect. The Page.Init event is raised only if all controls have been initialized and
any skin settings have also been applied. The Init event of individual controls occurs before the Init
event of the page. The Page.Init event can be used to read or initialize control properties.
Answer option c is incorrect. The Page.PreRender event is used for each and every control on a page. It
is used to make ultimate changes to the contents of the page or its controls. However, before this event
occurs, the following actions are performed:
The Page object calls the EnsureChildControls method for each and every control as well as forthe page.
Each data bound control calls its DataBind method if DataSourceID property is set.Answer option d is incorrect. The Page.PreInit event is used to perform the following tasks:
It checks the IsPostBack property to decide whether this is the first time the page is beingprocessed.
It creates or re-creates dynamic controls. It sets a master page dynamically. It sets the Theme property dynamically. It reads or sets profile property values.
The IsValid property of the BaseValidator class is automatically updated when the validation results are
displayed. The property value returns true to indicate that the associated input control has passed
validation. This property is evaluated only when the Validate method is called on a validation control.
The Validate method of the BaseValidator class performs validation on the associated server user input
control programmatically.
REFERENCE:
.NET Framework 4, Contents:ASP.NET Page Life Cycle Overview
QUESTION NO: 11(A)
You work as an ASP.NET Web Application Developer for Testking Web Inc. The company uses Visual
Studio .NET 2010 as its application development platform. You create an ASP.NET Web application using
.NET Framework 4.0.
The application uses a Microsoft SQL Server 2000 database named MySqlDatabase. MySqlDatabase
includes a table named Products that holds details of the products manufactured by the company. The
Products table has a column named Product_name that holds product names. The application includes a
page named ViewProducts.aspx that holds a DropDownList control named MyDDList.
In the Page_Load event handler, you write code to create a SqlConnection object that represents an
open connection to MySqlDatabase and a SqlCommand by passing a SQL statement that populates
MyDDList with product names from the Products table. You want the code to execute when the page is
loaded and accessed for the first time. However, you do not want the code to execute when the page is
loaded in response to a client postback. In which of the following code blocks will you place the code to
accomplish the task?
http://msdn.microsoft.com/en-us/library/ms178472.aspxhttp://msdn.microsoft.com/en-us/library/ms178472.aspxhttp://msdn.microsoft.com/en-us/library/ms178472.aspxhttp://msdn.microsoft.com/en-us/library/ms178472.aspx -
8/4/2019 63415398 Testking Web 70 515 CSHARP Exam Web Applications Development With Microsoft NET Framework 4 CS
15/26
Total Questions:251
http://www.testkingweb.com/microsoft-70-515.html Page 15 of234
A. if (!IsPostBack)
{
//Place the code here
}
B. if (IsPostBack)
{
//Place the code here
}
C. if (!PostBack)
{
//Place the code here
}
D. if (PostBack)
{
//Place the code here
}
ANSWER:A
EXPLANATION:
In order to accomplish the task, you will place the code within the following code block:
if (!IsPostBack)
{
//Place the code here
}
The IsPostBack property of the Page class can be used to get a value that tells whether a page is loadedin response to a client postback or it is loaded for the first time. It returns true if the page is loaded in
response to a client postback. It returns false if the page is loaded and accessed for the first time.
This property can be used within the Page_Load event handler to execute the code only when the page
is loaded for the first time.
The Page_Load event executes on every request. However, putting the code within the given ifblock
ensures that the code executes only when the IsPostBack property returns false. Otherwise, the code
does not execute.
Answer options c and d are incorrect. There is no such property, method, or event as PostBack in the
.NET Framework.
What is the Page.Load event?
In the Page.Load event, a page is used to call the OnLoad event method on the page. Later, it recursively
performs the same task for each and every child control. The child control performs the same task for
each of its child controls until the page and all controls are loaded. The OnLoad event method is used to
set properties in controls as well as database connections.
-
8/4/2019 63415398 Testking Web 70 515 CSHARP Exam Web Applications Development With Microsoft NET Framework 4 CS
16/26
Total Questions:251
http://www.testkingweb.com/microsoft-70-515.html Page 16 of234
REFERENCE:
MSDN, Contents:Page.IsPostBack Property,The ASP.NET Page Object Model
QUESTION NO: 12(A)
Which property of the Page sets the user interface (UI) ID for the Thread object associated with the
page?
A. Culture
B. InitializeCulture
C. UICulture
D. InitializeUICulture
ANSWER:C
QUESTION NO: 13(A)Which property ofDynamicControl gets or sets the name ofthe field template rendering the data field?
A. UIHint
B. Visible
C. Mode
D. TemplateControl
ANSWER:A
QUESTION NO: 14(A)You work as an ASP.NET Web Application Developer for Testking Web Inc. The company uses Visual
Studio .NET 2010 as its application development platform. You create an ASP.NET Web application using
.NET Framework 4.0. You create a custom server control named logo. You write the following code
segment. (Line numbers are given for reference only.)
01 public class logo : WebControl
02 {
03 public string logourl
04 {
05 get { return _logourl; }
06 set { _logourl = value; }
07 }
08 private string _logourl;
09 // code to override render method
10 }
You want to localize the logourl property.
What will you do to accomplish the task?
http://msdn.microsoft.com/en-us/library/system.web.ui.page.ispostback.aspxhttp://msdn.microsoft.com/en-us/library/system.web.ui.page.ispostback.aspxhttp://msdn.microsoft.com/en-us/library/system.web.ui.page.ispostback.aspxhttp://msdn.microsoft.com/en-us/library/aa479007.aspxhttp://msdn.microsoft.com/en-us/library/aa479007.aspxhttp://msdn.microsoft.com/en-us/library/aa479007.aspxhttp://msdn.microsoft.com/en-us/library/aa479007.aspxhttp://msdn.microsoft.com/en-us/library/system.web.ui.page.ispostback.aspx -
8/4/2019 63415398 Testking Web 70 515 CSHARP Exam Web Applications Development With Microsoft NET Framework 4 CS
17/26
Total Questions:251
http://www.testkingweb.com/microsoft-70-515.html Page 17 of234
A. Add the following code segment before defining the logo class:
[DefaultProperty("logourl")]
B. Add the following code segment before defining the logourl property:
[Localizable(true)]
C. Add the following code segment before defining the logourl property:
[Bindable(true)]
D. Add the following code segment before defining the logourl property:
[Category("Appearance")]
ANSWER:B
EXPLANATION:
You will Add the following code segment before defining the logourl property:
[Localizable(true)]
LocalizableAttribute specifies whether a property should be localized. If a property is marked as
Localizable(true), its value is stored in resource files. The visual designer includes properties marked as
Localizable(true) when localized resources are being serialized.
To localize the logourl property, you should add the Localizable(true) attribute before defining the
logourl property as shown below:
01 public class logo : WebControl
02 {
[Localizable(true)]
03 public string logourl
04 {05 get { return _logourl; }
06 set { _logourl = value; }
07 }
08 private string _logourl;
09 // code to override render method
10 }
Answer option a is incorrect. The DefaultProperty attribute is a design time attribute. If you add this
attribute before the logo class, it will set the logourl property as the default property for the given class.
Answer option c is incorrect. The Bindable attribute is a standard design time attribute for visual
designer, which specifies whether a member is used for binding. If the logourl property is marked
Bindable(true), it will display the logourl property in the DataBindings dialog box.
Answer option d is incorrect. CategoryAttribute specifies the name of the category to which the
property is associated in the visual designer's property browser. If a property is marked
Category(Appearance), the property browser will display the property in the Appearance category when
the page developer uses the category view of the property browser. The CategoryAttribute can be a
string argument corresponding to an existing category in the property browser or a new category.
-
8/4/2019 63415398 Testking Web 70 515 CSHARP Exam Web Applications Development With Microsoft NET Framework 4 CS
18/26
Total Questions:251
http://www.testkingweb.com/microsoft-70-515.html Page 18 of234
REFERENCE:
MSDN - .NET Framework 4, Contents:ASP.NET Web Page Resources Overview
QUESTION NO: 15(A)
You work as an ASP.NET Web Application Developer for Testking Web Inc. The company uses Visual
Studio .NET 2010 as its application development platform. You create an ASP.NET Web application using
.NET Framework 4.0.
You need to retrieve the number of active bugs from the cache if the number is available. However, if
the number is not available in the cache, you call a method named GetLivelyBugs, and save the end
result beneath a cache key named LiveBugs. You must also consider that cached data expires after 45
seconds. You write the following code segment in the application to fulfill the requirements. (Line
numbers are given for reference only.)
01 int numOfLiveBugs = (int)Cache["LiveBugs"];
02 if (!numOfLiveBugs.HasValue)
03 {
04
05 }
06 LiveBugs = numOfLiveBugs.Value;
Which of the following code segments will you place at line 04?
A. int endresult = GetLivelyBugs();
Cache.Insert("LiveBugs", endresult, null,DateTime.Now.AddSeconds(45), Cache.NoAbsoluteExpiration, this.CacheItemUpdateCallback);
numOfLiveBugs = endresult;
B. int endresult = GetLivelyBugs();
Cache.Insert("LiveBugs", endresult, null,
DateTime.Now.AddSeconds(45), Cache.NoSlidingExpiration);
numOfLiveBugs = endresult;
C. int endresult = GetLivelyBugs();
Cache.Insert("LiveBugs", endresult, null,
DateTime.Now.AddSeconds(45), Cache.NoSlidingExpiration, this.CacheItemUpdateCallback);
numOfLiveBugs = endresult;
D. int endresult = GetLivelyBugs();
Cache.Insert("LiveBugs", endresult, null,
DateTime.Now.AddSeconds(45), Cache.NoAbsoluteExpiration);
numOfLiveBugs = endresult;
ANSWER:B
EXPLANATION:
You will place the following code segment at line 04:
http://msdn.microsoft.com/en-us/library/ms227427.aspxhttp://msdn.microsoft.com/en-us/library/ms227427.aspxhttp://msdn.microsoft.com/en-us/library/ms227427.aspxhttp://msdn.microsoft.com/en-us/library/ms227427.aspx -
8/4/2019 63415398 Testking Web 70 515 CSHARP Exam Web Applications Development With Microsoft NET Framework 4 CS
19/26
Total Questions:251
http://www.testkingweb.com/microsoft-70-515.html Page 19 of234
int endresult = GetLivelyBugs();
Cache.Insert(LiveBugs, endresult, null,
DateTime.Now.AddSeconds(45), Cache.NoSlidingExpiration);
numOfLiveBugs = endresult;
where,
LiveBugs specifies the cache key used to reference the object.
endresult specifies the object to be inserted in the cache.
null specifies the file/cache key dependencies for the inserted object.
DateTime.Now.AddSeconds(45) specifies the time at which the inserted object expires and it is removed
from the cache.
The Cache.NoSlidingExpiration field is used as the slidingExpiration parameter in the Insert method call
to disable sliding expirations.
Answer options a and c are incorrect. The CacheItemUpdateCallback delegate is not required here, and
it is also syntactically incorrect. These options use the following signature:
Insert(String, Object, CacheDependency, DateTime, TimeSpan, CacheItemUpdateCallback)
This signature is used to insert an object into the Cache object jointly with dependencies, expiration
policies, and a delegate.
Answer option d is incorrect. The NoAbsoluteExpiration field is used in the absoluteExpiration parameter
in the Insert method call to specify that the item should never expire. The NoAbsoluteExpiration field is
read-only.
REFERENCE:
MSDN Library, Contents:Cache Fields,Cache.Insert method
QUESTION NO: 16(A)
Which property of Nullable gets a value specifying whether the current Nullable object has a
value?
A. Value
B. HasObjectValue
C. HasValue
D. HasObject
ANSWER:C
http://msdn.microsoft.com/en-us/library/e6ys2265.aspxhttp://msdn.microsoft.com/en-us/library/e6ys2265.aspxhttp://msdn.microsoft.com/en-us/library/e6ys2265.aspxhttp://msdn.microsoft.com/en-us/library/system.web.caching.cache.insert.aspxhttp://msdn.microsoft.com/en-us/library/system.web.caching.cache.insert.aspxhttp://msdn.microsoft.com/en-us/library/system.web.caching.cache.insert.aspxhttp://msdn.microsoft.com/en-us/library/system.web.caching.cache.insert.aspxhttp://msdn.microsoft.com/en-us/library/e6ys2265.aspx -
8/4/2019 63415398 Testking Web 70 515 CSHARP Exam Web Applications Development With Microsoft NET Framework 4 CS
20/26
Total Questions:251
http://www.testkingweb.com/microsoft-70-515.html Page 20 of234
QUESTION NO: 17(A)
Which of the following overloaded Insert methods of the Cache class inserts an object into the Cache
with dependencies and expiration policies?
A. Insert(String, Object, CacheDependency, DateTime, TimeSpan, CacheItemUpdateCallback)
B. Insert(String, Object, CacheDependency)
C. Insert(String, Object, CacheDependency, DateTime, TimeSpan)
D. Insert(String, Object, CacheDependency, DateTime, TimeSpan, CacheItemPriority,
CacheItemRemovedCallback)
ANSWER:C
QUESTION NO: 18(A)
Which field of the Cache class is used as the slidingExpiration parameter in the Insert/Add method call to
disable sliding expirations?
A. NoSlidingExpiration
B. NoAbsoluteExpiration
C. DisableSlidingExpiration
D. DisableAbsoluteExpiration
ANSWER:A
QUESTION NO: 19(A)
Which class is used to create dependency relationship between an ASP.NET application Cache objectitem and cache key, a file, an array of either, or a different CacheDependency object?
A. AggregateCacheDependency
B. SqlCacheDependency
C. SqlCacheDependencyAdmin
D. CacheDependency
ANSWER:D
QUESTION NO: 20(A)
You work as an ASP.NET Web Application Developer for Testking Web Inc. The company uses Visual
Studio .NET 2010 as its application development platform. You create an ASP.NET Web application using
.NET Framework 4.0. The application contains numerous Web pages. You need to allow users to create
areas on a Web page named WorkArea that can be updated dynamically and after that incorporated
into a cached page. You also need to provide partial page caching for pages when the bulk of the
content is cached.
What will you do to meet these requirements?
-
8/4/2019 63415398 Testking Web 70 515 CSHARP Exam Web Applications Development With Microsoft NET Framework 4 CS
21/26
Total Questions:251
http://www.testkingweb.com/microsoft-70-515.html Page 21 of234
A. Use the Composite control
B. Use the Substitution control
C. Use the Extended control
D. Use the StyleSheet control
ANSWER:B
EXPLANATION:
You will use the Substitution control. The Substitution Web server control allows a user to create areas
on a Web page that can be updated vigorously and after that incorporated into a cached page. It is used
to specify a section of an output cached page where the user needs to display dynamic content. This
control supplies a simplified solution to partial page caching for pages where the bulk of the content is
cached.
Cached regions run just once and are read from the cache until the cache entry expires or is eliminated.
Dynamic regions run each time when the page is requested. This caching model simplifies the code forpages that are mainly static, because the user does not have to summarize the sections to cache in Web
user controls.
Answer option a is incorrect. A composite control creates a new control by combining existing controls
and components. The control that makes up a composite control is known as a constituent control. It is
normally declared private in the Code editor of a Windows form. Therefore, a user cannot access the
control.
Answer option c is incorrect. An extended control is a user-created control or a custom control that isused to derive an inherited control from an existing Windows Forms control. In other words, it can
retain all the functionality of the existing Windows Forms control. This inherent functionality can then
be extended by adding custom properties, methods, or other features. A custom appearance can also be
added to the graphical user interface of a custom control by overriding the OnPaint method of the base
class.
Answer option d is incorrect. A StyleSheet control is a style sheet control that organizes styles that will
be applied to other ASP.NET server or mobile controls. The style sheet control is placed directly on an
ASP.NET mobile Web page or on a mobile user control page. But, the control is not placed directly in a
Form or a Panel container of the Web page. In a single Web page or a mobile user control, only one
StyleSheet control can exist. In the Design view of the Visual Studio IDE, the control displays its name
and identification on the top line of the control. The control also displays information about the current
template device filter.
REFERENCE:
MSDN - .NET Framework 4, Contents:Substitution Web Server Control Overview
http://msdn.microsoft.com/en-us/library/ms228212.aspxhttp://msdn.microsoft.com/en-us/library/ms228212.aspxhttp://msdn.microsoft.com/en-us/library/ms228212.aspxhttp://msdn.microsoft.com/en-us/library/ms228212.aspx -
8/4/2019 63415398 Testking Web 70 515 CSHARP Exam Web Applications Development With Microsoft NET Framework 4 CS
22/26
Total Questions:251
http://www.testkingweb.com/microsoft-70-515.html Page 22 of234
QUESTION NO: 21(A)
You work as an ASP.NET Web Application Developer for Testking Web Inc. The company uses Visual
Studio .NET 2010 as its application development platform. You are creating an ASP.NET Web application
using .NET Framework 4.0.
You create an ASP.NET server control named ServControl in the application. The server control is used
by other developers. Some developers report that ServControl does not function properly with
ViewState disabled. You are required to ensure that all instances of ServControl work even if ViewState
is disabled.
What will you do?
A. Store state in ControlState instead of ViewState.
B. Serialize the state into an Application state.
C. Require developers to set the session state mode to SQLServer.
D. Require developers to set the session state mode to ASPState.
ANSWER:A
EXPLANATION:
You will store state in ControlState instead of ViewState. Control state is like View state but functionally
independent. Control state retains control property information during multiple round trips to the
server. The control state data is specific to a custom control and is retained even if the View state is
disabled at the page level.
Control state cannot be disabled and it is designed for storing a control's necessary data that must be
available on postback to enable the control to function even when View state has been disabled. Bydefault, the ASP.NET page framework stores Control state in the page in the same hidden element in
which it stores View state. Use Control state only for small amounts of critical data that are necessary
for the control across postbacks. Do not use control state as a substitute to View state.
Answer option b is incorrect. Application state is a collection of user-defined variables that are shared by
an ASP.NET application. These are set and initialized when the Application_OnStart event fires on the
loading of the first instance of the application and are available till the last instance exits. Application
state variables are accessed using the Applications collection, which provides a wrapper for the
application state variables. Application state variables are identified by names.
Answer option c is incorrect. The SQLServer mode is used to store session state in a SQL Server
database. It makes sure that session state is preserved even if the Web application is restarted. It also
makes sure that session state is accessible to many Web servers in a Web farm.
Note: Objects stored in a session state have to be serializable if the mode is SQL Server.
In order to use the SQLServer mode, make sure that the ASP.NET session state database is installed on
-
8/4/2019 63415398 Testking Web 70 515 CSHARP Exam Web Applications Development With Microsoft NET Framework 4 CS
23/26
Total Questions:251
http://www.testkingweb.com/microsoft-70-515.html Page 23 of234
SQL Server. The ASP.NET session state database can be installed using the Aspnet_regsql.exe tool.
However, to configure an ASP.NET application, to use the SQLServer mode, do the following in the
application's Web.config file:
Set the mode attribute of the sessionState element to SQLServer. Set the sqlConnectionString attribute to a connection string for the SQL Server database.
Answer option d is incorrect. In ASPState mode, ASP.NET runs a separate Windows service that
maintains the state variables. Because the state management happens outside the ASP.NET process and
.NET Remoting must be utilized by the ASP.NET engine to access the data, this mode has a negative
impact on performance in comparison to the in-process mode, although this mode allows an ASP.NET
application to be load-balanced and scaled across multiple servers. Since the state management service
runs independent of ASP.NET, the session variables can persist across ASP.NET process shutdowns.
The same problem arises though - since session state server runs as a single instance it is a single point
of failure as far as session state is concerned. This service cannot be load balanced and also imposes
restrictions on types that can be stored in a session variable.
REFERENCE:
MSDN - .NET Framework 4, Contents:ASP.NET State Management Overview
QUESTION NO: 22(A)
Which method ofPage saves any view-state and control-state information for a page?
A. SaveViewState
B. LoadPageStateFromPersistenceMedium
C. SaveControlStateD. SavePageStateToPersistenceMedium
ANSWER:D
QUESTION NO: 23(A)
You work as an ASP.NET Web Application Developer for Testking Web Inc. The company uses Visual
Studio .NET 2010 as its application development platform. You are creating an ASP.NET Web application
using .NET Framework 4.0. The application will use session state in out-of-proc mode. You write the
following code segment. (Line numbers are given for reference only.)
01 public class Employee
02 {
03 public string FirstName
04 {
05 get;
06 set;
07 }
08 public string MiddleName
http://msdn.microsoft.com/en-us/library/75x4ha6s.aspxhttp://msdn.microsoft.com/en-us/library/75x4ha6s.aspxhttp://msdn.microsoft.com/en-us/library/75x4ha6s.aspxhttp://msdn.microsoft.com/en-us/library/75x4ha6s.aspx -
8/4/2019 63415398 Testking Web 70 515 CSHARP Exam Web Applications Development With Microsoft NET Framework 4 CS
24/26
Total Questions:251
http://www.testkingweb.com/microsoft-70-515.html Page 24 of234
09 {
10 get;
11 set;
12 }
13 public string LastName
14 {
15 get;
16 set;
17 }
18 }
You are required to include an attribute to the Employee class to make sure that you are able to save an
instance to session state.
Which of the following attributes will you use?
A. SerializableAttributeB. BindableAttribute
C. DataMemberAttribute
D. DataContractAttribute
ANSWER:A
EXPLANATION:
In the given scenario, you will use SerializableAttribute. The SerializableAttribute class is used to specify
that a class can be serialized. SerializableAttribute can be applied to a type to specify that instances of
this type can be serialized. The CLR throws SerializationException if any type in the graph of objects
being serialized does not contain the SerializableAttribute applied. SerializableAttribute can be appliedeven if the class has also implemented the ISerializable interface to manage the serialization process.
Answer option b is incorrect. BindableAttribute is a standard design time attribute. It specifies whether
the member is typically used for binding. If a property is marked with Bindable(true), the property is
displayed in the DataBindings dialog box in Visual Studio. The property browser infers the value to be
Bindable(false) if a property is not marked with Bindable(true).
Answer option c is incorrect. The DataMemberAttribute class indicates that the member of a type is a
part of a data contract and is serializable. It can be applied to private fields and properties that need to
be serialized. This class is used in conjunction with the DataContractAttribute class.
Answer option d is incorrect. The DataContractAttribute class indicates that the type defines a data
contract and is serializable via a serializer, such as the DataContractSerializer. If the WCF infrastructure is
used to send and receive messages, then the DataContractAttribute should also be applied to any
classes that hold and manipulate data in a message. The DataContractAttribute can be applied to
explicitly enable the DataContractSerializer to serialize and deserialize the data.
-
8/4/2019 63415398 Testking Web 70 515 CSHARP Exam Web Applications Development With Microsoft NET Framework 4 CS
25/26
Total Questions:251
http://www.testkingweb.com/microsoft-70-515.html Page 25 of234
REFERENCE:
MSDN - .NET Framework 4.0, Contents:SerializableAttribute class
QUESTION NO: 24(A)
Which method ofPage loads any saved view-state information to a Page object?
A. LoadPageStateFromPersistenceMedium
B. LoadViewState
C. LoadControl
D. LoadOnSaveStateComplete
ANSWER:A
QUESTION NO: 25(A)
You work as an ASP.NET Web Application Developer for Testking Web Inc. The company uses Visual
Studio .NET 2010 as its application development platform. You create an ASP.NET Web application using
.NET Framework 4.0.
You decide to deploy the application over multiple servers. You will use session state to manage state
information. You want to store information about session state on a remote server. Use the appropriate
option that you will use in the element of the application's Web.config file to accomplish
the task.
ANSWER:
In order to accomplish the task, you will use the mode attribute with the StateServer option as follows:
mode=StateServer
EXPLANATION:
The element is used to configure session state settings for the current application. The
syntax of the sessionState element is as follows:
http://msdn.microsoft.com/en-us/library/system.serializableattribute.aspxhttp://msdn.microsoft.com/en-us/library/system.serializableattribute.aspxhttp://msdn.microsoft.com/en-us/library/system.serializableattribute.aspxhttp://msdn.microsoft.com/en-us/library/system.serializableattribute.aspx -
8/4/2019 63415398 Testking Web 70 515 CSHARP Exam Web Applications Development With Microsoft NET Framework 4 CS
26/26
Total Questions:251
It consists of the following attributes and its related options:
Attribute Option Description
mode It specifies where to store the session state.
Off It specifies that the session state is not enabled.
InProc It specifies that the session state is stored locally.
StateServerIt specifies that the session state is stored on a remote
server.
SQLServerIt specifies that the session state is stored on the SQL
Server.
What is the session state?
The session state is used by InfoPath Forms Services to store the large amount of transient datagenerated while filling out a form. Due to this, front-end Web servers can remain stateless between
round trips, and each postback is not burdened with carrying large amounts of session state information
over narrow bandwidth pipes. Session state can only be used with Web applications that are associated
with a Shared Services Provider (SSP).
When InfoPath Forms Services is configured to use the session state service, all browser sessions are
maintained on the SQL Server database, which uses little network bandwidth, but it has a cumulative
performance impact on the computer running SQL Server.
REFERENCE:
MSDN - .NET Framework 4, Contents:sessionState Element (ASP.NET Settings Schema),ASP.NET Session
State
QUESTION NO: 26(A)
Which event of the Control class occurs when a server control is loaded into the Page object?
A. PreLoad
B. Load
http://msdn.microsoft.com/en-us/library/h6bb9cz9.aspxhttp://msdn.microsoft.com/en-us/library/h6bb9cz9.aspxhttp://msdn.microsoft.com/en-us/library/h6bb9cz9.aspxhttp://msdn.microsoft.com/en-us/library/ms972429.aspxhttp://msdn.microsoft.com/en-us/library/ms972429.aspxhttp://msdn.microsoft.com/en-us/library/ms972429.aspxhttp://msdn.microsoft.com/en-us/library/ms972429.aspxhttp://msdn.microsoft.com/en-us/library/ms972429.aspxhttp://msdn.microsoft.com/en-us/library/ms972429.aspxhttp://msdn.microsoft.com/en-us/library/ms972429.aspxhttp://msdn.microsoft.com/en-us/library/h6bb9cz9.aspx
top related