Microsoft Programming in HTML5 with JavaScript and CSS3 - 070-480 Exam Practice Test
Question 1
You create an HTML5 application that includes JavaScript. The application performs several AJAX requests.
One AJAX request retrieves order information from a web service and then sends the information back to a webpage within the application.
You must create a custom event. You have the following requirements:
* The webpage must contain an HTML element named ordersListing that will receive the custom event notification.
* The event name must be ordersReceived.
* The event must pass a custom value named orderCount.
* The event must run a JavaScript method named showOrdersReceivedCount after the orders Listing HTML element receives the event.
* Do not allow other DOM elements to receive the event.
* Allow the event to be cancelled.
* Send the event into the event system.
You need to implement the custom event to notify specific DOM elements of the AJAX response.
Which three actions should you perform in sequence? (Develop the solution by selecting the required code segments and arranging them in the correct order.)

One AJAX request retrieves order information from a web service and then sends the information back to a webpage within the application.
You must create a custom event. You have the following requirements:
* The webpage must contain an HTML element named ordersListing that will receive the custom event notification.
* The event name must be ordersReceived.
* The event must pass a custom value named orderCount.
* The event must run a JavaScript method named showOrdersReceivedCount after the orders Listing HTML element receives the event.
* Do not allow other DOM elements to receive the event.
* Allow the event to be cancelled.
* Send the event into the event system.
You need to implement the custom event to notify specific DOM elements of the AJAX response.
Which three actions should you perform in sequence? (Develop the solution by selecting the required code segments and arranging them in the correct order.)

Correct Answer:

Explanation
Box 1:

Box 2:

Box 3:

* From Scenario: Do not allow other DOM elements to receive the event.
So: bubbles: false
* From scenario: Allow the event to be cancelled.
So: cancellable: true
* From scenario:
The webpage must contain an HTML element named ordersListing that will receive the custom event notification.
* Events which are designated as bubbling will initially proceed with the same event flow as non-bubbling events. The event is dispatched to its target EventTarget and any event listeners found there are triggered.
Bubbling events will then trigger any additional event listeners found by following the EventTarget's parent chain upward, checking for any event listeners registered on each successive EventTarget. This upward propagation will continue up to and including the Document. EventListeners registered as capturers will not be triggered during this phase. The chain of EventTargets from the event target to the top of the tree is determined before the initial dispatch of the event. If modifications occur to the tree during event processing, event flow will proceed based on the initial state of the tree.
Note:
* Ajax (an acronym for Asynchronous JavaScript and XML) is a group of interrelated web development techniques used on the client-side to create asynchronous web applications. With Ajax, web applications can send data to, and retrieve data from, a server asynchronously (in the background) without interfering with the display and behavior of the existing page. Data can be retrieved using the XMLHttpRequest object. Despite the name, the use of XML is not required (JSON is often used instead), and the requests do not need to be asynchronous.
Question 2
You need to write a jQuery function to consume a file named Orders.xml.
You write the following code.

How should you complete the code? To answer, drag the appropriate code elements to the correct targets in the answer area. Each code element 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.

You write the following code.

How should you complete the code? To answer, drag the appropriate code elements to the correct targets in the answer area. Each code element 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.

Correct Answer:

Explanation

References:
https://github.com/processing/p5.js/wiki/Loading-external-files:-AJAX,-XML,-JSON
Question 3
You have the following code:

You need to ensure that the content appears as shown in the following exhibit:

Which display attribute should you use for the red div?

You need to ensure that the content appears as shown in the following exhibit:

Which display attribute should you use for the red div?
Correct Answer: D
Explanation: Only visible for Actualtests4sure members. You can sign-up / login (it's free).
Question 4
You have the following HTML markup.

For all of the fields that have names ending with the letter x, you need to set the value to value1.
Which code line should you use?


For all of the fields that have names ending with the letter x, you need to set the value to value1.
Which code line should you use?

Correct Answer: A
Question 5
You develop an HTML5 application that interacts with a REST service. The REST service accepts JSON data.
A JavaScript object named form Data contains data that is sent to the REST service.
You need to convert the JavaScript object named formData into JSON.
Which code segment should you use?
A JavaScript object named form Data contains data that is sent to the REST service.
You need to convert the JavaScript object named formData into JSON.
Which code segment should you use?
Correct Answer: A
Question 6
You are developing an online shopping application that accepts credit cards for payment.
If the credit card number is invalid, the application must:
Generate an error
Assign "200" to the error number
Assign "Invalid" to the error description
You need to write the code that meets the requirements.
How should you write the code? (To answer, drag the appropriate code segment or segments to the correct location in the answer area. Each code segment 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.)

If the credit card number is invalid, the application must:
Generate an error
Assign "200" to the error number
Assign "Invalid" to the error description
You need to write the code that meets the requirements.
How should you write the code? (To answer, drag the appropriate code segment or segments to the correct location in the answer area. Each code segment 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.)

Correct Answer:

Explanation

Example: throw new Error(200, "x equals zero");
Reference: throw Statement (JavaScript)
Question 7
You create an HTML5 webpage. You have the following HTML markup:

You also have the following JavaScript code segment:
var jsonFruit = { "apples" : "12", "bananas" : "8", "watermelon" : "3" } You need to add additional rows to the fruitTable element by processing the jsonFruit values in the order listed.
Which three actions should you perform in sequence? (Develop the solution by selecting the required code segments and arranging them in the correct order.)


You also have the following JavaScript code segment:
var jsonFruit = { "apples" : "12", "bananas" : "8", "watermelon" : "3" } You need to add additional rows to the fruitTable element by processing the jsonFruit values in the order listed.
Which three actions should you perform in sequence? (Develop the solution by selecting the required code segments and arranging them in the correct order.)

Correct Answer:

Explanation

Question 8
NOTE: This question is a part of series of questions that presents the same scenario. Each question in the series contains unique solution that might meet the started goals. Some questions sets might have more than one correct solution, while others might not have a correct solution.
After you answer a question in this section. you will not be able to return to it. As a result, these questions will not appear in the review screen.
You have the following HTML5 and CSS3 markup within a webpage.

You need to set the background color of the Home link to yellow. The solution can affect the color of the other elements.
Solution: You use the following style:

Does this meet the goal?
After you answer a question in this section. you will not be able to return to it. As a result, these questions will not appear in the review screen.
You have the following HTML5 and CSS3 markup within a webpage.

You need to set the background color of the Home link to yellow. The solution can affect the color of the other elements.
Solution: You use the following style:

Does this meet the goal?
Correct Answer: A
Question 9
You are creating a custom CSS3 style.
You have the following requirements to complete the style:
* Box1 has a red outline.
* Box1 contains box2, and box2 must remain inside box1
* Box2 must have a green to black gradient.
* Box2 must be surrounded by white space.
The style resembles the following diagram:

You need to add the CSS3 code to the styles.
How should you complete the relevant code? (To answer, select the appropriate code segment in each drop-down list in the answer area.)


You have the following requirements to complete the style:
* Box1 has a red outline.
* Box1 contains box2, and box2 must remain inside box1
* Box2 must have a green to black gradient.
* Box2 must be surrounded by white space.
The style resembles the following diagram:

You need to add the CSS3 code to the styles.
How should you complete the relevant code? (To answer, select the appropriate code segment in each drop-down list in the answer area.)


Correct Answer:

Explanation

* border: 1px solid #f00;
a red border 1 pixel thick.
* background-image: linear-gradient(to bottom, green,black);
Linear Gradients (goes down/up/left/right/diagonally).
Starts at the top with green and goes to bottom with black.
* margin: 10px 10px 10px 10px;
The CSS margin properties define the space around elements.
The top, right, bottom, and left margin can be changed independently using separate properties.
Incorrect:
* border-color: red;
will not display any border
* Radial Gradients (defined by their center).
Question 10
You are developing an application that uses a JavaScript library. The library contains the following functions.

The application uses the following code. (Line numbers are included for reference only.)

The library may throw many types of exceptions. The exceptions are grouped by category.
You need to catch and identify the exceptions by group.
Which code segment should you insert at line 05?


The application uses the following code. (Line numbers are included for reference only.)

The library may throw many types of exceptions. The exceptions are grouped by category.
You need to catch and identify the exceptions by group.
Which code segment should you insert at line 05?

Correct Answer: B
Explanation: Only visible for Actualtests4sure members. You can sign-up / login (it's free).
Question 11
You are developing a web page. You create a grid layout by using the following CSS segment.

You have the following requirements:
* You must place content in the first column of the second row.
* The content must span two columns.
You need to ensure that the style of the grid meets the requirements.
Which CSS segment should you use?


You have the following requirements:
* You must place content in the first column of the second row.
* The content must span two columns.
You need to ensure that the style of the grid meets the requirements.
Which CSS segment should you use?

Correct Answer: C
Explanation: Only visible for Actualtests4sure members. You can sign-up / login (it's free).

