microsoft 98-382 practice test

Introduction to Programming Using JavaScript

Last exam update: May 13 ,2024
Page 1 out of 2. Viewing questions 1-15 out of 40

Question 1

HOTSPOT
You are writing a JavaScript program for Blue Yonder Airlines. The program stores various information about the airlines
flights.
The program has initialized the following variables:

You need to determine the data type of the code segment based on initialization and the assignment of the variables. Use
the drop-down menus to select the answer choice that answers each question based on the information presented in the
code segment.
NOTE: Each correct selection is worth one point.
Hot Area:

Answer:

Explanation:
References: https://www.w3schools.com/js/js_datatypes.asp

Discussions
0 / 1000
EltonAuguston
6 months, 4 weeks ago

line 05 is a string.


Question 2

HOTSPOT
You are planning to use the Math object in a JavaScript application. You write the following code to evaluate various Math
functions:

What are the final values for the three variables? To answer, select the appropriate values in the answer area.
NOTE: Each correct selection is worth one point.
Hot Area:

Answer:

Explanation:
References: https://www.w3schools.com/js/js_math.asp

Discussions
0 / 1000

Question 3

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.
Hot Area:

Answer:

Explanation:
References: https://www.w3schools.com/jsref/jsref_operators.asp

Discussions
0 / 1000

Question 4

You are writing a function that calculates the remainder for integer division. The function receives two parameters, a and b,
and must return the remainder that is left over when the integer a is divided by the integer b.
You create the following code. Line numbers are for reference only.

You want to complete the function for lines 02 and 03.
Which two sets of code segments should you use? Each correct answer presents a complete solution. (Choose two.)

  • A. Option A
  • B. Option B
  • C. Option C
  • D. Option D
  • E. Option E
  • F. Option F
Answer:

E

User Votes:
A
50%
B
50%
C
50%
D
50%
E
50%
F
50%

Explanation:
References: https://www.w3schools.com/js/js_arithmetic.asp

Discussions
vote your answer:
A
B
C
D
E
F
0 / 1000
EltonAuguston
6 months, 4 weeks ago

"choose two" , its D & E


Question 5

You are writing a JavaScript program for Contoso Suites that will output HTML.
You need to output each room type on a new line using the correct method.
You create the following code for the function. Line numbers are included for reference only.

You need to insert the correct code at Line 9. Which line should you use?

  • A. document.getElementById("body").innerHTML = rooms[i] + line.innerHTML;
  • B. document.getElementById("para").innerHTML += rooms[i] + line.innerHTML;
  • C. document.getElementById("para").innerHTML += i + rooms + line.innerHTML;
  • D. document.getElementById("body").innerHTML += rooms + i;
Answer:

B

User Votes:
A
50%
B
50%
C
50%
D
50%
Discussions
vote your answer:
A
B
C
D
0 / 1000

Question 6

HOTSPOT
You work as a JavaScript developer for Adventure Works. You are writing a simple script that performs the following actions:
Declares and initializes an array

Fills the array with 10 random integers

Adds every other number starting with the first element

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.
Hot Area:

Answer:

Explanation:
References: https://www.w3schools.com/jsref/jsref_push.asp https://www.w3schools.com/js/js_arrays.asp
https://stackoverflow.com/questions/9813573/how-to-perform-a-sum-of-an-int-array

Discussions
0 / 1000

Question 7

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

Answer:

Explanation:
References: https://www.w3schools.com/tags/ref_httpmethods.asp

Discussions
0 / 1000

Question 8

DRAG DROP
You are creating a web page that requests a username.
You create the following HTML form:

You need to write a function that retrieves the username from the form.
How should you complete the code? To answer, drag the appropriate code segments to the correct locations. Each function
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.
NOTE: Each correct selection is worth one point.
Select and Place:

Answer:

Explanation:
References: https://www.w3schools.com/jsref/coll_doc_forms.asp

Discussions
0 / 1000

Question 9

DRAG DROP
You are creating a web page with a script. The script will insert the windows location inside the pages input element.
How should you complete the code? To answer, drag the appropriate code segment to the correct locations. 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:

Answer:

Explanation:
References: https://www.w3schools.com/js/js_window_location.asp

Discussions
0 / 1000

Question 10

DRAG DROP
You need to write a loop that will traverse the length of an array to find the value orange. If an array element value is null, the
code should immediately go to the next element. When the value is found, the loop should exit.
How should you complete the code? To answer, drag appropriate keywords to the correct locations. Each keyword 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:

Answer:

Explanation:
References:
https://www.w3schools.com/js/js_arrays.asp https://www.w3schools.com/js/js_break.asp

Discussions
0 / 1000

Question 11

HOTSPOT
You evaluate the following code:

You need to determine the values of sampleStudent, sampleCourse.name, and sampleCourse.grade that are output by
console.log().
What are the final values for the three variables? To answer, select the appropriate values in the answer area.
Hot Area:

Answer:

Explanation:
References: https://www.w3schools.com/js/js_output.asp

Discussions
0 / 1000

Question 12

HOTSPOT
You are creating a calendar application. You need to ensure that the code works correctly for all months of the year.
How should you complete the code? To answer, select the appropriate options in the answer area.
NOTE: Each correct selection is worth one point.
Hot Area:

Answer:

Explanation:
References: https://www.w3schools.com/js/js_break.asp https://www.w3schools.com/jsref/jsref_switch.asp

Discussions
0 / 1000

Question 13

HOTSPOT
You are creating a function that does safe division.
The function has the following requirements:
The function receives two parameters for the numerator and denominator.

If the denominator is zero, the function must return false.

If the denominator is not zero, the function must return true.

You write the following code. Line numbers are included for reference only.

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

Answer:

Explanation:
References: https://www.w3schools.com/js/js_comparisons.asp https://www.w3schools.com/jsref/jsref_if.asp

Discussions
0 / 1000

Question 14

DRAG DROP
Evaluate the following code. Line numbers are included for reference only.

What is the value of each variable at line 07? To answer, drag the appropriate value to the correct variable. Each value 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.
NOTE: Each correct selection is worth one point.
Select and Place:

Answer:

Explanation:
References: https://www.w3schools.com/js/js_arithmetic.asp

Discussions
0 / 1000

Question 15

DRAG DROP
You are developing a web page that uses JavaScript. The script needs to display information to the user using a popup box.
Match each function that displays a popup box with its appropriate scenario.
To answer, drag the appropriate function from the column on the left to its appropriate scenario on the right. Each function
may be used once, more than once, or not at all.
NOTE: Each correct selection is worth one point.
Select and Place:

Answer:

Explanation:
References: https://www.w3schools.com/js/js_popup.asp

Discussions
0 / 1000
To page 2