2013微軟認(rèn)證考試練習(xí)題及答案(31)

字號(hào):

為大家收集整理了《2013微軟認(rèn)證考試練習(xí)題及答案(31)》供大家參考,希望對(duì)大家有所幫助?。?!
    QUESTION 71
    You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
    You write the following code segment to create a client-script function. (Line numbers are included for reference only.)
    01 function updateLabelControl(labelId, newText) {
    02 var label = $find(labelId);
    03 label.innerHTML = newText;
    04 }
    The client script function uses ASP.NET AJAX and updates the text of any Label control in the Web form.
    When you test the client script function, you discover that the Label controls are not updated.
    You receive the following JavaScript error message in the browser: "’null’ is null or not an object." You need to resolve the error.
    What should you do?
    A.Replace line 03 with the following line of code.
    label.innerText = newText;
    B.Replace line 02 with the following line of code.
    var label = $get(labelId);
    C.Replace line 02 with the following line of code.
    var label = Sys.UI.DomElement.getElementById($get(labelId));
    D.Replace line 02 with the following line of code.
    var label = Sys.UI.DomElement.getElementById($find(labelId));
    Answer: B
    QUESTION 72
    You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
    You create a Web form by using ASP.NET AJAX.
    You write the following client-script code fragment to handle the exceptions thrown from asynchronous postbacks. (Line numbers are included for reference only.)
    01
    You need to ensure that the application performs the following tasks:
    Use a common clien-script function named errorHandler.
    Update a Label control that has an ID named lblEror with the error message.
    Prevent the browser from displaying any message box or Javascript error What should you do?
    A.Insert the following code segment at line 06.
    pageMgr.add_endRequest(errorHandler);
    Insert the following code segment at line 11.
    if (args.get_error() != null) {
     $get(’lblError’).innerHTML = args.get_error().message;
     args.set_errorHandled(true);
    }
    B.Insert the following code segment at line 06.
    pageMgr.add_endRequest(errorHandler);
    Insert the following code segment at line 11.
    if (args.get_error() != null) {
    $get(’lblError’).innerHTML = args.get_error().message;
    }
    C.Insert the following code segment at line 06.
    pageMgr.add_pageLoaded(errorHandler);
    Insert the following code segment at line 11.
    if (args.get_error() != null) {
    $get(’lblError’).innerHTML = args.get_error().message;
    args.set_errorHandled(true);
    }
    D.Insert the following code segment at line 06.
    pageMgr.add_pageLoaded(errorHandler); Insert the following code segment at line 11.
    if (args.get_error() != null) {
    $get(’lblError’).innerHTML = args.get_error().message;
    }
    Answer: A
    QUESTION 73
    You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
    You create a Web form by using ASP.NET AJAX.
    The Web form contains the following code fragment. (Line numbers are included for reference only.)
    01
    10
    11 12 runat="server" />
    13
    You need to create and initialize a client behavior named MyCustomBehavior by using the initComponents function. You also need to ensure that MyCustomBehavior is attached to the TextBox1 Textbox control.
    Which code segment should you insert at line 06?
    A.$create(MyCustomBehavior, null, null, null, ’TextBox1’);
    B.$create(MyCustomBehavior, null, null, null, $get(’TextBox1’));
    C.Sys.Component.create(MyCustomBehavior, ’TextBox1’, null, null, null);
    D.Sys.Component.create(MyCustomBehavior, $get(’TextBox1’), null, null, null);
    Answer: B
    QUESTION 74
    You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
    You create a login Web form by using the following code fragment.
    When a user clicks the btnLogin Button control, the login() client-side script is called to authenticate the user. The credentials provided in the TextBox controls are used to call the client-side script.
    You also add the following client-script code fragment in the Web form. (Line numbers are included for reference only.)
    01
    The ASP.NET application is configured to use Forms Authentication. The ASP.NET AJAX authentication service is activated in the Web.config file.
    You need to ensure that the following workflow is maintained:
    On successful authentication, the onLoginCompleted clien-script function is called to notify the user.
    On failure of authentication, the onLoginFailed clien-script function is called to display an error message.
    Which code segment should you insert at line 06?
    A.var auth = Sys.Services.AuthenticationService;
    auth.login(username, password, false, null, null,onLoginCompleted, onLoginFailed, null);
    B.var auth = Sys.Services.AuthenticationService;
    auth.set_defaultFailedCallback(onLoginFailed);
    var validCredentials = auth.login(username, password, false, null, null, null, null, null);
    if (validCredentials)
     onLoginCompleted(true, null, null);
    else onLoginCompleted(false, null, null);
    C.var auth = Sys.Services.AuthenticationService;
    auth.set_defaultLoginCompletedCallback(onLoginCompleted);
    try {
     auth.login(username, password, false, null, null, null, null, null);
    } catch (err) {
     onLoginFailed(err, null, null);
    }
    D.var auth = Sys.Services.AuthenticationService;
    try {
    var validCredentials = auth.login(username, password, false, null, null, null, null, null);
    if (validCredentials) onLoginCompleted(true, null, null);
    else onLoginCompleted(false, null, null);
    } catch (err) {
    onLoginFailed(err, null, null);
    }
    Answer: A
    QUESTION 75
    You create a Microsoft ASP.NET Web application by using the Microsoft .NET Framework version 3.5.
    The application contains the following device filter element in the Web.config file.
    
    The application contains a Web page that has the following image control. (Line numbers are included for reference only.)
    01
    02
    03

    You need to ensure that the following conditions are met:
    The imgCtrl Image control displays the highRes.jpg file if the Web browser supports html
    The imgCtrl Image control displays lowRes.gif if the Web broser does not support html.
    Which DeviceSpecific element should you insert at line 02?
    A.
    
    
    

    B.
    
    
    

    C.
    
    
    

    D.
    
    
    

    Answer: A