Summer Special Flat 65% Limited Time Discount offer - Ends in 0d 00h 00m 00s - Coupon code: suredis

Microsoft 98-382 Introduction to Programming Using JavaScript Exam Practice Test

Demo: 5 questions
Total 39 questions

Introduction to Programming Using JavaScript Questions and Answers

Question 1

Your instructor has asked you to write a program that uses simple rules to help determine if a person should take the train, drive their car, or ride a bike, depending on the conditions of the weather and the amount of gas in the car’s tank.

The program has the following requirements:

  • When the temperature is above 65 degrees and it is not raining, the person should be told to ride their bike.
  • When it is raining, the person should be told to drive their car.
  • If their car has half a tank of gas or less, they should be told to take the train.

How should you complete the code? To answer, select the appropriate code segments in the answer area.

Options:

Question 2

The ABC company offers a mid-week discount of 10% on Wednesdays.

You need to write a JavaScript function that meets the following requirements:

  • Accepts the day of the week as a string
  • Returns the appropriate discount

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

You must complete the code at lines 03, 04, and 07.

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.

Options:

Question 3

You are creating a JavaScript function that returns a date the specified number of months in the future of the current date.

The function must meet the following requirements:

  • Accept a number that represents the number of months to add or subtract from the current date.
  • Return the current data adjusted by the number of months passed into the function.

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.

Options:

Question 4

You are designing a web page with a script that must dynamically change the content of a paragraph element to display the value returned by the function randomQuote().

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

Which code segment should you use at line 08?

Options:

A.

document.getElementById("tester").value = randomQuote();

B.

document.getElementById("tester").title = randomQuote();

C.

document.getElementById("tester").innerHTML = randomQuote();

D.

document.getElementById("tester").script = randomQuote();

Question 5

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.

Options:

Demo: 5 questions
Total 39 questions