Exam 70-562 : Microsoft .NET Framework 3.5, ASP.NET Application Development – 12

Question: You work as an application developer at Company.com. You make use of Microsoft .NET Framework 3.5 to create an ASP.NET application. You decide to write the subsequent code segment in the application. (The line numbers is included for reference purposes)
1 <asp:RequiredFieldValidator ID=”val1″ runat=”server” Display=”Dynamic”
2 ControlToValidate=”TxtBox1″
3
4 >
5
6 </asp:RequiredFieldValidator>
7 <asp:ValidationSummary DisplayMode=”List” ID=”valSum1″ runat=”server” />
Management wants you to make sure that the error messages displayed in the validation control is displayed in the validation summary list.
What should you do?

  1. This can be accomplished by adding the following code at line 5: TextBox is empty
  2. This can be accomplished by adding the following code at line 3: Text=”Text is required in the TextBox” ErrorMessage=”valSum1″
  3. This can be accomplished by adding the following code at line 3: ErrorMessage=” Text is required in the TextBox ”
  4. This can be accomplished by adding the following code at line 3: Text=”Text is required in the TextBox”

Correct Answer: 3


Question: You work as a Web Application Developer at Company.com. You make use of Microsoft .NET Framework 3.5 to create an ASP.NET application. You add a CKBox TextBox control to the application and write the subsequent code for confirmation.

Protected Sub _Val1_SrvVal(ByVal source As Object, ByVal args As ServerValidateEventArgs)
Dim _time As DateTime
_time = IIf([String].IsNullOrEmpty(args.Value), DateTime.Now, _
Convert.ToDateTime(args.Value))
args.IsValid = (DateTime.Now - _time).Days < 10
End Sub 

You need to determine a way to confirm the value of CKtxtBox. You thus need to identify the appropriate code that should be added to the Web page. What should you do?

  1. You should consider adding:
    <asp:CompareValidator ID=”CompVal1″ runat=”server” Type=”Date” EnableClientScript=”true” ControlToValidate=”CKBox” Operator=”DataTypeCheck” > </asp:CompareValidator>
  2. You should consider adding:
    <asp:RequiredFieldValidator ID=”ReqVal1″ runat=”server” ControlToValidate=”CKBox” InitialValue=”<%= DateTime.Now; %>” > </asp:RequiredFieldValidator>
  3. You should consider adding:
    <asp:CustomValidator ID=”CustVal1″ runat=”server” ControlToValidate=”CKBox” ValidateEmptyText=”True” onservervalidate=”CustVal1_ServerValidate”> </asp:CustomValidator>
  4. You should consider adding:
    <asp:CompareValidator ID=”CompVal1″ runat=”server” Type=”Date” EnableClientScript=”true” ControlToValidate=”CKBox” ValueToCompare='<%= DateTime.Now; %>’ > </asp:CompareValidator>

Correct Answer: 3


Question: You work as a junior developer at Company.com. You make use of Microsoft .NET Framework 3.5 to create an ASP.NET application. Thereafter you use the BaseValidator class to create a new validation control. The code below indicates the validation logic for the control that was implemented in the Validate method:

Protected Overloads Function Validate(ByVal value As String) As Boolean
...
End Function

You receive an instruction from the senior developer to override the method that validates the value of the related control. You thus need to determine the appropriate override method you should use. What should you do?

  1. You should consider using:
    Protected Overloads Overrides Function EvaluateIsValid() As Boolean
    Dim value As String = GetControlValidationValue(Me.ControlToValidate)
    Dim isValid As Boolean = Validate(value)
    Return isValid
    End Function
  2. You should consider using:
    Protected Overloads Overrides Function EvaluateIsValid() As Boolean
    Dim value As String = GetControlValidationValue(Me.Attributes(“AssociatedControl”))
    Dim isValid As Boolean = Validate(value)
    Return isValid
    End Function
  3. You should consider using:
    Protected Overloads Overrides Function ControlPropertiesValid() As Boolean
    Dim value As String = GetControlValidationValue(Me.ValidationGroup)
    Dim isValid As Boolean = Validate(value)
    Return isValid
    End Function
  4. You should consider using:
    Protected Overloads Overrides Function ControlPropertiesValid() As Boolean
    Dim value As String = GetControlValidationValue(Me.Attributes(“ControlToValidate”))
    Dim isValid As Boolean = Validate(value)
    Me.PropertiesValid = isValid
    Return True
    End Function

Correct Answer: 1


Question: You work as a Web Developer at Company.com. You are in the process of creating a Web application that uses Microsoft ASP.NET 3.5. You add a FileUpload control named CKFile to a page. The directory structure of the Web application is as follows:
* Web Application Root (C:\WebApps\Test)
**** UploadedFiles (D:\Uploads)
UploadedFiles is a virtual directory of the root directory. The physical directory that is linked with the UploadedFiles virtual directory may change in the future. It is required of you to write code to upload the selected file to the UploadedFiles virtual directory of the Web application. You need to determine the appropriate code segment that should be used. What should you identify?

  1. You should use the code segment:
    if (CKFile.HasFile)
    {
    string path = “/Uploads/”;
    CKFile.PostedFile.SaveAs(path + CKFile.FileName);
    }
  2. You should use the code segment:
    if (CKFile.HasFile)
    {
    string path = “~/Uploads/”;
    CKFile.PostedFile.SaveAs(path + CKFile.FileName);
    }
  3. You should use the code segment:
    if (CKFile.HasFile)
    {
    string path = Server.MapPath(“~/Uploads/”);
    CKFile.PostedFile.SaveAs(path + CKFile.FileName);
    }
  4. You should use the code segment:
    if (CKFile.HasFile)
    {
    string path = “Uploads/”;
    CKFile.PostedFile.SaveAs(path + CKFile.FileName);
    }

Correct Answer: 3


Question: You work as a Web Developer at Company.com. You are in the process of creating a Web application that uses Microsoft ASP.NET 3.5. The following markup exists on a page:

<asp:Wizard ID="_wizard" runat="server" ActiveStepIndex="0" OnNextButtonClick="OnNext">
<WizardSteps>
<asp:WizardStep ID="_welcomeStep" runat="server" Title="Welcome">
This wizard helps you create a survey.
</asp:WizardStep>
<asp:WizardStep ID="_chooseQuestionsStep" runat="server" Title="Choose Your Questions">
<asp:GridView ID="_questionsGridView" runat="server"/>
<asp:CheckBox ID="_checkBox" Checked="true" runat=server Text="Create Questions"/>
</asp:WizardStep>
<asp:WizardStep ID="_createQuestionsStep" runat="server" Title="Create Your Questions">
<cc:QuestionEditor ID="_question" runat="server"/><br>
<asp:Button ID="_addQuestion" runat="server"/>
</asp:WizardStep>
<asp:WizardStep ID="_finishStep" runat="server" Title="Done">
</asp:WizardStep>
</WizardSteps>
</asp:Wizard> 

You need to implement the OnNext event handler. You need to ensure that the third step (Create Your Questions) is skipped when the client clears the Create Questions check box option. What should you do?

  1. You should use the code segment:
    protected void OnNext(object sender, WizardNavigationEventArgs e)
    {
    if (e.CurrentStepIndex == _wizard.WizardSteps.IndexOf(_chooseQuestionsStep)
    && !_checkBox.Checked)
    {
    _wizard.MoveTo(_finishStep);
    }
    }
  2. You should use the code segment:
    protected void OnNext(object sender, WizardNavigationEventArgs e)
    {
    if (e.CurrentStepIndex == _wizard.WizardSteps.IndexOf(_chooseQuestionsStep)
    && !_checkBox.Checked)
    {
    _wizard.MoveTo(_finishStep);
    e.Cancel = true;
    }
    }
  3. You should use the code segment:
    protected void OnNext(object sender, WizardNavigationEventArgs e)
    {
    if (e.CurrentStepIndex == _wizard.WizardSteps.IndexOf(_chooseQuestionsStep)
    && _checkBox.Checked)
    {
    e.Cancel = false;
    }
    }
  4. You should use the code segment:
    protected void OnNext(object sender, WizardNavigationEventArgs e)
    {
    if (e.CurrentStepIndex == _wizard.WizardSteps.IndexOf(_chooseQuestionsStep)
    && !_checkBox.Checked)
    {
    _wizard.MoveTo(_finishStep);
    }
    else
    {
    e.Cancel = true;
    }
    }

Correct Answer: 1

Tagged . Bookmark the permalink.

Leave a Reply