Exam 70-511 : Windows Applications Development with Microsoft .NET Framework 4 Part – 12

Question: You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application. You add a TreeView control to show the hierarchical structure of orders and order details. Each order contains an ObservableCollection named OrderDetails. You write the following code fragment. (Line numbers are included for reference only.)
01<Grid>
02<Grid.Resources>
03<src:Orders x:Key=”orders”/>
04<DataTemplate x:Key=”OrderDetailTemplate”>
05<TextBlock Text=”{Binding Path=.}” />
06</DataTemplate>
07
08</Grid.Resources>
09<TreeView DataContext=”{StaticResource orders}”
10ItemsSource=”{Binding Path=.}”
11ItemTemplate=”{StaticResource OrderTemplate}”/>
12 </Grid>
You need to ensure that the TreeView control meets the following requirements:

  • Each order is shown as a TreeView node.
  • The order nodes have order detail nodes as children.
  • The order detail nodes have no children.

Which code fragment should you insert at line 07?

  1. <HierarchicalDataTemplate x:Key="OrderTemplate" DataType="Order" ItemTemplate="{StaticResource OrderDetailTemplate}">
    <TextBlock Text="{Binding Path=.}" />
    </HierarchicalDataTemplate>
  2. <HierarchicalDataTemplate x:Key="OrderTemplate" ItemsSource="{Binding Path=OrderDetails}" ItemTemplate="{StaticResource OrderDetailTemplate}">
    <TextBlock Text="{Binding Path=.}" />
    </HierarchicalDataTemplate>
  3. <HierarchicalDataTemplate x:Key="OrderTemplate" ItemsSource="{Binding Path=orders}" ItemTemplate="{StaticResource OrderDetailTemplate}">
    <TextBlock Text="{Binding Path=.}" />
    </HierarchicalDataTemplate>
  4. <HierarchicalDataTemplate x:Key="OrderTemplate" ItemsSource="{Binding Path=orders}" DataType="Order">
    <TextBlock Text="{Binding Path=.}" />

Correct Answer: 2


Question: You use Microsoft .NET Framework 4 to create a Windows application. You use ClickOnce technology to install the application on computers that run Windows 7 with User Access Control (UAC enabled. The application requires access to environment variables on each computer. You need to ensure that users who do not have administrative permissions can install the application. Which deployment method should you use?

  1. Start from Web.
  2. Install from Web.
  3. Start from network share.
  4. Install from network share.

Correct Answer: 4


Question: You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application. You add a DataGrid named gridContacts that is data-bound to a collection of Contacts. Each item has the ContactName and Phone properties. The DataGrid contains a column named ContactNameColumn that is bound to ContactName. You write the following code fragment.
<DataTemplate x:Key="PhoneTemplate">
<TextBlock Text="{Binding Phone}" />
</DataTemplate>

You need to ensure that the application meets the following requirements:

  • Phone number is shown as a row detail when the row is selected.
  • Only ContactName can be edited.

What should you do?

    • Set RowDetailsVisibilityMode for gridContacts to VisibleWhenSelected.
    • Set the IsReadOnly property for gridContacts to False.
    • Set the IsReadOnly property for ContactNameColumn to False.
    • Set RowDetailsVisibilityMode for gridContacts to VisibleWhenSelected.
    • Set the IsReadOnly property for gridContacts to True.
    • Set the IsReadOnly property for ContactNameColumn to False.
    • Set RowDetailsVisibilityMode for gridContacts to Visible. “Set the IsReadOnly property for gridContacts to False.
    • Set the IsReadOnly property for ContactNameColumn to False.
    • Set RowDetailsVisibilityMode for gridContacts to Collapsed. “Set the IsReadOnly property for gridContacts to True.
    • Set the IsReadOnly property for ContactNameColumn to False.

Correct Answer: 1


Question: You use Microsoft .NET Framework 4 to create a Windows Forms application. You have a DataGridView that is bound to a DataTable containing a column named ProductName. The ProductName column can contain any valid string, except “ProductX,” “ProductY,” “ProductZ.” You need to ensure that only valid entries for ProductName are saved when users edit the DataGridView. Which DataGridView event should you use?

  1. CellBeginEdit
  2. Invalidated
  3. Validated
  4. Validating

Correct Answer: 4


Question: You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application. The application contains three text boxes named txtAddress, txtCity, and txtState. You need to ensure that the postal code is automatically set based on the information typed by users in the text boxes. You also need to ensure that the complete address is displayed in a TextBlock control. Which code fragment should you use?

  1. <TextBlock DataContext="txtAddress"><TextBlock.Text>
    <Binding Path="Text" Converter="{StaticResource adrsConverter}"/>
    </TextBlock.Text></TextBlock> <TextBlock DataContext="txtCity"><TextBlock.Text> <Binding Path="Text" Converter="{StaticResource cityConverter}"/>
    </TextBlock.Text></TextBlock> <TextBlock DataContext="txtState"><TextBlock.Text> <Binding Path="Text" Converter="{StaticResource stateConverter}"/>
    </TextBlock.Text></TextBlock>
  2. <TextBlock Margin="10" Name="textBlock">
    <TextBlock.Text> <MultiBinding Converter="{StaticResource myConverter}">
    <Binding ElementName="txtAddress" Path="Value"/>
    <Binding ElementName="txtCity" Path="Value"/>
    <Binding ElementName="txtState" Path="Value"/>
    </MultiBinding> </TextBlock.Text>
    </TextBlock>
  3. <TextBlock Margin="10" Name="textBlock">
    <TextBlock.Text> <MultiBinding Converter="{StaticResource myConverter}">
    <Binding ElementName="txtAddress" Path="Text"/>
    <Binding ElementName="txtCity" Path="Text"/>
    <Binding ElementName="txtState" Path="Text"/>
    </MultiBinding> </TextBlock.Text> </TextBlock>
  4. <TextBlock DataContext="txtAddress"><TextBlock.Text> <Binding Path="Value" Converter="{StaticResource adrsConverter}"/>
    </TextBlock.Text></TextBlock>
    <TextBlock DataContext="txtCity"><TextBlock.Text>
    <Binding Path="Value" Converter="{StaticResource cityConverter}"/>
    </TextBlock.Text></TextBlock>
    <TextBlock DataContext="txtState"><TextBlock.Text>
    <Binding Path="Value" Converter="{StaticResource stateConverter}"/>
    </TextBlock.Text></TextBlock>

Correct Answer: 3

Tagged . Bookmark the permalink.

Leave a Reply