web analytics

First Try 70-511 Dumps From Passleader and First Pass The 70-511 Exam (1-20)

QUESTION 1
You use Microsoft .NET Framework 4 to create a Windows Forms application. You add a new class named Customer to the application. You select the Customer class to create a new object data source. You add the following components to a Windows Form:
–  A BindingSource component named customerBindingSource that is data-bound to the Customer object data source.
– A set of TextBox controls to display and edit the Customer object properties. Each TextBox control is data-bound to a property of the customerBindingSource component.
–  An ErrorProvider component named errorProvider that validates the input values for each TextBox control.
You need to ensure that the input data for each TextBox control is automatically validated by using the ErrorProvider component. Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)

A.    Implement the validation rules inside the Validating event handler of each TextBox control by throwing an exception when the value is invalid.
B.    Implement the validation rules inside the TextChanged event handler of each TextBox control by throwing an exception when the value is invalid.
C.    Implement the validation rules inside the setter of each property of the Customer class by throwing an exception when the value is invalid.
D.    Add the following code segment to the InitializeComponent method of the Windows Form.
this.errorProvider.DataSource = this.customerBindingSource;
E.    Add the following code segment to the InitializeComponent method of the Windows Form.
this.errorProvider.DataSource = this.customerBindingSource.DataSource; this.errorProvider.DataMember = this.customerBindingSource.DataMember;

Answer: CD

QUESTION 2
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application. The application contains a ListBox control named IbxItems that is data-bound to a collection of objects. Each object has a DisplayValue property. You add a Button control to the application. You need to ensure that the Content property of the Button control is data-bound to the DisplayValue property of the selected item of IbxItems. Which binding expression should you use?

A.    {Binding ElementName= IbxItems, Source=SelectedItem, Path=DisplayValue}
B.    {Binding Source=lbxItems, ElementName=SelectedItem, Path=DisplayValue}
C.    {Binding ElementName=lbxItems, Path=SelectedItem.DisplayValue}
D.    {Binding Source=lbxItems, Path=SelectedItem.DisplayValue}

Answer: C

QUESTION 3
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application. You write the following code fragment.
< TextBox Text=”{Binding Path=StringMember} ” / >
You need to ensure that the StringMember property of the data-bound object is updated immediately when the user types in the TextBox control.
Which binding expression should you use?

A.    { Binding Path=StringMember, Mode=TwoWay }
B.    { Binding Path=StringMember, NotifyOnSourceUpdated=True }
C.    { Binding Path-StringMember, NotifyOnTargetUpdated=True }
D.    { Binding Path=StringMember, UpdateSourceTrigger=PropertyChanged }

Answer: D

QUESTION 4
You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application. You add a ListBox control to the application. The ListBox control is data-bound to an instance of a custom collection class of the Product objects named ProductList. The number of items of the data-bound collection is fixed. However, users can modify the properties of each of the Product objects in the collection. You need to ensure that changes made on the Product objects are automatically reflected in the ListBox control. What should you do?

A.    Implement the INotifyPropertyChanged interface in the Product class.
B.    Implement the INotifyCollectionChanged interface in the ProductList class.
C.    Set the Mode property of the Binding object of the ListBox control to TwoWay.
D.    Set the UpdateSourceTrigger property of the Binding object of the ListBox control to PropertyChanged.

Answer: A

QUESTION 5
You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application. You plan to allow users to customize the background colors, foreground colors, and font style of the application. You also plan to add a TextBlock control to the application. You write the following code fragment. (Line numbers are included for reference only.)
51[5]
You need to ensure that the ContextMenu control is associated with the TextBlock control. You also need to ensure that the properties that can be customized are shown hierarchically. Which code fragment should you insert at line 15?

A.    < Grid >
< Menu >
< MenuItem Header=”Color Scheme” DataContext=”{StaticResource colorschemes}”
ItemsSource=”{Binding Path=.}” ItemTemplate=”{StaticResource StringTemplate}” / >
< MenuItem Header=”Font” DataContext=”{StaticResource fonts}” ItemsSource=”{Binding Path=.}”
ItemTemplate=”{StaticResource StringTemplate}” />
< /Menu>
< TextBlock ttidth-“200” Height-“100” Background-“LightBlue” / > </Grid >
B.    < Window.ContextMenu >
< ContextMenu >
< MenuItem Header=”Color Scheme” DataContext=”{StaticResource colorschemes)”
ItemsSource=”{ Binding Path ItemTemplate=”{StaticRes ource StringTemplate}” /> < MenuItern
Header=”Font” DataContext=”{ StaticResource fonts!” ItemsSource=,,{ Binding Path=.}”
ItemTemplate=”{StaticResource StringTemplate}” />
< /ContextMenu >
< /Window.ContextMenu >
C.    < Grid >
< TextBlock TJidth=”200″ Height= “100” Background=”LightBlue” / > </Grid > < Window. ContextMenu >
< ContextMenu >
< TextBlock Width=”200″ Height=”100″ Background=”LightBlue” / > < MenuItem Header=”Color Scheme”
DataContext=”{StaticResource colorschemes}” ItemsSource=”{Binding Path*.}” ItemTemplate=”{StaticResource
ColorSchemeTemplate}” /> < MenuItem Header=”Font” DataContext=”{StaticResource fonts}” ItemsSource=”
{Binding Path=.}” ItemTemplate=”{StaticResource StringTemplate}” >< /MenuItem > < /ContextMenu >
</Window.ContextMenu >
D.    < Grid >
< TextBlock Uidth=”200″ Height=”100″ Background=”LightBlue” > < TextBlock.ContextMenu >
< ContextMenu >
< MenuItem Header=”Color Scheme” DataContext=”{StaticResource colorschemes)” ItemsSource=”{Binding
Path=.) ItemTemplate=”{StaticResource ColorSchemeTemplate}” / > < MenuItem Header=”Font”
DataContext=”{StaticResource fonts)” ItemsSource=”{Binding Path=.}” ItemTemplate=”{StaticResource
StringTemplate}” > < /MenuItem > </ContextMenu >
< /TextBlock.ContextMenu >
< /TextBlock > </Grid >

Answer: D

QUESTION 6
You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application. You write the following code fragment.
61[6]
You need to implement the MyProject.MyConverter class. What should you do?

A.    Implement the IValueConverter interface.
B.    Implement the IMultiValueConverter interface.
C.    Inherit from the TypeConverter class.
D.    Apply the TypeConverterAttribute attribute.

Answer: A

QUESTION 7
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?
71[3]

Answer: B

QUESTION 8
You use Microsoft .NET Framework 4 to create a Windows Forms application. You have a dataset as shown in the following exhibit.
81[2]
You plan to add a DataGridView to display the dataset. You need to ensure that the DataGridView meets the following requirements:
– Shows Order Details for the selected order.
– Shows only Order Details for items that have UnitPrice greater than 20
– Sorts Products by ProductName
Which code segment should you use?

A.    ordersBindingSource.DataSource = producxsBindingSource; ordersBindingSource.DataMember =
“FK_Order_Details_Products”; productsBindingSource.Filter = “UnitPrice > 20”;
productsBindingSource.Sort = ProductName”;
B.    productsDataGridView.DataSource = ordersBindingSource; productsBindingSource.Filter = “UnitPrice > 20”;
productsBindingSource.Sort = “ProductName”;
C.    order DetailsBindingSource.DataSource = ordersBindingSource; order_DetailsBindingSource.DataMember =
“FK_Order_Details_Orders”.
order_DetailsBindingSource .Filter = “UnitPrice > 20”; productsBindingSource.Sort “ProductName”;
D. order_DetailsDataGridViev.DataSource = ordersBindingSource; order_DetailsBindingSource.Filter =
“UnitPrice > 20”; productsBindingSource.Sort “ProductName”;

Answer: C

QUESTION 9
You are developing a Windows Forms application that contains a DataGridView control. The DataGridView is composed of several fields that capture the customer’s name, address, and phone number. You have been asked to provide data validation in a DataGridView to prevent users from leaving the name field if the name field is empty. You need to ensure that users cannot tab out of the name field without entering data. What should you do?

A.    Validate the name field in the CellValidating event. Set e.Cancel – true if the name field is empty.
B.    Validate the name field in the CellErrorTextChanged event. Get e.RowIndex if the name field is empty.
C.    Validate the name field in the CellEnter event. Set the focus on the name field if the name field is empty.
D.    Validate the name field in the CancelRowEdit event. Set the focus on the name field if the name field is empty.

Answer: A

QUESTION 10
You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application. You write the following code fragment. (Line numbers are included for reference only.)
01 <Canvas>
02 <Rectangle Stroke=”Red” Stroke Thickness=”5″ Height=”60″
03 Width-“60” Canvas. Leftoff Canvas.Top-“100”>
04
05 </Rectangle>
06 </Canvas>
You need to rotate the rectangle by 45 degrees by using its upper-left corner as the axis.
Which code fragment should you insert at line 04?

A.    <Rectangle.RenderTransforro>
<RotateTransform Angle=”45″ CenterX=”0″ CenterY=rf0″ /> </Rectangle.RenderTransform>
B.    <Rectangle.RenderTransform>
<RotateTransform Angle=”45″ CenterX=”100″ CenterY=”100″ /> </Reccangle.RenderTransform>
C.    <Rectangle.LayoutTransform>
<RotateTransform Angle=”45″ CenterX=”0″ CenterY-“0″/> </Rectangle.LayoutTransform>
D.    <Rectangle.LayoutTransform>
<RotateTransforro Angle=”45″ CenterX=”100″ CenterY=”100″/> </Rectangle.LayoutTransform>

Answer: A


PassLeader[6]

http://www.passleader.com/70-511.html

QUESTION 11
You are developing a Windows Presentation Foundation (WPF) application. You have the following style defined in the app.xaml file.
<Style x:Key=”btnItalic” x:Naitie= “styleItalic”
TargetType=”{x:Type Button}”>
<Setter Property=”FontStyle” Value=”Italic”/> </Style>
You need to apply this style to a button named button1 in the application at run time.
Which code segment should you use?

A.    button1.Style =
this.FindName(“styleltalic”) as Style;
B.    button1.Style =
this.FindName(“btnltalic”) as Style;
C.    button1.Style =
this.FindResoucce(“btnltalic”) as Style;
D.    button1.Style =
this.FindResource(“styleltalic”) as Style;

Answer: C

QUESTION 12
You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application. You add a custom command as a resource. The key of the command is saveCommand. You write the following code fragment. (Line numbers are included for reference only.)
01 < Canvas>
03 <Button>
05 </Bucton>
06 </Canvas>
You need to ensure that saveCommand is executed when the user clicks the Button control. What should you do?

A.    Insert the following code fragment at line 04.
<Button.Coiranand>
<StaticResource ResourceKey=”saveCoKiniand” /> </Button.Command>
B.    Insert the following code fragment at line 04.
<Button.CommandBindings>
<CoRimandBinding Comitiand=”( StaticResource saveCoimtiand}” /> </Button.CommandBindings>
C.    Insert the following code fragment at line 02.
<Canvas.CommandBindings>
<ComtnandBinding Command=”{StaticResoucce saveComroand}” /> </Canvas.CommandB indings>
Replace line 03 with the following code fragment.
<Bucton CommandTarget=”{Binding RelativeSource={RelativeSource Self}, Path=Parent>”>
D.    Insert the following code fragment at line 02.
<Canvas.CommandBindings>
<CommandBinding Command=”{StaticResoucce saveComroand}” /> </Canvas.CommandBindings>
Replace line 03 with the following code fragment.
<Buccon CommandPararoecec=”{Binding RelativeSource=(RelaciveSource Self}, Path=Parent>”>

Answer: A

QUESTION 13
You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application. The application displays a list of books. You write the following code fragment. (Line numbers are included for reference only.)
01 <Window. Resources>
02 <XmlDataProvider x:Key=”InventoryData” XPath=”Books”>
03 <x:XData>
04 <Books xmlns=””>
05 <Book Title=”XML in Action” Stock=”in” />
06 <Book Title=”Inside C#” Stock-“out” />
07 <Book Title=”Introducing Microsoft .NET” Stock=”in”/>
08 </Books>
09 </x:XData>
10 </XrolDataPi:ovider>
11 <Style x:Key=”HyIternStyle” TargetType=”{x:Type ListBoxItem) “>
12
13 </Style>
14 </Window.Resources>
15 <ListBox ItetnContainerStyle=”{StaticResource HyItemstyle) “>
16 <ListBox.ItemsSource>
17 <Binding Source=”{StaticResource InventoryData}” XPath=”Book”/>
18 </ListBox. ItemsSource>
19 <ListBox. ItewTeitiplate>
20 <DataTemplate>
21 <TextBlock>
22 <TextBlock.Text>
23 <Binding XPath=”@Title”/>
24 </TextBlock.Text>
25 </TextBlock>
26 </DotaTemplote>
27 </LiscBox. IcemTemplate
28 </ListBox>

A.    <Style.Triggers>
<Trigger Binding. XmlNarnespaceHanager””! Binding XPath”6Stock>”
Value-“out”> <Setter Property-Toreground” Value-“Red” />
</Trigger>
</Style.Triggecs>
B.    <Style.Triggers>
<DataTrigger Binding-“<Binding XPath”0Stock)” Value””out”>
<Setter Pcoperty=”Foregcound” Value=”Ped” />
</DataTrigger>
</Style.Triggers>
C.    <Style.Triggers>
<Trigger Binding.XmlNamespaceHanager=”{Binding XPath=BookGStock)” Value=”out”>
<Setter Property=”Foreground” Value=”Red” />
</Trigger>
</Style.Tr iggers>
D.    <Style.Triggers>
<DataTrigger Binding=”{Binding XPath=Book8Stock}” Value=”out”>
<Setter Property=”Foreground” Value=”Red” />
</DataTrigger>
</Style.Triggers>

Answer: B

QUESTION 14
You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application.
You write the following code fragment.
< StackPanel TextBox.PreviewTextInput=”StackPanel_PreviewTextInput” >
< TextBox Name=”TxtBoxA”/>
< TextBox Naroe=”TxtBoxB”/>
< TextBox Name=”TxtBoxC”/>
< /StackPanel>
You create an event handler named StackPanel_PreviewTextInput. You also have a collection of strings named Keywords.
You need to ensure that TxtBoxA and TxtBoxB do not contain any of the strings in the Keywords collections.
Which code segment should you use?

A.    private void StackPanel_PreviewTextInput(
object sender, TextCompositionEventArgs e) (
FrameuorkEleroent feSource sender as Framework Element:
if (resource.Name == “TxtBoxA” || feSource.Name == “TxtBoxB”) {
foreach(string keyword in Keywords)
if(e.Text.Contains(keyword) )
{
Handled = false; return;
}
}
Handled = true;
}
}
B.    private void StackPanel_PreviewTextInput(
object sender, TextCompositionEventArgs e)
(
FrameworkElement feSource = e.Source as FrameworkElement; if (feSource.Name == “TxtBoxA” ||
feSource.Name == “TxtBoxB”) {
foreach(string keyword in Keywords)
{
if(e.Text.Contains(keyword))
{
Handled false;
return;
}
}
Handled = true;
}
}
C.    private void StackPanel PreviewTextlnput(
object sender, TextCompositionEventArgs e)
{
FrameworkElement feSource = sender as FrameworkElement; if (feSource.Name == “TxtBoxA” ||
feSource.Name == “TxtBoxB”) {
foreach(string keyword in Keywords)
{
if(e.Text.Contains(keyword) )
{
Handled = true; return;
}
}
Handled = false;
}
}
D.    private void StackPanel_PreviewTextInput(
object sender, TextCompositionEventArgs e)
{
FrameworkElement feSource = e. Source as FrameworkElement; if (feSource.Name == “TxtBoxA” ||
feSource.Name == “TxtBoxB”) {
foreach(string keyword in Keywords) {
if(e.Text.Contains(keyword) )
{
Handled = true; return; )
}
Handled = false;
}
}

Answer: D

QUESTION 15
You are developing a user control for a Windows Presentation Foundation (WPF) application. The user control contains a button. Both the user control and the hosting control must receive the button click event. You need to ensure that the user control responds to the button click event before the hosting control responds to the event.
What should you do?

A.    Use a bubbling routed event. In the button click event handler, set the Handled property to true,
B.    Use a bubbling routed event. In the button click event handler, set the Handled property to false.
C.    Use a standard Microsoft .NET event. Set the Handled property to true.
D.    Use a tunneling routed event. Set the Handled property to false.

Answer: C

QUESTION 16
You use Microsoft .NET Framework 4 to create a Windows Presentation Framework (WPF) application. You plan to create a custom control that contains four text input fields. Each of the text input fields within the control will contain a label. You need to ensure that the text input fields within the control can be validated by using a regular expression validator.
Which class should you inherit from?

A.    TextBox
B.    TextElement
C.    UIElement
D.    UserControl

Answer: D

QUESTION 17
You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application. You write the following code fragment. (Line numbers are included for reference only.)
171[4]
You need to ensure that both Button controls display the “Save” text. Which code fragment should you insert at line 06?

A.    <TextBlock Text=”{Binding}” />
B.    <TextBlock Text=”{TemplateBinding Content}” />
C.    <ContentPresentec Content=”{Binding}” />
D.    <ContentPresentec />

Answer: D

QUESTION 18
You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application. You want to add an audio player that plays .wav or .mp3 files when the user clicks a button. You plan to store the name of the file to a variable named SoundFilePath. You need to ensure that when a user clicks the button, the file provided by SoundFilePath plays. What should you do?

A.    Write the following code segment in the button onclick event.
System.Media.SoundPlayer player = new System.Media.SoundPlayer(SoundFilePath); player.Play() ;
B.    Write the following code segment in the button onclick event.
MediaPlayer player = new MediaPlayer() ;
player.Open(new URI(SoundFilePath), UriKind.Relative)); player.Play() ;
C.    Use the following code segment from the PlaySound() Win32 API function and call the PlaySound function in the button onclick event.
[sysimport (dll=”winmm.dll”) ]public static extern long PlaySound(String SoundFilePath, long hModule, long dwFlags);
D.    Reference the Microsoft.DirectX Dynamic Link Libraries. Use the following code segment in the button onclick event.
Audio song = new Song(SoundFilePath);
song.CurrentPosition = song.Duration;
song.Play ();

Answer: B

QUESTION 19
You use Microsoft .NET Framework 4 to create a Windows Forms application. You plan to use a Windows Presentation Foundation (WPF) control of the UserControl1 type hosted in an ElementHost control named elementHost1. You write the following code segment. (Line numbers are included for reference only.)
191[4]
You need to ensure that the application changes the background color of the hosted control when the background color of the form changes.
Which code segment should you insert at line O5?

A.    elementHost1.PropertyMap.Remove (“BackColor”);
elementHost1.PropertyMap.Add(“BackColor”, new PropertyTranslator(OnBackColorChange));
B.    elementHost1. PropertyMap . Remove (“Background”);
elementHost1.PropercyMap.Add(“Background”, new PropertyTranslator(OnBackColorChange));
C.    elementHost1.PropertyMap.Add(“BackColor”, new PropertyTranslator(OnBackColorChange));
elementHost1.PropertyMap.Apply(“BackColor”);
D.    elementHost1.PropertyMap.Add(“Background”, new PropertyTranslator(OnBackColorChange));
elementHostl.PropertyMap.Apply(“Background”);

Answer: A

QUESTION 20
You develop a Windows Presentation Foundation (WPF) application. This application is used to output data trends to customer service representatives. A data trend analysis is performed in a function named UpdateTrendData. The trend analysis is a long-running process. The application contains the following code segment.
Class MainWindow: Window {
private void UpdateData(object arg)
{
double data = UpdateTrendData();

}
}
UpdateData is currently invoked on the UI thread when the form is first displayed. You need to process the data in a manner that does not cause the UI to freeze.
What should you do?

A.    Use ThreadPool.SetMaxThreads(2, 2) and invoke UpdateData.
B.    Use ThreadPool.QueueUserWorkItem to invoke UpdateData.
C.    Use this.Dispatcher.Beginlnvoke to invoke UpdateData passing in the priority of Normal.
D.    Use this.Dispatcher.BeginInvoke to invoke UpdateData passing in the priority of Background.

Answer: B


First Try 70-511 Dumps From Passleader and First Pass The 70-511 Exam

http://www.passleader.com/70-511.html