














































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
The Javascript Certification Ultimate Exam is a detailed study resource designed for individuals preparing for JavaScript certification exams and web development assessments. This exam prep covers JavaScript syntax, DOM manipulation, ES6 features, asynchronous programming, APIs, event handling, functions, objects, arrays, debugging, and frontend development concepts. Learners gain practical knowledge and test-taking experience needed to strengthen coding skills and successfully complete JavaScript certification examinations.
Typology: Exams
1 / 54
This page cannot be seen from the preview
Don't miss anything!















































Question 1. Which component of the V8 engine is primarily responsible for managing function call order? A) Heap B) Call Stack C) RegExp Engine D) Garbage Collector Answer: B Explanation: The call stack tracks the order in which functions are invoked and completed, ensuring proper execution flow. Question 2. In JavaScript, what is the result of executing 'use strict'; at the top of a script? A) Enables automatic semicolon insertion B) Disables variable hoisting entirely C) Throws errors for assignments to undeclared variables D) Converts all strings to uppercase Answer: C Explanation: Strict mode enforces cleaner code by throwing errors when assigning to variables that haven’t been declared. Question 3. Which of the following statements about lexical environments is true? A) They are created only for global code B) They determine variable accessibility based on runtime scope C) They are formed during the creation phase of an execution context D) They are discarded before the execution phase begins Answer: C Explanation: A lexical environment is established during the creation phase, capturing variable bindings for later reference. Question 4. When configuring a Node.js project, which file defines the entry point and dependencies?
A) .npmrc B) package.json C) node_modules.json D) index.js Answer: B Explanation: package.json holds metadata, the main script, and a list of dependencies required by the project. Question 5. Which statement correctly describes the temporal dead zone (TDZ) for let declarations? A) The variable is accessible before its declaration but holds undefined B) Accessing the variable before its declaration throws a ReferenceError C) The variable is hoisted to the top of the scope with its initial value D) TDZ only applies to var declarations Answer: B Explanation: let and const are hoisted but remain uninitialized until their declaration is evaluated; accessing them earlier causes a ReferenceError. Question 6. Which primitive type can store arbitrarily large integers without loss of precision? A) Number B) BigInt C) Symbol D) Boolean Answer: B Explanation: BigInt represents whole numbers beyond the safe integer limit of the Number type. Question 7. What will the expression 0 == false evaluate to? A) true B) false
Answer: B Explanation: Mark-and-sweep identifies reachable objects (mark) and frees those not marked (sweep), efficiently handling cyclic references. Question 11. Which loop construct guarantees at least one execution of its body? A) for B) while C) do...while D) for...in Answer: C Explanation: do...while evaluates its condition after executing the loop body, ensuring a single run regardless of the condition. Question 12. What does the for...of loop iterate over? A) Object property names B) Array indices only C) Iterable values such as strings, arrays, and Sets D) Prototype chain keys Answer: C Explanation: for...of works with any object that implements the iterable protocol, yielding each value directly. Question 13. Which array method creates a new array containing the results of applying a function to each element of the original array? A) filter() B) map() C) reduce() D) slice() Answer: B Explanation: map() transforms each element and returns a new array with the transformed values.
Question 14. In a nested loop, which statement correctly uses continue to skip the current iteration of the inner loop only? A) continue outer; B) continue; inside the inner loop C) break; inside the inner loop D) continue inner; Answer: B Explanation: A plain continue affects the nearest enclosing loop, which in this case is the inner loop. Question 15. Which of the following is a function expression? A) function foo() {} B) var foo = function() {}; C) function* foo() {} D) class foo {} Answer: B Explanation: Assigning an anonymous function to a variable creates a function expression; it is not hoisted like a declaration. Question 16. How does an arrow function differ from a regular function regarding the this keyword? A) It binds this dynamically based on the caller B) It has its own this context created at runtime C) It lexically inherits this from the surrounding scope D) It throws an error if this is accessed Answer: C Explanation: Arrow functions capture the this value of the enclosing lexical environment, ignoring how they are called. Question 17. Which higher-order function is commonly used to accumulate a single value from an array?
C) Object literal shorthand D) Class static property Answer: B Explanation: An IIFE can encapsulate variables, exposing only the returned API while keeping internal state private. Question 20. What does the spread operator (...) do when used in a function call? A) Merges two objects into one B) Expands an iterable into individual arguments C) Creates a shallow copy of an object D) Converts a string into an array of characters Answer: B Explanation: In a call context, ... spreads the elements of an iterable so they become separate arguments to the function. Question 21. Which syntax correctly defines a method inside an object literal without the function keyword? A) method: function() {} B) method() {} C) method => {} D) method = () => {} Answer: B Explanation: ES6 object literal shorthand allows defining methods as method() {} without function. Question 22. In which scenario does the value of this refer to the global object (window in browsers)? A) Inside an arrow function defined in a class method B) In a regular function called without an explicit receiver in non-strict mode C) Inside a method invoked via obj.method() D) In a constructor function executed with new
Answer: B Explanation: When a regular function is invoked without a context and not in strict mode, this defaults to the global object. Question 23. What is the purpose of Object.create(proto)? A) To clone an object including its own properties B) To create a new object with the specified prototype and no own properties C) To merge two objects into a new one D) To freeze an object preventing further modifications Answer: B Explanation: Object.create() sets the prototype of the new object to proto, establishing inheritance without copying properties. Question 24. Which statement about the class syntax is false? A) Methods defined in a class are non-enumerable by default B) Classes are hoisted like function declarations C) A class can have a constructor method D) Static methods are called on the class itself, not instances Answer: B Explanation: Classes are not hoisted; they exist only after the class declaration is evaluated. Question 25. How do you declare a private class field according to the ES specification? A) private name; B) #name; C) _name; D) this.name = private; Answer: B Explanation: Prefixing a field with # makes it truly private, inaccessible outside the class body.
D) null Answer: C Explanation: An async function implicitly returns a resolved promise with the returned value, so .then receives 42. Question 29. Which method returns a promise that resolves when all supplied promises have settled, regardless of rejections? A) Promise.all B) Promise.race C) Promise.allSettled D) Promise.any Answer: C Explanation: Promise.allSettled waits for every promise to settle and provides an array describing each outcome. Question 30. In the DOM, which method retrieves the first element that matches a CSS selector? A) document.getElementsByClassName B) document.querySelector C) document.getElementById D) document.select Answer: B Explanation: querySelector accepts any CSS selector and returns the first matching element. Question 31. Which phase of event propagation occurs first? A) Bubbling B) Capturing C) Target D) Default action Answer: B
Explanation: During event flow, capturing travels from the document root down to the target before bubbling back up. Question 32. What does event.preventDefault() do? A) Stops the event from propagating to parent elements B) Cancels the default behavior associated with the event C) Removes the event listener automatically D) Converts the event into a custom event Answer: B Explanation: preventDefault() tells the browser not to perform the action it normally would for that event (e.g., following a link). Question 33. Which technique improves performance by handling many child element clicks with a single listener on the parent? A) Event bubbling B) Event delegation C) Event capturing D) Event throttling Answer: B Explanation: Event delegation leverages bubbling to listen once on a common ancestor, reducing the number of listeners. Question 34. Which Web Storage API persists data even after the browser is closed? A) sessionStorage B) localStorage C) cookies D) IndexedDB (transient mode) Answer: B Explanation: localStorage stores key/value pairs without expiration, surviving browser restarts.
C) It removes all breakpoints from the script D) It only works in Node.js, not browsers Answer: B Explanation: When the JavaScript runtime reaches debugger and dev tools are active, execution halts as if a breakpoint were set. Question 39. In Jest, which function is used to group related tests? A) test() B) describe() C) it() D) suite() Answer: B Explanation: describe() creates a test suite, allowing logical grouping of multiple test/it blocks. Question 40. Which syntax correctly imports the default export from a module named utils.js? A) import { default } from './utils.js'; B) import utils from './utils.js'; C) require('./utils.js'); D) import * as utils from './utils.js'; Answer: B Explanation: The default export is imported without braces using the chosen identifier. Question 41. Which of the following statements about CommonJS modules is false? A) They use module.exports to expose values B) They are loaded synchronously C) They support named imports via import { foo } from syntax without transpilation D) They are the default module system in Node.js
Answer: C Explanation: CommonJS uses require; the ES6 import syntax requires transpilation or experimental flags. Question 42. What is the primary purpose of Babel in modern JavaScript development? A) Minify CSS files B) Convert newer JavaScript syntax to a version supported by older environments C) Bundle assets into a single file D) Provide a runtime for server-side rendering Answer: B Explanation: Babel transpiles ES6+ code into backward-compatible JavaScript (e.g., ES5) so older browsers can execute it. Question 43. Which HTTP header helps mitigate Cross-Site Request Forgery (CSRF) attacks? A) Content-Type B) X-Requested-With C) SameSite cookie attribute D) Cache-Control Answer: C Explanation: Setting SameSite on cookies restricts them from being sent with cross-site requests, reducing CSRF risk. Question 44. Which method creates a deep clone of a plain JavaScript object without preserving prototype chains? A) Object.assign({}, obj) B) JSON.parse(JSON.stringify(obj)) C) obj.clone() D) structuredClone(obj) Answer: B
Question 48. In a strict mode script, what happens when you try to delete an undeletable property? A) The operation silently fails B) A SyntaxError is thrown at parse time C) A TypeError is thrown at runtime D) The property is removed anyway Answer: C Explanation: Strict mode makes attempts to delete non-configurable properties raise a TypeError. Question 49. Which statement about the Symbol primitive is true? A) Symbols are automatically converted to strings in concatenation B) Each call to Symbol('desc') creates a globally shared identifier C) Symbols can be used as unique object property keys D) Symbols are mutable values Answer: C Explanation: Symbols guarantee uniqueness, making them ideal for non-colliding property keys. Question 50. Which of the following correctly uses optional chaining to safely access a deep property? A) obj?.prop?.subprop B) obj.prop?.subprop C) obj?.prop.subprop D) obj.prop.subprop? Answer: A Explanation: Optional chaining (?.) stops evaluation and returns undefined if any part of the chain is null or undefined. Question 51. What is the output of the following code?
console.log(0.1 + 0.2 === 0.3);A) true B) false C) TypeError D) NaN Answer: B Explanation: Due to floating-point precision, 0.1 + 0.2 yields 0.30000000000000004, which is not strictly equal to 0.3. Question 52. Which method creates an iterator object for an array? A) Array.iterator() B) array[Symbol.iterator]() C) array.entries() D) array.values() Answer: B Explanation: Accessing the Symbol.iterator property of an array returns its default iterator. Question 53. Which of these statements about Array.prototype.reduceRight is correct? A) It processes elements from left to right B) It cannot be used on empty arrays C) It starts the reduction from the last element toward the first D) It always requires an initial accumulator value Answer: C Explanation: reduceRight iterates from the array’s end toward the beginning, applying the reducer function accordingly. Question 54. In JavaScript, what does the new operator do? A) Calls a function without creating an object
D) It executes promises sequentially Answer: B Explanation: Promise.race settles as soon as the first promise settles, whether fulfilled or rejected. Question 58. Which method removes the last element from an array and returns that element? A) pop() B) shift() C) splice() D) slice() Answer: A Explanation: pop mutates the array by removing its final element and returns it. Question 59. What is the purpose of the __proto__ property in an object? A) To store private data inaccessible to code B) To reference the object's prototype chain C) To define static methods on a class D) To serialize the object to JSON Answer: B Explanation: __proto__ points to the object's prototype, enabling inheritance lookup. Question 60. Which of the following is a correct way to debounce a function using setTimeout? A)
function debounce(fn, d) { let t; return (...a) => { clearTimeout(t); t = setTimeout(() => fn(...a), d); }; } ## ``` ## B) ```js function debounce(fn, d) { return setTimeout(fn, d); }C)
function debounce(fn) { fn(); }D)
function debounce(fn, d) { let t = setTimeout(fn, d); clearTimeout(t); }Answer: A Explanation: The first version resets the timer on each call, ensuring fn runs only after the delay d has passed without further invocations. Question 61. Which array method returns a new array containing only the elements that satisfy a test function? A) map() B) filter() C) reduce() D) some()