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

Question: You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application. The application contains an ObservableCollection object named Pictures that contains several Picture objects. Each Picture object contains the Name and PictureFilePath properties. You add a ListBox control to the application. You need to ensure that the pictures are displayed in the ListBox control. Which code fragment should you use?

  1. <ListBox ItemsSource="{Binding Source={StaticResource pictures}}">
    <ListBox.ItemTemplate>
    <DataTemplate>
    <TextBlock><TextBlock.Text>
    <Binding Path="PictureFilePath" />
    </TextBlock.Text></TextBlock>
    </DataTemplate>
    </ListBox.ItemTemplate>
    </ListBox>
  2. <ListBox ItemsSource="{Binding Source={StaticResource pictures}}"> <ListBox.ItemTemplate>
    <DataTemplate>
    <Image Source="{Binding Source={StaticResource pictures}, Path=PictureFilePath}"/> </DataTemplate>
    </ListBox.ItemTemplate>
    </ListBox>
  3. <ListBox ItemsSource="{Binding Source={StaticResource pictures}}"> <ListBox.ItemTemplate>
    <DataTemplate> <TextBlock><TextBlock.Text> <Binding Path="Name" />
    </TextBlock.Text></TextBlock>
    </DataTemplate>
    </ListBox.ItemTemplate> </ListBox>
  4. <ListBox ItemsSource="{Binding Source={StaticResource pictures}}"> <ListBox.ItemTemplate>
    <DataTemplate> <Image Source="{Binding Path=PictureFilePath}"/>
    </DataTemplate> </ListBox.ItemTemplate>
    </ListBox>

Correct Answer: 4


Question: You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application. You declare a class named PictureContainer that has a property named Photo. The Photo property is of the byte[] type and contains an image in the JPEG format. You assign a collection of the PictureContainer elements to the current DataContext. You need to create a ListBox control that displays the images. Which code fragment should you use?

  1. <ListBox DisplayMemberPath="Photo" />
  2. <ListBox DisplayMemberPath="{Binding Photo}" />
  3. <ListBox.ItemTemplate> <DataTemplate>
    <Image Source="{Binding Photo}" /> </DataTemplate> </ListBox.ItemTemplate>
  4. <ListBox.Resources>
    <Style TargetType="{x:Type ListBoxItem}"> <Setter Property="Content">
    <Setter.Value> <Image Source="{Binding Photo}" />
    </Setter.Value>
    </Setter>
    </Style> </ListBox.Resources>

Correct Answer: 3


Question: You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application. You create a class named Person that has a FirstName property and a LastName property. You create a resource that contains a collection of Person objects and assign the family key to it. You add a ListBox control by using the following code fragment. (Line numbers are included for reference only.)
01<ListBox ItemsSource=”{StaticResource family}”>
02<ListBox.ItemTemplate>
03<DataTemplate>
04
05</DataTemplate>
06</ListBox.ItemTemplate>
07</ListBox>
You need to ensure that each item in the ListBox control meets the following requirements:

  • Contains a TextBox that is data-bound to the FirstName property.
  • Contains a TextBox that is data-bound to the LastName property.

Which code fragment should you insert at line 04?

  1. <TextBox Text="{Binding FirstName}" /> <TextBox Text="{Binding LastName}" />
  2. <TextBox Text="{Binding Path=FirstName, Source=DataItem}" /> <TextBox Text="{Binding Path=LastName, Source=DataItem}" />
  3. <TextBox Text="{Binding DataItem.FirstName}" /> <TextBox Text="{Binding DataItem.LastName}" />
  4. <TextBox Text="{PriorityBinding StringFormat=FirstName}" /> <TextBox Text="{PriorityBindingStringFormat=LastName}" />

Correct Answer: 1


Question: You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. The application uses the LINQ ParallelEnumerable.AsParallel method to perform multiple queries on a database. You need to ensure that queries can execute on separate threads concurrently. What should you do?

  1. Use the AsOrdered method.
  2. Use the SelectMany method.
  3. Use the AutoBuffered option in the WithMergeOptions method.
  4. Use the WithExecutionMode method with the ParallelExecutionMode.ForceParallelism parameter.

Correct Answer: 4


Question: You use Microsoft .NET Framework 4 to create an application. The application performs resource-intensive calculations that consist of multiple layers of nested looping. The application will be deployed to servers that contain varying hardware configurations. You need to ensure that the application utilizes CPU resources on the server in the most efficient manner. You want to achieve this goal by using the minimum amount of code. What should you do?

  1. Use multiple System.Threading.Thread objects.
  2. Use the background worker process (BWP).
  3. Use the Thread.BeginInvoke method.
  4. Use the Parallel.For method.

Correct Answer: 4

Tagged . Bookmark the permalink.

Leave a Reply