Microsoft TS: Windows Applications Development with Microsoft .NET Framework 4 Sample Questions:
1. You are migrating a Windows Forms application to a Windows Presentation Foundation (WPF) application.
You need to create a window to display controls. The controls must be positioned by using fixed coordinates.
Which control should you use in the WPF application?
A) StackPanel
B) Canvas
C) WrapPanel
D) Grid
E) UniformGrid
2. You are developing a Windows Presentation Foundation (WPF) application.
The application contains the following code in the code-behind file for an application window. (Line numbers are included for reference only.)
01 Dim stack As StackPanel = New StackPanel() 02 Content = stack 03 For i As Integer = 0 To 9 04 Dim btn As Button = New Button () 05 btn.Name = Convert.ToChar (Asc("A") + i) .ToString () 06 btn.Content - btn.Name "says" "Click me1" 07 08 Next
You need to ensure that all of the Button controls that are defined in this code segment appear in the application window.
Which code segment should you insert at line 07?
A) Content = New Button ()
With {Name = (Asc("A") + i) .ToString(), .
Content = (i & " says Click me'").ToString()}
B) Content = btn
C) stack.Children.Add (btn)
D) stack.Children.Insert (i + 1, btn)
3. You use Microsoft .NET Framework 4 to create a Windows Forms application.
You need to allow the user interface to use the currently configured culture settings in the Control Panel.
Which code segment should you use?
A) Thread.CurrentThread.CurrentCulture = CultureInfo.InstalledUICulture
B) Thread.CurrentThread.CurrentCulture = Thread.CurrentThread.CurrentUICulture
C) Thread.CurrentThread.CurrentUICulcure = CultureInfo.InstalledUICulture
D) Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture
4. You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application.
The application uses the drag-and-drop functionality.
You need to identify which enumeration member must be used to meet the following requirements:
---
Ensure that the data from the drag source can be copied. Ensure that the data from the drag source can be moved. Ensure that the target can be scrolled while you are dragging.
Which enumeration member should you identify?
A) DragAction.Cancel
B) DragDropEffects.All
C) DragDropEffects.None
D) DragAction.Drop
5. You are developing a Windows Presentation Foundation (WPF) application. You have a class named Orders, which contains OrderId and ShipOn properties. You place a control in the MainWindow.xaml file, as follows. (Line numbers are included for reference only.)
When you run the application, the ComboBox control displays the class name for every row.
You need to ensure that the ComboBox control displays the OrderId and ShipOn values in columns.
Which markup segment should you add at line 03?
A) <ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<CoIumndefinltion />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column-"0" Text="{Binding ShipOn}"/>
<TextBlock Grid.Column"0" Text="{Binding OrderId}"/></Grid>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
B) <ItemsControl.Itemlempiate>
<DataTempIate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinicion />
</Grid.ColumnDefinitions>
<TextBlock Grid.Coxumn"0" Text="{Binding OrderId}"/>
<TextBlock Grid.Coxumn"1" Text="{Binding ShipOn}"/></Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
C) <ItemsControl.ItemTempIate>
<DataTemplate>
<Grid>
<TextBlock Text="{Binding OrderId}"/>
<TextBlock Text="{Binding ShipOn}"/>
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate
D) <ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<Grid>
<TextBlock Text ="{Binding OrderId}/ >
<TextBlock Text ="{Binding ShipOn}/ >
</Grid>
</ItemsPanelTemplate>
</ItemsControl.ItemPanel>
Solutions:
Question # 1 Answer: B | Question # 2 Answer: C | Question # 3 Answer: D | Question # 4 Answer: B | Question # 5 Answer: B |