Wednesday 8 June 2011

silverlight certification exam tips and my experience

First let me start with how to register for silverlight certification online!


Steps to Register: (IF YOU THIS IS YOUR FIRST CERTIFICATION THIS STEP WILL BE HIGHLY HELPFUL ELSE SKIP THIS SECTION)


1. Goto http://securereg3.prometric.com/Welcome.aspx 


save image


2. Select Microsoft in the first dropdown and India in the second dropdown(shown in above image). Click Next.


save image


3. Select Microsoft in the Client field and Microsoft(070, .... ) in the Program field(shown in above image). click Next


save image
4. Then you will see some policy statements like above


save image
5. Silverlight exam code is 070-506. Select this code as shown above. Click Next


save image


6. Decide where you wanna take the exam and select the location as shown above


save image
7. Choose the date when you want to take the test. Click Next

8. Here you have to enter the payment information and complete the registration.




After Registration during preparation:
* Go through the questions given in the last section of this post.
* There will be two to three questions based on NotifyOnError flag and ValidateOnException flag.
* Questions related to printer API
* Questions related to Isolated storage
* Questions related to MVVM




After Registration on the day of exam:

* You dont need to carry anything except two ID proofs.
* Confirm the address of the scheduled location before going to the location.(I struggled for 2 hours to find the location :P)




Some of the questions encountered in the certification exam(70-506 - Silverlight Certification):


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" />


 

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 />
<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 code-behind 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);

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" />
03 <ComboBoxItem Content="Item 2" />
04 <ComboBoxItem Content="Item 3" />
05 </ComboBox>
The code-behind 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);

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; }
}
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}" />

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}" />
</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>

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>
</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); } }

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 code-behind 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"
|| ((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;

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 } }
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 } }

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 { 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();

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 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;


Hope this is helpful!!.... :)


P.S: Comments are most welcome to improve the content! 

5 comments:

  1. Very informative. It's great that you have spent your precious time to enable others to succeed. Hats off!!!

    ReplyDelete
  2. super dA !!!>... Good start .... :) Keep posting...

    I dont think v have easy to understand Silverlight tutorials... you are well on way to create one here.. :)

    ReplyDelete
  3. Great Job!!! U r indeed spreading the (Silver)light!!! :-)..... Next Android pls!!!!

    ReplyDelete