exam questions

Exam 70-480 All Questions

View all questions & answers for the 70-480 exam

Exam 70-480 topic 2 question 9 discussion

Actual exam question from Microsoft's 70-480
Question #: 9
Topic #: 2
[All 70-480 Questions]

DRAG DROP -
You are developing an application for an online retailer. The company ships only to certain countries.
The application must:
✑ Store a list of country codes in an array
✑ Validate the country code of the shipping address against the countries array
✑ Include a Boolean value in the array that indicates whether or not you can ship to the country
✑ Display a list of countries that can be shipped to if the user inputs a code for a country that the retailer cannot ship to
You need to develop the application to meet the requirements.
Which code segment or segments should you use? (To answer, drag the appropriate code segment or segments from the list of code segments to the correct location or locations in the work 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.)
Select and Place:

Show Suggested Answer Hide Answer
Suggested Answer:
* !arr[ctry] is true when the array element is false.
* The for..in statement iterates over the enumerable properties of an object, in arbitrary order. For each distinct property, statements can be executed.
Incorrect Answers:
Not:

Would work fine if var i; would be replaced by i=0;
Reference: JavaScript Arrays; The for..in statement

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
Nix
Highly Voted 5 years ago
The full question and answer: https://www.briefmenow.org/microsoft/which-code-segment-or-segments-should-you-use-2/
upvoted 5 times
...
stef1
Most Recent 5 years, 4 months ago
Interestingly, arr.length returns 0. So you can't loop the array using index: arr[0], arr[1], arr[2] are all undefined. I believe graphics is cut off, and there should be another empty box under the last line of code + some sort of an alert function to display the value of "txt" variable - to meet the 4th requirement of the task (to list the countries where you can ship to). I've tested this, 2nd box (* for (var i in arr) if... *) would fit this requirement (looks weird but it works exactly as is).
upvoted 1 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...