IT Certifications · 98-382

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

Exam 98-382 covers JavaScript programming fundamentals, including expressions, arrays, objects, functions, loops, and basic browser-document interaction. The available practice material asks learners to trace short code snippets, determine returned or logged values, and select expressions for common data-handling tasks.

Exam overview

Exam providerMicrosoft
Exam code98-382
CategoryIT Certifications

About the Exam 98-382: Introduction to Programming Using JavaScript Exam

Working through JavaScript code requires distinguishing variable declarations and values, applying operators, and following control flow through loops and conditions. Array and string operations involve indexing, splitting, and interpreting resulting values; object work includes accessing properties and using destructuring. Function questions can test return behavior, including the promise returned by an async function, while type checks require recognizing values such as functions, null, and undefined. Browser-facing code adds the practical task of selecting document elements with a CSS class. These skills support reading small scripts, predicting their effects, and choosing concise expressions for routine programming tasks. Pay attention to exact evaluation rules: a method's return value may differ from what a call logs, and a loop's final result depends on every iteration.

Sample Practice Questions

Review a selection from this exam's published US Practice Tests practice bank.

Question 1

Given `const colors = ["red", "blue"];`, which expression retrieves the second element?

  1. A`colors[2]`
  2. B`colors(1)`
  3. C`colors[1]`
  4. D`colors.second`
Show answerCorrect answer: C

JavaScript arrays use zero-based indexes, so the first element is at index `0` and the second is at index `1`.

Question 2

What is the value of `Math.floor(4.9)`?

  1. A`5`
  2. B`4`
  3. C`4.9`
  4. D`-4`
Show answerCorrect answer: B

`Math.floor` returns the greatest integer less than or equal to its argument. For `4.9`, that value is `4`.

Question 3

What does `typeof function () {}` evaluate to?

  1. A`"object"`
  2. B`"function"`
  3. C`"undefined"`
  4. D`"callable"`
Show answerCorrect answer: B

In JavaScript, the `typeof` operator returns the string `"function"` for function values.

Question 4

Which value does an `async` function return when it completes with the expression `return 6;`?

  1. AThe number `6` directly
  2. BA Promise fulfilled with `6`
  3. CA callback function that contains `6`
  4. DThe string `"6"`
Show answerCorrect answer: B

An `async` function always returns a Promise. A returned value becomes the fulfillment value of that Promise.

Question 5

What is logged by this code? `const settings = { mode: "light" }; const { mode } = settings; console.log(mode);`

  1. A`settings`
  2. B`mode`
  3. C`light`
  4. D`undefined`
Show answerCorrect answer: C

The object destructuring assignment copies the value of the `mode` property into a variable named `mode`. That value is the string `"light"`.

Question 6

What is logged by this code? `let result = 1; for (let i = 1; i <= 4; i++) { result *= i; } console.log(result);`

  1. A10
  2. B24
  3. C16
  4. D120
Show answerCorrect answer: B

The loop multiplies `result` by 1, then 2, then 3, then 4, producing 24.

Question 7

In a browser, which statement selects the first element in the document whose CSS class is `notice`?

  1. A`document.querySelector(".notice")`
  2. B`document.getElementById("notice")`
  3. C`document.querySelector("notice")`
  4. D`document.createElement(".notice")`
Show answerCorrect answer: A

`querySelector` accepts a CSS selector and returns the first matching element. A leading period selects elements with the class `notice`.

How to use this practice test

Access is free. A practice session presents up to 20 random questions from the 50-question bank and displays results when the session ends. Use each item to trace the code or compare expressions, then revisit missed questions by identifying the specific JavaScript behavior that led to the answer.

Preparation tips

  • Trace each loop iteration in a small table, recording the counter and any changing accumulator before predicting the final value.
  • Practice array indexing and string methods such as split; distinguish an element's position from the length of the resulting array.
  • Compare typeof results for functions and primitive values, and test null-or-undefined checks against other falsy values such as 0 and an empty string.
  • Rewrite an object-property example using destructuring, then verify which value the local variable receives.
  • For async functions, distinguish the resolved return value from the Promise returned by the function call; for DOM selection, identify the selector passed to the document method.
Official sourceOfficial exam page ↗