Learn About the Visual Basic Version of Microsoft’s Exam 70-568

These practice test questions from MeasureUp are based on the Visual Basic (VB) version of Microsoft’s exam 70-568: Upgrade: Transition your MCPD Application Developer Skills to MCPD Enterprise Application Developer 3.5, Part 1 .

The audience for this exam includes individuals who have previously attained certification as MCPD Enterprise Application Developers on .NET Framework 2.0. Experience using Visual Studio 2008 and .NET Framework 3.5 and in developing ASP.NET applications and Windows Forms applications will help you prepare for this exam.

Candidates who pass exam 70-568 earn credit toward the MCPD : Enterprise Application Development 3.5 certification.

MeasureUp offers practice tests for both the C# version and the VB  version of exam 70-568.

Objective: Enhancing Usability.
SubObjective: Implement globalization and localization for a Windows Forms application.

Single answer, multiple choice

You are developing a Microsoft Windows Forms application that contains localized resources for the Arabic language.

You need to display all currencies in the format used by Egypt.

Which code segment should you use?

A.    Thread.CurrentThread.CurrentCulture = New CultureInfo("ar-EG")
B.    Thread.CurrentThread.CurrentUICulture = New CultureInfo("ar-EG")
C.    Thread.CurrentThread.CurrentUICulture = New CultureInfo("ar")
D.    Thread.CurrentThread.CurrentCulture = New CultureInfo("ar")

Answer:
A

Tutorial:
You should set the CurrentCulture property of the current Thread instance to a CultureInfo instance that represents the ar-EG culture. The CurrentCulture property specifies the culture to use for formatting numbers, currencies, dates and times. A culture consists of both a language and a region. This means the culture ar-EG consists of the Arabic language in Egypt. Although a language can span multiple regions, each region might use a different format for currencies, numbers, dates and times.

You should not set the CurrentUICulture property. This property identifies the culture to be used by a resource manager to load localized resources.

You should not specify the value ar to the constructor of CultureInfo. You must specify a specific culture because different regions use different formats for numbers, currencies, dates and times. The ar value represents a neutral culture for the Arabic language.

References:
How to: Set the Culture and UI Culture for Windows Forms Globalization
MSDN
http://msdn.microsoft.com/en-us/library/b28bx3bh.aspx

Objective: Deploying Windows Forms Controls.
SubObjective: Create a composite Windows Forms control.

Single answer, multiple choice

You are developing a custom user control that provides wizard-like functionality. The class that represents the control is named Wizard. It exists in the Framework.Controls namespace. You create a bitmap that will be used to represent the Wizard control on the Toolbox. You store the bitmap as an embedded resource in a file named Wizard.bmp in the Resources directory of the project.

You need to apply the ToolboxBitmap attribute to the class.

Which code segment should you use?

A. <ToolboxBitmap(GetType(Wizard), "Resources.Wizard.bmp")> _
B. <ToolboxBitmap(GetType(Wizard))> _
C. <ToolboxBitmap("Resources.Wizard.bmp")> _
D. <ToolboxBitmap("Wizard")> _

Answer:
A

Tutorial:
You should apply the two-parameter overload of the ToolboxBitmap attribute to the class. This overload specifies a fully-qualified name of a bitmap resource to use. The first parameter is a Type instance whose assembly contains the bitmap. Because the bitmap is part of the same project as the Wizard class, by specifying the Wizard type you indicate the bitmap should be loaded from the same assembly. The second parameter identifies the resource name, which might include part of the resource namespace. A resource namespace is equal to an assembly's default namespace plus the subfolder names that contain the resource delimited by periods plus the resource name. This means the second parameter must identify subfolder names delimited by periods plus the resource name. In this scenario, you should specify Resources.Wizard.bmp.

You should not apply the single-parameter overload of the ToolboxBitmap attribute that specifies a Type instance. This overload requires the resource namespace of the bitmap be the same as the namespace of the class to which the attribute is applied. However, in this scenario, the resource namespace of the bitmap is not the same as that of the Wizard class.

You should not apply the single-parameter overload of the ToolboxBitmap attribute that specifies a String instance. The String parameter overload specifies the physical file location of the bitmap.

References:
How to: Provide a Toolbox Bitmap for a Control
MSDN
http://msdn.microsoft.com/en-us/library/4wk1wc0a.aspx

Objective: Programming Web Applications.
SubObjective: Work with ASP.NET Intrinsic Objects.

Multiple answers, multiple choice

You create a Web application by using Microsoft ASP.NET 3.5. The following HTML element exists on an ASP.NET page:

 <input type="hidden" name="HiddenField"/>

You need to retrieve the value of the element in the code-behind class.

Which code segment should you use? (Each correct answer presents a complete solution. Choose two.)

A.    Dim value = Application("HiddenField")
B.    Dim value = Request.Form("HiddenField")
C.    Dim value = Context("HiddenField")
D.    Dim value = (CType(Page.FindControl("HiddenField"), HtmlInputHidden)).Value
E.    Dim value = Request.Params("HiddenField")

Answers:
B, E

Tutorial:
You should access the HiddenField item from the Request.Form collection. This collection contains all HTML form fields that are rendered by the page. This includes HTML Input elements.

Alternatively, you can access the HiddenField item of the Request.Params collection. This collection contains HTML form fields, query string paramers, HTTP server variables and cookies.

You should not access items of the current HttpApplicationState instance. An HttpApplicationState instance is created for each instance of an ASP.NET application. However, HTML form fields are not automatically stored in HttpContext instances.

You should not access items of the current HttpContext instance. An HttpContext instance is created during each HTTP request to an application. However, HTML form fields are not automatically stored in HttpContext instances.

You should not call the FindControl method of the Page class to retrieve the HTML Input element. The FindControl method finds server controls only. In this scenario, the HTML Input element is not a server control because it is missing the runat=server attribute.

References:
HttpRequest.Form Property
MSDN
http://msdn.microsoft.com/en-us/library/system.web.httprequest.form.aspx

HttpRequest.Params Property
MSDN
http://msdn.microsoft.com/en-us/library/system.web.httprequest.params.aspx

ASP.NET Intrinsic Objects
MSDN
http://msdn.microsoft.com/en-us/library/x6w6xys5(VS.71).aspx

Objective: Working with Data and Services.
SubObjective: Manipulate data by using DataSet and DataReader objects.

Single answer, multiple choice

You create a Web application by using Microsoft ASP.NET 3.5. You create a DataSet instance named dataSet from the following XML data:

<Vehicles>
 <Car Vin="1HGCDXXX4">
 <Car Vin="1TTGCDXXX3">
 <Truck Vin="1SVCDXXX2">
 <Suv Vin="1SVCDXXX0">
 <Minivan Vin="1TTGCDXXX1">
 <Minivan Vin="1HGCDXXX5">
</Vehicles> 

In this XML, the Vin attribute represents a vehicle identification number (VIN) for a vehicle. A method named ProcessVin accepts a VIN as a parameter.

You need to create a DataTableReader instance and call the ProcessVin method for each vehicle.

Which code segment should you use?

A.    Using reader As dataSet.CreateDataReader()
    Do
        While reader.Read()
            ProcessVin(reader("Vin"))
        End While
    Loop While reader.NextResult()
End Using

B.    Using reader As dataSet.CreateDataReader()
    While reader.NextResult()
        reader.Read()
        ProcessVin(reader.GetString(0))
    End While
End Using

C.    Using reader As dataSet.CreateDataReader()
    Do
        ProcessVin(reader("Vin"))
    Loop While (reader.NextResult())
End Using

D.    Using reader As dataSet.CreateDataReader()
    Do
        While reader.NextResult()
            ProcessVin(reader.GetString(0))
        End While
    Loop While (reader.Read())
End Using

Answer:
A

Tutorial:
You should use a Do…While loop to navigate each result set in the DataSet instance. To navigate each result set, you must first create a DataTableReader instance by calling the CreateDataReader method of the DataSet class. This creates a reader that can be used to navigate the rows of each DataTable instance in the DataSet instance. When you first call the method, the reader is positioned on the first DataTable instance. By calling the Read method, you position the reader on the first row. You should then call the ProcessVin method for that row. To access the Vin field of that row, you can call the GetString method and pass the value 0 as a parameter, or you can pass the value Vin to the property indexer. If you call the GetString method, the value 0 specifies the first field in the row. You should call the Read method for each row. You can accomplish this by placing the call to the Read method in a While loop. If the Read method returns False, then there are no more rows to read in the current result set.

You should not call the NextResult method of the DataTableReader instance inside a While loop before processing the rows of the first result set. When you create the DataTableReader instance, it is positioned on the first result set. If you call the NextResult method immediately after creating the instance, you position the reader on the second result set.

You should not attempt to access the fields of a row before you call the Read method of the DataTableReader class. The Read method advances the reader to the next row of a result set. When you create the DataTableReader instance, it is positioned on the first result set, but it is not positioned on the first row. You must call the Read method to advance the reader to the first row.

You should not call the Read method of the DataTableReader instance inside a Do…While loop and attempt to access the rows inside the loop. You must call the Read method before accessing the rows. Also, you should call the NextResult method only after the Read method returns False, which indicates there are no more rows in the current result set.

References:
DataTableReader (ADO.NET)
MSDN
http://msdn.microsoft.com/en-us/library/ws7ad65f.aspx

Navigating DataTables (ADO.NET)
MSDN
http://msdn.microsoft.com/en-us/library/z071789y.aspx

Creating a DataReader (ADO.NET)
MSDN
http://msdn.microsoft.com/en-us/library/3fhe1t3x.aspx

Objective: Working with ASP.NET AJAX and Client-Side Scripting.
SubObjective: Implement Web Forms by using ASP.NET AJAX.

Single answer, multiple choice

You create a Web application by using Microsoft ASP.NET 3.5. The following markup exists on a page:

<asp:ScriptManager ID="_scriptManager" runat="server"/>
<asp:UpdatePanel ID="_updatePanel" runat="server">
<ContentTemplate>
<asp:GridView ID="_gridView" runat="server"/>
<asp:Button ID="_submitButton" runat="server" Text="Submit"/>
<asp:Button ID="_refreshButton" runat="server" Text="Refresh"/>
</ContentTemplate>
</asp:UpdatePanel>

You need to write code so the _refreshButton control causes the entire page to be posted back.

Which code segment should you use?

A.    Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
 _scriptManager.RegisterAsyncPostBackControl(_refreshButton)
End Sub

B.    Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
 Page.RegisterRequiresPostBack(_refreshButton)
End Sub

C.    Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
 _scriptManager.RegisterPostBackControl(_refreshButton)
End Sub

D.    Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
 Page.RegisterRequiresRaiseEvent(_refreshButton)
End Sub

Answer:
C

Tutorial:
You should call the RegisterPostBackControl method of the ScriptManager class. This method instructs a control to always cause a full post back instead of an asynchronous post back. By default, controls that are children of an UpdatePanel control perform asynchronous post backs if the ChildrenAsTriggers property of the UpdatePanel control is set to True, which is the default value. To prevent a child control from performing an asynchronous post back, you must either set ChildrenAsTriggers to False or call the RegisterPostBackControl method for the child control.

You should not call the RegisterAsynchronousPostBackControl method of the ScriptManager class. This method instructs a control to always perform an asynchronous post back.

You should not call the RegisterRequiresPostBack method of the Page class. This method instructs the page processor to call methods of the IPostBackDataHandler interface implemented by a control when a page post back occurs. It does not matter whether the post back is a full post back or an asynchronous post back.

You should not call the RegisterRequiresRaiseEvent method of the Page class. This method instructs the page processor to call the RaisePostBackEvent method of the IPostBackEventHandler interface implemented by a control when a page post back occurs. It does not matter whether the post back is a full post back or an asynchronous post back.

References:
ScriptManager Enables AJAX In Your Web Apps
MSDN
http://msdn.microsoft.com/en-us/magazine/cc163354.aspx

ScriptManager.RegisterPostBackControl Method
MSDN
http://msdn.microsoft.com/en-us/library/system.web.ui.scriptmanager.registerpostbackcontrol.aspx

ScriptManager.RegisterAsyncPostBackControl Method
MSDN
http://msdn.microsoft.com/en-us/library/system.web.ui.scriptmanager.registerasyncpostbackcontrol.aspx

Like what you see? Share it.Share on Google+Share on LinkedInShare on FacebookShare on RedditTweet about this on TwitterEmail this to someone
cmadmin

ABOUT THE AUTHOR

Posted in Certification|

Comment: