




























































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





























































































JavaScript Developer Certification Exam 2026: Professional Practice Test — JavaScript Fundamentals, Functions, Objects, DOM Manipulation, Asynchronous Programming, APIs & Error Handling — 190 Multiple-Choice Questions with Answers & Detailed Rationales
SECTION 1: JavaScript Fundamentals (Questions 1–38)
Question 1
Which of the following best describes the difference between let and var in JavaScript?
A. let is function-scoped, while var is block-scoped.
B. let is block-scoped, while var is function-scoped.
C. Both let and var are block-scoped, but let cannot be reassigned.
D. var creates immutable bindings, while let creates mutable bindings.
Correct Answer: B
Explanation: let respects block scope boundaries, while var hoists to function scope. This affects variable accessibility and closure behavior.
Question 2
What is the output of the following code?
javascript
console.log(typeof null);
A. "null"
B. "undefined"
C. "object"
D. "boolean"
Correct Answer: C
Explanation: typeof null returns "object" due to a historical bug in JavaScript's original implementation that persists for backward compatibility.
Question 3
A developer writes the following code. What value is logged?
javascript
let x = 10;
{
let x = 20; console.log(x);
}
console.log(x);
A. 20, 20
B. 10, 10
C. 20, 10
D. 10, 20
Correct Answer: C
Explanation: Block scoping creates a new x inside the block. The outer x remains 10 after the block executes.
Question 6
Consider the following code. What is logged?
javascript
function test() {
console.log(a); var a = 5;
}
test();
A. 5
B. undefined
C. ReferenceError
D. null
Correct Answer: B
Explanation: var declarations hoist to the top of the function, but the assignment stays in place, producing undefined before initialization.
Question 7
Which of the following is NOT a primitive data type in JavaScript?
A. Symbol
B. BigInt
C. Array
D. Boolean
Correct Answer: C
Explanation: Arrays are objects in JavaScript, not primitives. Primitives include string, number, boolean, null, undefined, symbol, and bigint.
Question 8
What does the following expression evaluate to?
javascript
0.1 + 0.2 === 0.
A. true
B. false
C. NaN
D. TypeError
Correct Answer: B
Explanation: Floating-point precision causes 0.1 + 0.2 to equal 0.30000000000000004, so strict equality returns false.
Question 9
A junior developer asks why the following code prints five 5s instead of 0 through 4:
javascript
Question 11
What is the output of the following?
javascript
console.log([] + []);
A. "[]"
B. ""
C. 0
D. NaN
Correct Answer: B
Explanation: Both arrays convert to empty strings, and concatenation of two empty strings yields an empty string.
Question 12
Which of the following correctly describes JavaScript's NaN?
A. NaN === NaN returns true.
B. NaN is a number type.
C. typeof NaN returns "nan".
D. NaN can be compared with ==.
Correct Answer: B
Explanation: typeof NaN returns "number". It is not equal to itself, so Number.isNaN() should be used to detect it.
Question 13
What is the value of typeof typeof 42?
A. "number"
B. "string"
C. "undefined"
D. "object"
Correct Answer: B
Explanation: typeof 42 returns "number", and typeof "number" returns "string", since the first result is a string.
Question 14
Which statement about JavaScript's automatic semicolon insertion (ASI) is correct?
A. ASI always inserts semicolons at line breaks.
B. ASI can cause unexpected behavior with return statements on new lines.
C. ASI is disabled in strict mode.
D. ASI only applies to variable declarations.
Correct Answer: B
Correct Answer: B
Explanation: Left-to-right evaluation: 1 + 2 = 3, then 3 + "3" coerces to string concatenation, producing "33".
Question 17
Which of the following is a falsy value in JavaScript?
Correct Answer: C
Explanation: Falsy values include 0, "", null, undefined, NaN, and false. Empty arrays and objects are truthy.
Question 18
What is the result of Boolean("")?
A. true
B. false
C. undefined
D. TypeError
Correct Answer: B
Explanation: An empty string is a falsy value, so Boolean("") returns false.
Question 19
Which method converts a JSON string into a JavaScript object?
A. JSON.stringify()
B. JSON.parse()
C. Object.assign()
D. Object.fromEntries()
Correct Answer: B
Explanation: JSON.parse() deserializes a JSON-formatted string into a JavaScript value. stringify() performs the reverse.
Question 20
A developer writes:
javascript
let a = [1, 2, 3];
let b = a;
b.push(4);
console.log(a.length);
What is logged?
javascript
console.log(typeof function(){});
A. "function"
B. "object"
C. "undefined"
D. "callable"
Correct Answer: A
Explanation: typeof returns "function" for function values, distinguishing them from other objects.
Question 23
Which of the following correctly checks whether a value is an array?
A. typeof value === "array"
B. value instanceof Array
C. Array.isArray(value)
D. Both B and C
Correct Answer: D
Explanation: Array.isArray() is the most reliable method, but instanceof Array also works within a single realm.
Question 24
What does the spread operator do in [...arr]?
A. Mutates the original array.
B. Creates a shallow copy of the array.
C. Creates a deep copy of the array.
D. Reverses the array.
Correct Answer: B
Explanation: Spread creates a new array with the same top-level elements. Nested objects remain shared references.
Question 25
A developer writes:
javascript
const obj = { a: 1 };
obj.a = 2;
console.log(obj.a);
What is logged?
C. TypeError
D. undefined
Correct Answer: B
Explanation: The subtraction operator coerces the string "5" to the number 5, producing 3.
Question 28
Which of the following is true about JavaScript's Symbol type?
A. Symbols are strings with unique prefixes.
B. Symbols are always enumerable in for...in loops.
C. Every symbol value is unique.
D. Symbols can be created with new Symbol().
Correct Answer: C
Explanation: Each symbol is guaranteed unique. They are not enumerable in for...in and cannot be created with new.
Question 29
What does the following code print?
javascript
console.log(!!"false");
A. false
B. true
C. "false"
D. undefined
Correct Answer: B
Explanation: Non-empty strings are truthy. Double negation converts the truthy string "false" to boolean true.
Question 30
Which statement about template literals is correct?
A. They use single quotes.
B. They support multi-line strings and interpolation.
C. They cannot contain expressions.
D. They are slower than string concatenation in all engines.
Correct Answer: B
Explanation: Template literals use backticks and support embedded expressions with ${} as well as multi-line strings.
Question 31
What is the value of 10 % 3?
C. true
D. false
Correct Answer: B
Explanation: The || operator returns the right operand when the left is falsy. Since 0 is falsy, "default" is returned.
Question 34
Which of the following describes the ?? operator?
A. It returns the right operand if the left is falsy.
B. It returns the right operand only if the left is null or undefined.
C. It performs strict equality comparison.
D. It coerces both operands to booleans.
Correct Answer: B
Explanation: Nullish coalescing returns the right side only for null or undefined, unlike || which triggers on any falsy value.
Question 35
What is the result of [1,2,3].length?
D. undefined
Correct Answer: B
Explanation: The length property returns the number of elements in the array, which is 3.
Question 36
A developer declares var x = 1; var x = 2;. What happens?
A. SyntaxError
B. TypeError
C. x equals 2.
D. x equals 1.
Correct Answer: C
Explanation: var allows redeclaration in the same scope. The second assignment overwrites the first, so x equals 2.
Question 37
Which method removes the last element from an array and returns it?
A. shift()
B. pop()
C. slice()