98-382 : Introduction to Programming Using JavaScript : Part 02

  1. HOTSPOT

    You are creating JavaScript code that manipulates dates. You want to initialize a Date object with the date January 1, 2017 by using the year, month, and date parameters.

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

    98-382 Part 02 Q01 034 Question
    98-382 Part 02 Q01 034 Question
    98-382 Part 02 Q01 034 Answer
    98-382 Part 02 Q01 034 Answer
  2. HOTSPOT

    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.

    98-382 Part 02 Q02 035 Question
    98-382 Part 02 Q02 035 Question
    98-382 Part 02 Q02 035 Answer
    98-382 Part 02 Q02 035 Answer
  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.

    98-382 Part 02 Q03 036 Question
    98-382 Part 02 Q03 036 Question
    98-382 Part 02 Q03 036 Answer
    98-382 Part 02 Q03 036 Answer
  4. HOTSPOT

    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.

    98-382 Part 02 Q04 037
    98-382 Part 02 Q04 037

    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.

    98-382 Part 02 Q04 038 Question
    98-382 Part 02 Q04 038 Question
    98-382 Part 02 Q04 038 Answer
    98-382 Part 02 Q04 038 Answer
  5. 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.

    98-382 Part 02 Q05 039 Question
    98-382 Part 02 Q05 039 Question
    98-382 Part 02 Q05 039 Answer
    98-382 Part 02 Q05 039 Answer
  6. DRAG DROP

    Your instructor has asked you to implement code that would display a two-dimensional array of any size inside a <div> tag.

    You write the following code:

    98-382 Part 02 Q06 040
    98-382 Part 02 Q06 040

    You need to complete the code.

    Which three 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.

    98-382 Part 02 Q06 041 Question
    98-382 Part 02 Q06 041 Question
    98-382 Part 02 Q06 041 Answer
    98-382 Part 02 Q06 041 Answer
  7. HOTSPOT

    You are using JavaScript to write a safe root math utility that has the following requirements:
    Given the function safeRoot(a, b):
    If the radicand (a) is non-negative, return Math.pow (a, 1/b);
    Otherwise,
    If the index (b) is divisible by 2, then return text indicating the result is imaginary.
    Otherwise return -Math.pow (-a, 1/b)

    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.

    98-382 Part 02 Q07 042 Question
    98-382 Part 02 Q07 042 Question
    98-382 Part 02 Q07 042 Answer
    98-382 Part 02 Q07 042 Answer
  8. HOTSPOT

    You are creating a function named countdown. The function accepts a single parameter, start, and displays a countdown from that number down to zero in increments of one.

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

    98-382 Part 02 Q08 043 Question
    98-382 Part 02 Q08 043 Question
    98-382 Part 02 Q08 043 Answer
    98-382 Part 02 Q08 043 Answer
  9. 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.

    98-382 Part 02 Q09 044 Question
    98-382 Part 02 Q09 044 Question
    98-382 Part 02 Q09 044 Answer
    98-382 Part 02 Q09 044 Answer
  10. 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.

    98-382 Part 02 Q10 045
    98-382 Part 02 Q10 045

    For each of the following statements, select Yes if the statement is true. Otherwise, select No.

    NOTE: Each correct selection is worth one point.

    98-382 Part 02 Q10 046 Question
    98-382 Part 02 Q10 046 Question
    98-382 Part 02 Q10 046 Answer
    98-382 Part 02 Q10 046 Answer
  11. HOTSPOT

    Variable x has a value of 5. Variable y has a value of 7.

    For each of the following expressions, select True if the statement evaluates to true. Otherwise, select False.

    NOTE: Each correct selection is worth one point.

    98-382 Part 02 Q11 047 Question
    98-382 Part 02 Q11 047 Question
    98-382 Part 02 Q11 047 Answer
    98-382 Part 02 Q11 047 Answer
  12. 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.

    98-382 Part 02 Q12 048 Question
    98-382 Part 02 Q12 048 Question
    98-382 Part 02 Q12 048 Answer
    98-382 Part 02 Q12 048 Answer
  13. HOTSPOT

    You are designing a function that allows you to perform unit tests on other functions in a library. You will invoke each library function by using the eval JavaScript function. If an exception occurs when invoking a function, you want to display a message box with the following message:

    The function does not exist.

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

    NOTE: Each correct selection is worth one point.

    98-382 Part 02 Q13 049 Question
    98-382 Part 02 Q13 049 Question
    98-382 Part 02 Q13 049 Answer
    98-382 Part 02 Q13 049 Answer
  14. This question requires that you evaluate the underlined text to determine if it is correct.

    You review the following JavaScript code:

    98-382 Part 02 Q14 050
    98-382 Part 02 Q14 050

    When this code executes, the value of x is 0.

    Review the underlined text. If it makes the statement correct, select “No change is needed”. If the statement is incorrect, select the answer choice that makes the statement correct.

    • No change is needed
    • the value of x is 3
    • the value of x is 5
    • the value of x is undefined
  15. You are creating a JavaScript program for an accounting system.

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

    98-382 Part 02 Q15 051
    98-382 Part 02 Q15 051

    You evaluate the code to ensure that it follows JavaScript best practices.

    Which line should you change?

    • 01
    • 02
    • 03
    • 04
    • 05
  16. 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.

    98-382 Part 02 Q16 052
    98-382 Part 02 Q16 052

    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.)

    • 98-382 Part 02 Q16 053
      98-382 Part 02 Q16 053
    • 98-382 Part 02 Q16 054
      98-382 Part 02 Q16 054
    • 98-382 Part 02 Q16 055
      98-382 Part 02 Q16 055
    • 98-382 Part 02 Q16 056
      98-382 Part 02 Q16 056
    • 98-382 Part 02 Q16 057
      98-382 Part 02 Q16 057
    • 98-382 Part 02 Q16 058
      98-382 Part 02 Q16 058
  17. 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.

    98-382 Part 02 Q17 059 Question
    98-382 Part 02 Q17 059 Question
    98-382 Part 02 Q17 059 Answer
    98-382 Part 02 Q17 059 Answer
  18. 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.

    98-382 Part 02 Q18 060 Question
    98-382 Part 02 Q18 060 Question
    98-382 Part 02 Q18 060 Answer
    98-382 Part 02 Q18 060 Answer
  19. DRAG DROP

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

    98-382 Part 02 Q19 061
    98-382 Part 02 Q19 061

    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.

    98-382 Part 02 Q19 062 Question
    98-382 Part 02 Q19 062 Question
    98-382 Part 02 Q19 062 Answer
    98-382 Part 02 Q19 062 Answer
Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments