2016年微软认证考试练习题及答案
1.You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
All the content pages in the application use a single master page. The master page uses a static navigation menu to browse the site.
You need to ensure that the content pages can optionally replace the static navigation menu with their own menu controls.
What should you do?
A.
Add the following code fragment to the master page
Add the following code segment to the Page_Load event of the content page
PlaceHolder placeHolder = Page.Master.FindControl("MenuPlaceHolder") as PlaceHolder;
Menu menuControl = new Menu();
placeHolder.Controls.Add(menuControl);
B.
Add the following code fragment to the master page
Add the following code fragment to the content page
C.
Add the following code fragment to the master page
Add the following code segment to the Page_Load event of the content page
ContentPlaceHolder placeHolder = Page.Master.FindControl("MenuPlaceHolder") as ContentPlaceHolder;
Menu menuControl = new Menu();
placeHolder.Controls.Add(menuControl);
D.
Add the following code fragment to the master page
Add the following code fragment to the content page
Answer: B
2.You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
You plan to add a custom parameter in the SqlDataSource control.
You write the following code fragment.
You write the following code segment to create a custom parameter class.
public class DayParameter : Parameter { }
You need to ensure that the custom parameter returns the current date and time.
Which code segment should you add to the DayParameter class?
A.
protected DayParameter() : base("Value", TypeCode.DateTime, DateTime.Now.ToString()) {
}
B.
protected override void LoadViewState(object savedState) {
((StateBag)savedState).Add("Value", DateTime.Now); }
C.
protected override object Evaluate(HttpContext context, Control control) { return DateTime.Now; }
D.
protected override Parameter Clone() {
Parameter pm = new DayParameter(); pm.DefaultValue = DateTime.Now; return pm; }
Answer: C
3.You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. The application has an ASPX page named ErrorPage.aspx.
You plan to manage the unhandled application exceptions.
You need to perform the following tasks:
Display the ErrorPage.aspx page Write the exceptioninformation in the Event log file.
Which two actions should you perform? (Each correct answer presents part of the solution.
Choose two.)
A.
Add the following code fragment to the Web.config file.
B.
Add the following code fragment to the Web.config file.
C.
Add the following code segment to the Global.asax file.
void Application_Error(object sender, EventArgs e)
{
Exception exc = Server.GetLastError();
//Write Exception details to event log
}
D.
Add the following code segment to the ErrorPage.aspx file.
void Page_Error(object sender, EventArgs e)
{
Exception exc = Server.GetLastError();
//Write Exception details to event log
Server.ClearError();
}
Answer: AC
4.You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
The application contains two Web pages named OrderDetails.aspx and OrderError.htm.
If the application throws unhandled errors in the OrderDetails.aspx Web page, a stack trace is displayed to remote users.
You need to ensure that the OrderError.htm Web page is displayed for unhandled errors only in the OrderDetails.aspx Web page.
What should you do?
A.
Set the Page attribute for the OrderDetails.aspx Web page in the following manner.
Add the following section to the Web.config file.
B.
Set the Page attribute for the OrderDetails.aspx Web page in the following manner.
Add the following section to the Web.config file.
C.
Set the Page attribute for the OrderDetails.aspx Web page in the following manner.
Add the following section to the Web.config file.
D.
Set the Page attribute for the OrderDetails.aspx Web page in the following manner.
Add the following section to the Web.config file.
Answer: C
Section: (none)
Explanation/Reference:
Debug
Indicates whether the page should be compiled with debug symbols. true if the page should be compiled with debug symbols; otherwise, false. Because this setting affects performance, you should only set the attribute to true during development.
ErrorPage
Defines a target URL for redirection if an unhandled page exception occurs.
5.You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
You write the following code fragment.
You need to ensure that when you click the btnSubmit Button control, each Label control value is asynchronously updatable.
Which code segment should you use?
A.
protected void btnSubmit_Click(object sender, EventArgs e) {
Label1.Text = "Label1 updated value";
Label2.Text = "Label2 updated value";
Label3.Text = "Label3 updated value";
}
B.
protected void btnSubmit_Click(object sender, EventArgs e) {
Label1.Text = "Label1 updated value";
Label2.Text = "Label2 updated value";
ScriptManager1.RegisterDataItem(Label3, "Label3 updated value");
}
C.
protected void btnSubmit_Click(object sender, EventArgs e) {
ScriptManager1.RegisterDataItem(Label1, "Label1 updated value");
ScriptManager1.RegisterDataItem(Label2, "Label2 updated value");
Label3.Text = "Label3 updated value";
}
D.
protected void btnSubmit_Click(object sender, EventArgs e) {
Label1.Text = "Label1 updated value";
Label2.Text = "Label2 updated value";
ScriptManager1.RegisterAsyncPostBackControl(Label3); Label3.Text = "Label3 updated value";
}
Answer: B
Section: (none)
Explanation/Reference:
Use the RegisterDataItem method to send data from the server to the client during asynchronous postbacks, regardless of whether the control receiving the data is inside an UpdatePanel control.
Use RegisterAsyncPostBackControl for Registers a control as a trigger for asynchronous postbacks.
-
2016年计算机二级考试须知及备战攻略
现在已经步入九月份了,计算机二级又悄悄来临,那么本月24日-27日的计算机等级考试你准备好了吗?下面本站小编为大家分享计算机等级考试须知及考试攻略,一起来学习吧!01.基本介绍全国计算机等级考试(NationalComputerRankExamination,简称NCRE),是经原国家教育委员会(...
-
2017年计算机二级mos office考试试题及答案「精选」
计算机应用是计算机学科与其他学科相结合的边缘学科,是计算机学科的组成部分。下面是小编整理的关于计算机二级mosoffice考试试题及答案,希望大家认真阅读!1[单选题]下列叙述中正确的是().A.结点中具有两个指针域的链表一定是二叉链表B.结点中具有两个指针域的链...
-
2017年计算机二级C语言模拟题及答案
1.1单选题1.下列变量名中,非法的是(C)。A.A25_car-str2.下列常量中,十六进制int型常量是(A)。A.0x5fB.x2aC.046D.7a3.下列常量中,不是字符常量的是(B)。A.'\n'B."y"C.'x'D.'\7'4.在函数体内定义了下述变量a,a的存储类为(D)。inta;A.寄存...
-
H3C中小企业无线解决方案
根据中国互联网络信息中心(CNNIC)公布的数据,截至2008年6月底,中国网民数量达到了2.53亿,首次大幅度超过美国,跃居世界第一位。中国也真正地步入网络时代。其中WLAN网络在提高企业效率、降低企业成本、提高用户满意度等方面有着突出的作用。那么随着网络使用范围的...