Microsoft Introduction to Programming Using JavaScript (98-382) Free Practice Test
Question 1
HOTSPOT
You are using JavaScript to create a function that calculates admission price.
The function must meet the following requirements:
* The function accepts the age of the customer as a parameter
* A customer who is less than 5 years old gets in free
* A customer who is 65 years old or older gets in free
* A customer who is 5 years old to 17 years old, pays $10 USD
* All other customers pay $20 USD
How should you complete the code? To answer, select the appropriate code segments in the answer area.
NOTE: Each correct selection is worth one point.

You are using JavaScript to create a function that calculates admission price.
The function must meet the following requirements:
* The function accepts the age of the customer as a parameter
* A customer who is less than 5 years old gets in free
* A customer who is 65 years old or older gets in free
* A customer who is 5 years old to 17 years old, pays $10 USD
* All other customers pay $20 USD
How should you complete the code? To answer, select the appropriate code segments in the answer area.
NOTE: Each correct selection is worth one point.

Correct Answer:

Explanation:

References: https://www.w3schools.com/jsref/jsref_operators.asp
Question 2
HOTSPOT
You are evaluating a colleague's code to ensure it meets best practices.
For each of the following statements, select Yes if the statement is true. Otherwise, select No.
NOTE: Each correct selection is worth one point.

You are evaluating a colleague's code to ensure it meets best practices.
For each of the following statements, select Yes if the statement is true. Otherwise, select No.
NOTE: Each correct selection is worth one point.

Correct Answer:

Explanation:

References: https://www.w3schools.com/js/js_conventions.asp
Question 3
DRAG DROP
You are using JavaScript to create a calculator.
You create the following HTML. Line numbers are included for reference only.

You must create a function named add() that adds the values in the a and b input elements and displays the result in the result input element.
You define the following function in JavaScript:
function add() {
}
You need to complete the body of the function.
Which three code segments should you use to develop the solution? To answer, move the appropriate code segments from the list of code segments to the answer area and arrange them in the correct order.
NOTE: Each correct selection is worth one point.

You are using JavaScript to create a calculator.
You create the following HTML. Line numbers are included for reference only.

You must create a function named add() that adds the values in the a and b input elements and displays the result in the result input element.
You define the following function in JavaScript:
function add() {
}
You need to complete the body of the function.
Which three code segments should you use to develop the solution? To answer, move the appropriate code segments from the list of code segments to the answer area and arrange them in the correct order.
NOTE: Each correct selection is worth one point.

Correct Answer:

Explanation:

References: https://www.w3schools.com/jsref/jsref_eval.asp
Question 4
HOTSPOT
For each of the following statements, select Yes if the statement is true. Otherwise, select No.
NOTE: Each correct selection is worth one point.

For each of the following statements, select Yes if the statement is true. Otherwise, select No.
NOTE: Each correct selection is worth one point.

Correct Answer:

Explanation:

References:
http://knowledgehills.com/javascript/external-javascript-syntax-disadvantages.htm
https://www.w3schools.com/js/js_whereto.asp
https://www.w3schools.com/tags/att_script_src.asp