Accurate study guides, High passing rate! IT TEST BOOK QUESTION & ANSWER. Ittestbook provides update free of charge in one year!

Similar documents
Exam sell. Higher Quality Better Service! Certified IT practice exam authority.

CertifyMe. CertifyMe

Microsoft TS: Silverlight 4, Development. Practice Test. Version: QQ:

Introduction to Data Templates and Value Converters in Silverlight

Lecture # 6 Engr. Ali Javed 11th March, 2014

Microsoft Windows Apps Dev w/microsoft.net Framework 4. Download Full Version :

Hands-On Lab. Building Applications in Silverlight 4 Module 6: Printing the Schedule. Printing the Schedule

Microsoft Corporation

RadPDFViewer For Silverlight and WPF

Lesson 9: Exercise: Tip Calculator

RadGanttView For Silverlight and WPF

Hands-On Lab. Using Bing Maps

WebFront for Service Manager

Name of Experiment: Country Database

Weather forecast ( part 2 )

Exam Name: TS: Windows Applications Development with Microsoft.NET Framework 4

CPSC Tutorial 5

Authoring Guide v2.1 PATRIK SUNDQVIST

CPSC Tutorial 5 WPF Applications

ArcGIS Pro SDK for.net: Advanced User Interfaces in Add-ins. Wolfgang Kaiser

Step4: Now, Drag and drop the Textbox, Button and Text block from the Toolbox.

Exam Name: TS: Microsoft.NET Framework 3.5, Windows Presentation Foundation Application

Authoring Guide Gridpro AB Rev: Published: March 2014

Week 8: Data Binding Exercise (Bookstore)

Week 7: NavigationView Control Exercise

CS3240 Human-Computer Interaction Lab Sheet Lab Session 3 Designer & Developer Collaboration

Microsoft Exam TS: Windows Applications Development with Microsoft.NET Framework 4 Version: 58.5 [ Total Questions: 228 ]

sharpcorner.com/uploadfile/37db1d/4958/default.aspx?articleid=cb0b291c-52ae-4b80-a95c- 438d76fa1145

Hands-On Lab. Using Pivot and Panorama Controls

Name of Experiment: Student Database

EXAM TS:Windows Apps Dev w/microsoft.net Framework 4((C# and VB) Buy Full Product.

Chromatic Remote Control Product Guide Executive Way, Suite A Frederick, MD 21704

Course 2D_SL: 2D-Computer Graphics with Silverlight Chapter C5: The Complete Code of PathAnimation. Copyright by V. Miszalok, last update:

Yes, this is still a listbox!

Note: This demo app created for this lab uses the Visual Studio 2015 RTM and Windows Tools SDK ver

This book was purchased by

Microsoft Exam

ArcGIS Pro SDK for.net Advanced User Interfaces in Add-ins. Wolfgang Kaiser

NE.15 Data Binding In Windows Presentation Foundation

Beginning Silverlight 5 in C #

Microsoft.BrainDump v by.Gabry.53q

Hands-On Lab. Sensors -.NET. Lab version: Last updated: 12/3/2010

Developing Native Windows Phone 7 Applications for SharePoint

CS3240 Human-Computer Interaction


CPSC Tutorial 6

Microsoft CSharp

Q&A. DEMO Version

Windows Presentation Foundation. Jim Fawcett CSE687 Object Oriented Design Spring 2018

Universal Windows Platform Complete Solution

Silverlight memory board ( Part 2 )

KillTest. 半年免费更新服务

This tutorial is designed for software developers who want to learn how to develop quality applications with clean structure of code.

Note: many examples in this section taken or adapted from Pro WPF 4.5 C#, Matthew MacDonald, apress, 2012, pp

IAP C# Lecture 5 XAML and the Windows Presentation Foundation. Geza Kovacs

Launchers and Choosers Hands-on Lab. Hands-On Lab. Launchers and Choosers. Lab version: Last updated: 12/8/2010. Page 1

WPF and MVVM Study Guides

About 1. Chapter 1: Getting started with xaml 2. Remarks 2. Versions 2. Examples 2. Hello World 2. Installation or Setup 3

About 1. Chapter 1: Getting started with xaml 2. Remarks 2. Versions 2. Examples 2. Installation or Setup 2. Hello World 2

Week 6: First XAML Control Exercise

CPSC Tutorial 9 Blend & Animations

Course 2D_SL: 2D-Computer Graphics with Silverlight Chapter C1: The Intro Project

The Open Core Interface SDK has to be installed on your development computer. The SDK can be downloaded at:

Advanced Programming C# Lecture 3. dr inż. Małgorzata Janik

Master Code on Innovation and Inclusion

1) ItemsSource: it point to collection which has all the objects that will be shown in the list

ComponentOne. HyperPanel for WPF

var xdoc = XDocument.Load(inStream);

Learn to Love Lambdas

Building Next Generation GUIs using Microsoft Expression Interactive Designer

LVL08 Black Belt Silverlight Business Data Validation

Applied WPF 4 in Context US $49.99 SOURCE CODE ONLINE

Parallelizing Ocean plug-in computations using the Background Worker + PFX pattern

Getting Started with Banjos4Hire

ArcGIS Pro SDK for.net UI Design for Accessibility. Charles Macleod

ComponentOne. Document Library for UWP

Workspace Desktop Edition Developer's Guide. Customize Views and Regions


Hands-On Lab. Hello Windows Phone

ArcGIS Pro SDK for.net Beginning Pro Customization. Charles Macleod

04 Sharing Code Between Windows 8 and Windows Phone 8 in Visual Studio. Ben Riga

Hands-On Lab. Building Applications in Silverlight 4 Module 7: Event Administrator Dashboard with Out of Browser, Toasts and Native Integration

FOREWORD WHAT WE CAN LEARN TARGET READER

Copyright Soyatec. Licensed under the Eclipse Public License 1.0

DOT.NET MODULE 6: SILVERLIGHT

Programos gyvavimo ciklas

Hands-On Lab. Windows Phone Navigation and Controls

INFRAGISTICS Silverlight 15.1 Volume Release Notes 2015

DOT NET SYLLABUS FOR 6 MONTHS

10Tec igrid for.net 6.0 What's New in the Release

SAMPLE CHAPTER. C# and XAML. Pete Brown MANNING

Migrating to Windows Phone

Sundew. Application Framework

ComponentOne. Extended Library for UWP

Exam Name: MCTS: Windows Applications Development with Microsoft.NET Framework 4 Practice Test

Introduction to Programming Microsoft.NET Framework Applications with Microsoft Visual Studio 2005 (C#)

Microsoft Windows Apps Dev w/microsoft.net Framework 4.

Portable Class Libraries ---

Lab 7: Silverlight API

NetAdvantage for Silverlight Line of Business 11.2 Service Release Notes - May 2012

Transcription:

IT TEST BOOK QUESTION & ANSWER Ittestbook provides update free of charge in one year! Accurate study guides, High passing rate!

Exam : 070-506 Title : TS: Microsoft Silverlight 4, Development Version : DEMO 1 / 22

1.You are developing a Silverlight 4 application. The application defines the following three event handlers. (Line numbers are included for reference only.) 01 private void HandleCheck(object sender, RoutedEventArgs e) 02 03 MessageBox.Show("Checked") 04 05 06 private void HandleUnchecked(object sender, RoutedEventArgs e) 07 08 MessageBox.Show("Unchecked") 09 10 11 private void HandleThirdState(object sender, RoutedEventArgs e) 12 13 MessageBox.Show("Indeterminate") 14 You need to allow a check box that can be selected, cleared, or set to Indeterminate. You also need to ensure that the event handlers are invoked when the user changes the state of the control. Which XAML fragment should you use? A. <CheckBox x:name="cb2" Content="Three State CheckBox" IsChecked="True" Checked="HandleCheck" Indeterminate="HandleUnchecked" Unchecked="HandleUnchecked" /> B. <CheckBox x:name="cb2" Content="Three State CheckBox" IsThreeState="True" Checked="HandleCheck" Indeterminate="HandleThirdState" Unchecked="HandleUnchecked" /> C. <CheckBox x:name="cb2" Content="Three State CheckBox" IsHitTestVisible="True" Checked="HandleCheck" Indeterminate="HandleThirdState" Unchecked="HandleUnchecked" /> D. <CheckBox x:name="cb2" Content="Three State CheckBox" IsEnabled="True" Checked="HandleCheck" Indeterminate="HandleUnchecked" Unchecked="HandleUnchecked" /> Answer: B 2.You are developing a Silverlight 4 application. The application contains an XAML page that defines the following Grid control. <Grid Name="gridBody" > <Grid.RowDefinitions> <RowDefinition /> 2 / 22

<RowDefinition /> </Grid.RowDefinitions> <TextBlock Text="Employee Info" /> <TextBlock Text="Please enter employee info" Grid.Row="1" Height="20" VerticalAlignment="Top" /> <TextBox x:name="empinfo" Grid.Row="1" Margin="0,25,0,0" TextWrapping="Wrap" />... </Grid> The codebehind file for mypage.xaml contains the following code segment. (Line numbers are included for reference only.) 01 public mypage() 02 03 InitializeComponent() 04 05 UserControl control = new MyCustomControl() 06 07 You need to replace the contents of the second row of gridbody with a user control of the MyCustomControl type. Which code segment should you insert at line 06? A. gridbody.children.insert(1, control) B. gridbody.rowdefinitions.remove(gridbody.rowdefinitions[1]) gridbody.children.insert(1, control) C. gridbody.children.clear() Grid.SetRow(control, 1) gridbody.children.add(control) D. List<UIElement> remove = gridbody.children.where(c => c is FrameworkElement && Grid.GetRow((FrameworkElement)c) == 1).ToList() foreach (UIElement element in remove) gridbody.children.remove(element) Grid.SetRow(control, 1) gridbody.children.add(control) Answer: D 3.You are developing a Silverlight 4 application. The application defines the following XAML fragment. (Line numbers are included for reference only.) 01 <ComboBox> 02 <ComboBoxItem Content="Item 1" /> 3 / 22

03 <ComboBoxItem Content="Item 2" /> 04 <ComboBoxItem Content="Item 3" /> 05 </ComboBox> The codebehind file contains the following code segment. (Line numbers are included for reference only.) 06 void PrintText(object sender, SelectionChangedEventArgs args) 07 08 MessageBox.Show( "You selected " + cbi.content.tostring() + ".") 09 You need to ensure that when the user selects an item in a ComboBox control, the content of the item is displayed. What should you do? A. Replace the following XAML fragment at line 01. <ComboBox SelectionChanged="PrintText"> Add the following code segment at line 07. ComboBoxItem cbi = ((sender as ComboBox).SelectedItem as ComboBoxItem) B. Replace the following XAML fragment at line 01. <ComboBox SelectionChanged="PrintText"> Add the following code segment at line 07. ComboBoxItem cbi = ((sender as ComboBox).SelectedIndex as ComboBoxItem) C. Replace the following XAML fragment at line 01. <ComboBox DropDownClosed="PrintText"> Add the following code segment at line 07. ComboBoxItem cbi = ((sender as ComboBox).SelectedItem as ComboBoxItem) D. Replace the following XAML fragment at line 01. <ComboBox DropDownClosed="PrintText"> Add the following code segment at line 07. ComboBoxItem cbi = ((sender as ComboBox).SelectedIndex as ComboBoxItem) Answer: A 4.You are developing a Silverlight 4 application. You have a collection named ColPeople of the List<Person> type. You define the Person class according to the following code segment. public class Person public string Name get set public string Description get set public string Gender get set public int Age get set public int Weight get set 4 / 22

You need to bind ColPeople to a ComboBox so that only the Name property is displayed. Which XAML fragment should you use? A. <ComboBox DataContext="Binding ColPeople" ItemsSource="Binding ColPeople" DisplayMemberPath="Name" /> B. <ComboBox DataContext="Binding Person" ItemsSource="Binding Person" DisplayMemberPath="ColPeople" /> C. <ComboBox DataContext="Binding ColPeople" DisplayMemberPath="Name" /> D. <ComboBox DataContext="Binding Person" /> Answer: A 5.You are developing a Silverlight 4 application. You define an Invoice object according to the following code segment. public class Invoice public int InvoiceId get set public double Amount get set public Supplier Supplier get set public DateTime InvoiceDate get set public DateTime PayDate get set public string InvoiceDescription get set You need to display a list of invoices that have the following properties displayed on each line: InvoiceId, Amount, and InvoiceDate. Which XAML fragment should you use? A. <ListBox x:name="invoicelistbox"> <StackPanel Orientation="Horizontal"> <TextBlock Text="Binding Path=InvoiceId" /> <TextBlock Text="Binding Path=Amount" /> <TextBlock Text="Binding Path=InvoiceDate" /> </StackPanel> </ListBox> B. <ListBox x:name="invoicelistbox"> <StackPanel Orientation="Horizontal"> <ListBoxItem> <TextBlock Text="Binding Path=InvoiceId" /> </ListBoxItem> <ListBoxItem> <TextBlock Text="Binding Path=Amount" /> 5 / 22

</ListBoxItem> <ListBoxItem> <TextBlock Text="Binding Path=InvoiceDate" /> </ListBoxItem> </StackPanel> </ListBox> C. <ListBox x:name="invoicelistbox"> <ListBox.Items> <ItemsPanelTemplate> <StackPanel Orientation="Horizontal"> <TextBlock Text="Binding Path=InvoiceId" /> <TextBlock Text="Binding Path=Amount" /> <TextBlock Text="Binding Path=InvoiceDate" /> </StackPanel> </ItemsPanelTemplate> </ListBox.Items> </ListBox> D. <ListBox x:name="invoicelistbox"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <TextBlock Text="Binding Path=InvoiceId" /> <TextBlock Text="Binding Path=Amount" /> <TextBlock Text="Binding Path=InvoiceDate" /> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> </ListBox> Answer: D 6.You are developing a Silverlight 4 application. You define the visual behavior of a custom control in the ControlTemplate by defining a VisualState object named Selected. You need to change the visual state of the custom control to the Selected state. Which code segment or XAML fragment should you use? A. VisualStateManager.GoToState( this, "Selected", true ) B. <VisualTransition To="Selected"> <Storyboard>... </Storyboard> 6 / 22

</VisualTransition> C. <VisualTransition From="Selected"> <Storyboard>... </Storyboard> </VisualTransition> D. public static readonly DependencyProperty SelectedProperty = DependencyProperty.Register("Selected", typeof(visualstate), typeof(mycontrol), null) public VisualState Selected get return (VisualState)GetValue(SelectedProperty) set SetValue(SelectedProperty, value) Answer: A 7.You are developing an application by using Silverlight 4 and Microsoft.NET Framework 4. You create a new user control in the application. You add the following XAML fragment to the control. <StackPanel KeyDown="App_KeyDown" Orientation="Vertical"> <TextBox x:name="firstname" /> <TextBox x:name="lastname" /> <TextBox x:name="address" /> </StackPanel> You add the following code segment in the codebehind file of the control. (Line numbers are included for reference only.) 01 private void App_KeyDown(object sender, KeyEventArgs e) 02 03 04 05 06 private void FirstAndLastNameKeyDown() 07 08... 09 You need to ensure that the FirstAndLastNameKeyDown method is invoked when a key is pressed while the focus is on the firstname or lastname TextBox controls. You also need to ensure that the default behavior of the controls remains unchanged. Which code segment should you add at line 03? A. if (((FrameworkElement)sender).Name == "firstname" 7 / 22

((FrameworkElement)sender).Name == "lastname") FirstAndLastNameKeyDown() e.handled = false B. if (((FrameworkElement)sender).Name == "firstname" ((FrameworkElement)sender).Name == "lastname") FirstAndLastNameKeyDown() e.handled = true C. if (((FrameworkElement)e.OriginalSource).Name == "firstname" ((FrameworkElement)e.OriginalSource).Name == "lastname") FirstAndLastNameKeyDown() e.handled = false D. if (((FrameworkElement)e.OriginalSource).Name == "firstname" ((FrameworkElement)e.OriginalSource).Name == "lastname") FirstAndLastNameKeyDown() e.handled = true Answer: C 8.You are developing an application by using Silverlight 4 and Microsoft.NET Framework 4. The application has a TextBox control named txtname. You need to handle the event when txtname has the focus and the user presses the F2 key. Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.) A. txtname.keydown += new KeyEventHandler(txtName_KeyDown) B. txtname.lostfocus += new RoutedEventHandler(txtName_LostFocus) C. txtname.textchanged += new TextChangedEventHandler(txtName_TextChanged) D. void txtname_textchanged(object sender, TextChangedEventArgs e) if ((Key)e.OriginalSource == Key.F2) //Custom logic 8 / 22

E. void txtname_keydown(object sender, KeyEventArgs e) if (e.key == Key.F2) //Custom logic F. void txtname_lostfocus(object sender, RoutedEventArgs e) if ((Key)e.OriginalSource == Key.F2) //Custom logic Answer: A, E 9.You are developing an application by using Silverlight 4 and Microsoft.NET Framework 4. The application contains the following XAML fragment. <TextBlock x:name="quoteoftheday" /> The application calls a Windows Communication Foundation (WCF) service named MyService that returns the quote of the day and assigns it to the QuoteOfTheDay TextBlock. The application contains the following code segment. (Line numbers are included for reference only.) 01 var client = new MyService.MyServiceClient() 02 client.getquoteofthedaycompleted += (s, args) => QuoteOfTheDay.Text = args.result 03 client.getquoteofthedayasync() You need to handle errors that might occur as a result of the service call. You also need to provide a default value of "Unavailable" when an error occurs. Which code segment should you replace at lines 02 and 03? A. QuoteOfTheDay.Text = "Unavailable" client.getquoteofthedaycompleted += (s, args) => QuoteOfTheDay.Text = args.result client.getquoteofthedayasync() B. client.getquoteofthedaycompleted += (s, args) => if (args.result!= null) QuoteOfTheDay.Text = args.result else 9 / 22

QuoteOfTheDay.Text = "Unavailable" client.getquoteofthedayasync() C. client.getquoteofthedaycompleted += (s, args) => QuoteOfTheDay.Text = args.result try client.getquoteofthedayasync() catch (Exception ex) // TODO: handle exception QuoteOfTheDay.Text = "Unavailable" D. client.getquoteofthedaycompleted += (s, args) => if (args.error == null) QuoteOfTheDay.Text = args.result else // TODO: handle error QuoteOfTheDay.Text = "Unavailable" client.getquoteofthedayasync() Answer: D 10.You are developing an application by using Silverlight 4 and Microsoft.NET Framework 4. You create a Windows Communication Foundation (WCF) Data Service. You add a service reference to the WCF Data Service named NorthwindEntities in the Silverlight application. You also add a CollectionViewSource object named ordersviewsource in the Silverlight application. You add the following code segment. (Line numbers are included for reference only.) 01 void getorders_click(object sender, RoutedEventArgs e) 02 03 var context = new NorthwindEntities() 04 05 var query = from order in context.orders 10 / 22

06 select order 07 08 You need to retrieve the Orders data from the WCF Data Service and bind the data to the ordersviewsource object. Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.) A. Add the following code segment at line 04. var obscollection = new ObservableCollection<Order>() B. Add the following code segment at line 04. var dsorders = new DataServiceCollection<Order>() dsorders.loadcompleted += new EventHandler<LoadCompletedEventArgs>( (dsc, args) => ordersviewsource.source = dsorders ) C. Add the following code segment at line 07. dsorders.loadasync(query) D. Add the following code segment at line 07. dsorders.load(query) E. Add the following code segment at line 07. query.tolist().foreach(o => obscollection.add(o)) ordersviewsource.source = obscollection Answer: B, C 11.You are developing an application by using Silverlight 4 and Microsoft.NET Framework 4. You add a BackgroundWorker object named worker to the application. You add the following code segment. (Line numbers are included for reference only.) 01 public MainPage() 02 03 InitializeComponent() 04 worker.workersupportscancellation = true 05 worker.dowork += new DoWorkEventHandler(worker_DoWork) 06 worker.runworkercompleted += new RunWorkerCompletedEventHandler(worker_Completed) 07 08 private void worker_dowork(object sender, DoWorkEventArgs e) 09 10 for (int i = 0 i < 100 i++) 11 InvokeLongRunningProcessStep() 12 11 / 22

13 You need to ensure that worker can be properly canceled. Which code segment should you use to replace line 11? A. var cancel = (sender as BackgroundWorker).CancellationPending if(cancel) (sender as BackgroundWorker).CancelAsync() break else InvokeLongRunningProcessStep() B. var cancel = (sender as BackgroundWorker).CancellationPending if(cancel) e.cancel = true break else InvokeLongRunningProcessStep() C. var cancel = e.cancel if(cancel) (sender as BackgroundWorker).CancelAsync() break else InvokeLongRunningProcessStep() D. var cancel = e.cancel if(cancel) e.cancel = true break else InvokeLongRunningProcessStep() Answer: B 12.You are developing an application by using Silverlight 4 and Microsoft.NET Framework 4. You add a BackgroundWorker object named worker to the application. You also add a CheckBox control 12 / 22

named checkbox and a TextBlock control named statustextblock. You add the following code segment. (Line numbers are included for reference only.) 01 public MainPage() 02 03 InitializeComponent() 04 worker.workerreportsprogress = true 05 worker.dowork += new DoWorkEventHandler(worker_DoWork) 06 worker.progresschanged += new ProgressChangedEventHandler(worker_ProgressChanged) 07 08 private void worker_dowork(object sender, DoWorkEventArgs e) 09 10 for (int i = 0 i < 100 i++) 11 bool ischecked = checkbox.ischecked.hasvalue && checkbox.ischecked.value 12 ExecuteLongRunningProcessStep(isChecked) 13 worker.reportprogress(i) 14 15 16 private void worker_progresschanged(object sender, ProgressChangedEventArgs e) 17 18 statustextblock.text = e.progresspercentage + "%" 19 You attempt to run the application. You receive the following error message: "Invalid crossthread access." You need to ensure that worker executes successfully. What should you do? A. Replace line 11 with the following code segment. var b = (bool )checkbox.getvalue(checkbox.ischeckedproperty) bool ischecked = b.hasvalue && b.value B. Replace line 11 with the following code segment. bool ischecked = false Dispatcher.BeginInvoke(() => ischecked = checkbox.ischecked.hasvalue && checkbox.ischecked.value ) C. Replace line 18 with the following code segment. statustextblock.setvalue(textblock.textproperty, e.progresspercentage + "%") D. Replace line 18 with the following code segment. Dispatcher.BeginInvoke(() => 13 / 22

statustextblock.text = e.progresspercentage + "%" ) Answer: B 13.You are developing an application by using Silverlight 4 and Microsoft.NET Framework 4. You add the following code segment. (Line numbers are included for reference only.) 01 public class MyControl : Control 02 03 04 public string Title 05 06 get return (string)getvalue(titleproperty) 07 set SetValue(TitleProperty, value) 08 09 You need to create a dependency property named TitleProperty that allows developers to set the Title. You also need to ensure that the default value of the TitleProperty dependency property is set to Untitled. Which code segment you add at line 03? A. public static readonly DependencyProperty TitleProperty = DependencyProperty.Register("Untitled", typeof(string), typeof(mycontrol), null) B. public static readonly DependencyProperty TitleProperty = DependencyProperty.Register("Untitled", typeof(string), typeof(mycontrol), new PropertyMetadata("Title")) C. public static readonly DependencyProperty TitleProperty = DependencyProperty.Register("Title", typeof(string), typeof(mycontrol), new PropertyMetadata("Untitled")) D. public static readonly DependencyProperty TitleProperty = DependencyProperty.Register("Title", typeof(string), typeof(mycontrol), new PropertyMetadata(new PropertyChangedCallback((depObj, args) => 14 / 22

depobj.setvalue(mycontrol.titleproperty, "Untitled") ))) Answer: C 14.You are developing an application by using Silverlight 4 and Microsoft.NET Framework 4. You create a control named MyControl in the application. Each instance of the control contains a list of FrameworkElement objects. You add the following code segment. (Line numbers are included for reference only.) 01 public class MyControl : Control 02 03 04 public List<FrameworkElement> ChildElements 05 06 get 07 return List<FrameworkElement>)GetValue(MyControl.ChildElementsProperty) 08 09 10 11 public MyControl() 12 13 14 15 static MyControl() 16 17 18 19 You need to create the ChildElementsProperty dependency property. You also need to initialize the property by using an empty list of FrameworkElement objects. Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.) A. Add the following code segment at line 03. public static readonly DependencyProperty ChildElementsProperty = DependencyProperty.Register("ChildElements", typeof(list<frameworkelement>), typeof(mycontrol), new PropertyMetadata(new List<FrameworkElement>())) B. Add the following code segment at line 03. public static readonly DependencyProperty ChildElementsProperty = DependencyProperty.Register("ChildElements", typeof(list<frameworkelement>), typeof(mycontrol), new PropertyMetadata(null)) C. Add the following code segment at line 13. 15 / 22

SetValue(MyControl.ChildElementsProperty, new List<FrameworkElement>()) D. Add the following code segment at line 17. ChildElementsProperty = DependencyProperty.Register("ChildElements", typeof(list<frameworkelement>), typeof(mycontrol), new PropertyMetadata(new List<FrameworkElement>())) Answer: B, C 15.You are developing an application by using Silverlight 4 and Microsoft.NET Framework 4. You add the following code segment. (Line numbers are included for reference only.) 01 var outercanvas = new Canvas() 02 var innercanvas = new Canvas() 03 innercanvas.width = 200 04 innercanvas.height = 200 05 outercanvas.children.add(innercanvas) 06 You need to set the distance between the left of the innercanvas element and the left of the outercanvas element to 150 pixels. Which code segment should you add at line 06? A. outercanvas.margin = new Thickness(0.0, 150.0, 0.0, 0.0) B. innercanvas.margin = new Thickness(0.0, 150.0, 0.0, 0.0) C. outercanvas.setvalue(canvas.leftproperty, 150.0) D. innercanvas.setvalue(canvas.leftproperty, 150.0) Answer: D 16.You are developing a Silverlight 4 application. The application contains a Product class that has a public Boolean property named IsAvailable. You need to create a value converter that binds data to the Visibility property of a Button control. Which code segment should you use? A. public class BoolToVisibilityConverter : IValueConverter public object Convert(object value, Type targettype, object parameter, System.Globalization.CultureInfo culture) bool result = System.Convert.ToBoolean(parameter) return result Visibility.Visible : Visibility.Collapsed public object ConvertBack(object value, Type targettype, object parameter, System.Globalization.CultureInfo culture) 16 / 22

throw new NotImplementedException() B. public class BoolToVisibilityConverter : IValueConverter public object Convert(object value, Type targettype, object parameter, System.Globalization.CultureInfo culture) bool result = System.Convert.ToBoolean(value) return result Visibility.Visible : Visibility.Collapsed public object ConvertBack(object value, Type targettype, object parameter, System.Globalization.CultureInfo culture) throw new NotImplementedException() C. public class BoolToVisibilityConverter : PropertyPathConverter public object Convert(object value, Type targettype, object parameter, System.Globalization.CultureInfo culture) return this.convertto(value, typeof(visibility)) public object ConvertBack(object value, Type targettype, object parameter, System.Globalization.CultureInfo culture) throw new NotImplementedException() D. public class BoolToVisibilityConverter public object Convert(object value, Type targettype, object parameter, System.Globalization.CultureInfo culture) bool result = System.Convert.ToBoolean(value) return result Visibility. Visible : Visibility. Collapsed public object ConvertBack(object value, Type targettype, object parameter, 17 / 22

System.Globalization.CultureInfo culture) throw new NotImplementedException() Answer: B 17.You are developing a Silverlight 4 application. The application contains a Product class that has a public string property named Name. You create a TextBox control by using the following XAML fragment. <TextBox Text="Binding Name, ValidatesOnDataErrors=True" /> You need to ensure that validation errors are reported to the user interface. You also need to ensure that a validation error will occur when the TextBox control is empty. Which code segment should you use? A. public class Product [Required()] public string Name get set B. public class Product : IDataErrorInfo public string Name get set public string Error get return null public string this[string columnname] get if (columnname == "Name" && string.isnullorempty(name)) throw new ValidationException("Name should not be empty!") return string.empty C. public class Product : IDataErrorInfo public string Name get set public string Error get return null 18 / 22

public string this[string columnname] get if (columnname == "Name" && string.isnullorempty(name)) return "Name should not be empty!" return string.empty D. public class Product private string _name public string Name get return _name set if (string.isnullorempty(value)) throw new ValidationException("Name should not be empty!") _name = value Answer: C 18.You are developing a ticketing application by using Silverlight 4. You have a listbox named lsttickets that contains a list of the tickets. The page contains a button that allows the user to print the tickets. The PrintView UserControl binds to the type in lsttickets and is designed to fit a standard sheet of paper. You add the following code segment to the button event handler. (Line numbers are included for reference only.) 01 var doc = new PrintDocument() 02 var view = new PrintView() 03 doc.printpage += (s, args) => 04 05 var ppc = doc.printedpagecount 06 if (ppc < lsttickets.items.count) 19 / 22

07 08 var data = lsttickets.items[ppc] 09 view.datacontext = data 10 args.pagevisual = view 11 12 13 14 15 doc.print("tickets") You need to use the Silverlight printing API to print each ticket on its own page. You also need to ensure that all tickets in the listbox are printed. Which code segment should you insert at lines 11 and 12? A. if (args.hasmorepages == false) return B. if (args.hasmorepages == true) return C. if (doc.printedpagecount < this.lsttickets.items.count 1) args.hasmorepages = true D. if (ppc == this.lsttickets.items.count 1) doc.endprint += (o, p) => return Answer: C 19.You are developing an outofbrowser application by using Silverlight 4. The main page of the application contains the following code segment. public MainPage() InitializeComponent() NetworkChange.NetworkAddressChanged += (s, e) => CheckNetworkStatusAndRaiseToast() CheckNetworkStatusAndRaiseToast() You need to ensure that the application will raise a toast notification when network connectivity changes. Which two actions should you perform in the CheckNetworkStatusAndRaiseToast method? (Each correct answer presents part of the solution. Choose two.) A. Verify that App.Current.IsRunningOutOfBrowser is true. B. Verify that App.Current.IsRunningOutOfBrowser is false. C. Verify that App.Current.HasElevatedPermissions is true. D. Verify that App.Current.HasElevatedPermissions is false. E. Examine NetworkInterface.GetIsNetworkAvailable(). 20 / 22

F. Call App.Current.CheckAndDownloadUpdateAsync() in a try/catch block. Answer: A, E 20.You have a Silverlight 4 application that uses isolated storage. You create an application that has a 5 MB file that must be saved to isolated storage. Currently, the application has not allocated enough isolated storage to save the file. You need to ensure that the application prompts the user to increase the isolated storage allocation. You also need to ensure that only the minimum amount of space needed to save the 5 MB file is requested. Which code segment should you use? A. using (var store = IsolatedStorageFile.GetUserStoreForApplication()) var neededspace = 5242880 if (store.increasequotato(neededspace))... B. using (var store = IsolatedStorageFile.GetUserStoreForApplication()) var neededspace = 5242880 if (store.increasequotato(store.quota + neededspace))... C. using (var store = IsolatedStorageFile.GetUserStoreForApplication()) var neededspace = 5242880 if (store.increasequotato( store.availablefreespace + neededspace ))... D. using (var store = IsolatedStorageFile.GetUserStoreForApplication()) var neededspace = 5242880 if (store.increasequotato( 21 / 22

store.usedsize + neededspace ))... Answer: D 22 / 22