exam questions

Exam 70-480 All Questions

View all questions & answers for the 70-480 exam

Exam 70-480 topic 3 question 3 discussion

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

DRAG DROP -
A company asks you to create a function that displays loan amounts to their customers.
You must create the function by using JavaScript to meet the following requirements:
✑ Display three different loan amounts to each customer.
✑ Display loan amounts in order starting with the greatest amount and ending with the least amount.
You need to implement the function.
How should you complete the relevant code? (To answer, drag the appropriate command or commands to the correct location or locations in the answer area. Use only commands that apply.)
Select and Place:

Show Suggested Answer Hide Answer
Suggested Answer:
* The innermost assignment to the loanAmount variable should be the highest.
* Local variables have local scope: They can only be accessed within the function.

Example -
// code here can not use carName
function myFunction() {
var carName = "Volvo";
// code here can use carName
}
* A variable declared outside a function, becomes GLOBAL.
A global variable has global scope: All scripts and functions on a web page can access it.

Example -
var carName = " Volvo";
// code here can use carName
function myFunction() {
// code here can use carName
}
* The alert() method displays an alert box with a specified message and an OK button.
An alert box is often used if you want to make sure information comes through to the user.
Reference: JavaScript Scope

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
JMz123
Highly Voted 5 years, 7 months ago
This is horrible code.
upvoted 22 times
...
vern85
Most Recent 4 years, 8 months ago
I agree with @JMz123. This is terrible code.
upvoted 1 times
...
stef1
5 years, 2 months ago
I wonder if anyone thought of two possible scenarios - and whether the exam creators accept both solutions!? The answer is correct, but you can easily swap answer boxes 2 and 4 and that will work too... I only guess that maybe in the past you could not use/call the function before it was declared, but you certainly can now. https://jsfiddle.net/86bopu0t/
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 ...