Which code segment should you insert at line 08?
You are developing an application that uses the Microsoft ADO.NET Entity Framework to retrieve order
information from a Microsoft SQL Server database. The application includes the following code. (Line
numbers are included for reference only.)
The application must meet the following requirements:
-Return only orders that have an OrderDate value other than null.
-Return only orders that were placed in the year specified in the OrderDate property or in a later year.
-Not raise an exeption
You need to ensure that the application meets the requirements.
Which code segment should you insert at line 08?
Which code segment should you insert at line CSO9?
Scenario 2
Background
You are developing a Windows Store app named Picture Sharer. The app will allow users to capture, modify,
caption, and share pictures.
Application Structure
The SharelmageButton and GetContactsButton controlsuse the same foreground color. The foreground color
might change in the future.
The following code defines a custom button style named ButtonStyleRed:
Relevant portions of the app files are shown. (Linenumbers are included for reference only and include a two-character prefix that denotes the specific file to which they belong.)
Business Requirements
The app must meet the following business requirements:
– Allow users to capture and retrieve pictures, modify pictures by adding a shading effect, and add captions to
images.
– Support only Landscape and Landscape-flipped orientations.
– Ensure that users can select and modify images from the PictureChooserPaqe page.
– Ensure that users can change the magnification ofthe selected image and resize the image by using pinch
and stretch gestures. Scaling should be fluid and precisely controlled by the user.
The app must be localized for the French Canadian market.
Technical Requirements
The app must meet the following technical requirements:
– Scroll bars must not be visible.
– The CaptionTextBlock and CaptionTextBox controls must appear side by side, without overlapping and on the
same line. The CaptionTextBox control should appearto the right of the CaptionTextBlock control.
– The ContactPicker object must be filtered to display only email addresses.
– Minimize the code that is required to implement optical zoom functionality.
You must perform the following tasks:
– Handle the Click event of the GetPictureButton control to switch from the current page to the
PictureChooserPage page.
– After the user selects an image on the PictureChooserPage page, ensure that the app navigates back to the
PictureSharerMainPage page.
– Track the current screen orientation and page size by updating the _currentViewState, _currentHeight, and
_currentWidth fields every time the screen orientation or page size changes.
– Create a style named ButtonStyleWhite that inherits all the style settings of the ButtonStyleRed style except
the border color; the border color must be white. The ButtonStyleWhite style must automatically updatewith any
changes that are made to the ButtonStyleRed style.
– Create a resource named ButtonForegroundColor to implement the button foreground color so that it can be
referenced in XAML by using the following standard syntax:
Foreground=”{StacicResource ButtonForegroundColor}”
– Ensure that the OnNavigatedTo() method updates the current picture when a new picture is selected.
– Change the background for the root Grid element to a vertical gradient that transitions from black at the top to
maroon at the bottom. Create a resource named GridBackgroundGradientBrush to hold the requested gradient.
While testing the app, you observe the following results:
– An exception is being thrown in the GetContactsCompleted event handler when the retrieved email address is
assigned to the RecipientsTextBlock control. The exception message states:
“The application called an interface that was marshalled for a different thread.”
– When users navigate away from the PictureSharerMainPage page, information that was entered in the
CaptionTextBox control is lost.
*********************************************************************
You need to track the screen orientation and page size.
Which code segment should you insert at line CSO9?
How should you complete the relevant code?
You are developing an application by using C#. The application includes an array of decimal values named
loanAmounts.
You are developing a LINQ query to return the values from the array.
The query must return decimal values that are evenly divisible by two. The values must be sorted from the
lowest value to the highest value.
You need to ensure that the query correctly returnsthe decimal values.
How should you complete the relevant code? (To answer, drag the appropriate code segments to the
correct locations in the answer area. Each code segment may be used once, more than once, or not at all.
Select and Place:
Which code segment should you use?
You are developing an application. The application includes a method named ReadFile that reads data
from a file.
The ReadFile() method must meet the following requirements:
-It must not make changes to the data file.
-It must allow other processes to access the data file.
-It must not throw an exception if the application attempts to open a data file that does not exist.
You need to implement the ReadFileQ method. Which code segment should you use?
Which code segment should you insert at line CS09?
Scenario 2
Background
You are developing a Windows Store app named Picture Sharer. The app will allow users to capture, modify,
caption, and share pictures.
Application Structure
The SharelmageButton and GetContactsButton controlsuse the same foreground color. The foreground color
might change in the future.
The following code defines a custom button style named ButtonStyleRed:
Relevant portions of the app files are shown. (Linenumbers are included for reference only and include a two-character prefix that denotes the specific file to which they belong.)
Business Requirements
The app must meet the following business requirements:
– Allow users to capture and retrieve pictures, modify pictures by adding a shading effect, and add captions to
images.
– Support only Landscape and Landscape-flipped orientations.
– Ensure that users can select and modify images from the PictureChooserPaqe page.
– Ensure that users can change the magnification ofthe selected image and resize the image by using pinch
and stretch gestures. Scaling should be fluid and precisely controlled by the user.
The app must be localized for the French Canadian market.
Technical Requirements
The app must meet the following technical requirements:
– Scroll bars must not be visible.
– The CaptionTextBlock and CaptionTextBox controls must appear side by side, without overlapping and on the
same line. The CaptionTextBox control should appearto the right of the CaptionTextBlock control.
– The ContactPicker object must be filtered to display only email addresses.
– Minimize the code that is required to implement optical zoom functionality.
You must perform the following tasks:
– Handle the Click event of the GetPictureButton control to switch from the current page to the
PictureChooserPage page.
– After the user selects an image on the PictureChooserPage page, ensure that the app navigates back to the
PictureSharerMainPage page.
– Track the current screen orientation and page size by updating the _currentViewState, _currentHeight, and
_currentWidth fields every time the screen orientation or page size changes.
– Create a style named ButtonStyleWhite that inherits all the style settings of the ButtonStyleRed style except
the border color; the border color must be white. The ButtonStyleWhite style must automatically updatewith any
changes that are made to the ButtonStyleRed style.
– Create a resource named ButtonForegroundColor to implement the button foreground color so that it can be
referenced in XAML by using the following standard syntax:
Foreground=”{StacicResource ButtonForegroundColor}”
– Ensure that the OnNavigatedTo() method updates the current picture when a new picture is selected.
– Change the background for the root Grid element to a vertical gradient that transitions from black at the top to
maroon at the bottom. Create a resource named GridBackgroundGradientBrush to hold the requested gradient.
While testing the app, you observe the following results:
– An exception is being thrown in the GetContactsCompleted event handler when the retrieved email address is
assigned to the RecipientsTextBlock control. The exception message states:
“The application called an interface that was marshalled for a different thread.”
– When users navigate away from the PictureSharerMainPage page, information that was entered in the
CaptionTextBox control is lost.
*********************************************************************
You need to retain the data that is entered in the TextBox control when the user navigates away from the
PictureSharerMainPage page.
Which code segment should you insert at line CS09?
Which code segment should you insert at line 10?
An application receives JSON data in the following format:
The application includes the following code segment. (Line numbers are included for reference only.)
You need to ensure that the ConvertToName() method returns the JSON input string as a Name object.
Which code segment should you insert at line 10?
How should you complete the relevant code?
An application serializes and deserializes XML fromstreams. The XML streams are in the following format:
The application reads the XML streams by using a DataContractSerializer object that is declared by the
following code segment:
var ser = new DataContractSerializer(typeof(Name));You need to ensure that the application preserves the
element ordering as provided in the XML stream.
How should you complete the relevant code? (To answer, drag the appropriate attributes to the correct
locations in the answer area-Each attribute may be used once, more than once, or not at all. You may need to
drag the split bar between panes or scroll to view content.)
Select and Place:
Which code segment should you insert at line CS13?
Scenario 2
Background
You are developing a Windows Store app named Picture Sharer. The app will allow users to capture, modify,
caption, and share pictures.
Application Structure
The SharelmageButton and GetContactsButton controlsuse the same foreground color. The foreground color
might change in the future.
The following code defines a custom button style named ButtonStyleRed:
Relevant portions of the app files are shown. (Linenumbers are included for reference only and include a two-character prefix that denotes the specific file to which they belong.)
Business Requirements
The app must meet the following business requirements:
– Allow users to capture and retrieve pictures, modify pictures by adding a shading effect, and add captions to
images.
– Support only Landscape and Landscape-flipped orientations.
– Ensure that users can select and modify images from the PictureChooserPaqe page.
– Ensure that users can change the magnification ofthe selected image and resize the image by using pinch
and stretch gestures. Scaling should be fluid and precisely controlled by the user.
The app must be localized for the French Canadian market.
Technical Requirements
The app must meet the following technical requirements:
– Scroll bars must not be visible.
– The CaptionTextBlock and CaptionTextBox controls must appear side by side, without overlapping and on the
same line. The CaptionTextBox control should appearto the right of the CaptionTextBlock control.
– The ContactPicker object must be filtered to display only email addresses.
– Minimize the code that is required to implement optical zoom functionality.
You must perform the following tasks:
– Handle the Click event of the GetPictureButton control to switch from the current page to the
PictureChooserPage page.
– After the user selects an image on the PictureChooserPage page, ensure that the app navigates back to the
PictureSharerMainPage page.
– Track the current screen orientation and page size by updating the _currentViewState, _currentHeight, and
_currentWidth fields every time the screen orientation or page size changes.
– Create a style named ButtonStyleWhite that inherits all the style settings of the ButtonStyleRed style except
the border color; the border color must be white. The ButtonStyleWhite style must automatically updatewith any
changes that are made to the ButtonStyleRed style.
– Create a resource named ButtonForegroundColor to implement the button foreground color so that it can be
referenced in XAML by using the following standard syntax:
Foreground=”{StacicResource ButtonForegroundColor}”
– Ensure that the OnNavigatedTo() method updates the current picture when a new picture is selected.
– Change the background for the root Grid element to a vertical gradient that transitions from black at the top to
maroon at the bottom. Create a resource named GridBackgroundGradientBrush to hold the requested gradient.
While testing the app, you observe the following results:
– An exception is being thrown in the GetContactsCompleted event handler when the retrieved email address is
assigned to the RecipientsTextBlock control. The exception message states:
“The application called an interface that was marshalled for a different thread.”
– When users navigate away from the PictureSharerMainPage page, information that was entered in the
CaptionTextBox control is lost.
*********************************************************************
You need to implement the OnNavigatedTo() method tomeet the requirements. Which code segment should
you insert at line CS13?
Which code segment should you insert at line 20?
You are developing an application. The application converts a Location object to a string by using a
method named WriteObject. The WriteObject() method accepts two parameters, a Location object and an
XmlObjectSerializer object.
The application includes the following code. (Line numbers are included for reference only.)
You need to serialize the Location object as a JSONobject.
Which code segment should you insert at line 20?
Which access modifier should you use for the GetData() method?
An application includes a class named Person. The Person class includes a method named GetData.
You need to ensure that the GetData() method can beused only by the Person class or a class derived
from the Person class.
Which access modifier should you use for the GetData() method?