Each question below shows the correct answer with a full explanation. Use these to build conceptual understanding before attempting a timed quiz.
Advanced JavaScriptEasy
Q1. What is a Promise in JavaScript?
- A.A looping construct for iterating over arrays
- B.A type of variable for storing constant values
- C.A guarantee of optimal performance metrics
- D.An object representing an async operation result✓ Correct
Explanation
A Promise represents an asynchronous operation that will eventually resolve or reject.
Report an error in this question
Advanced JavaScriptEasy
Q2. What keyword makes a function asynchronous?
- A.defer
- B.await
- C.promise
- D.async✓ Correct
Explanation
The async keyword makes a function return a Promise.
Report an error in this question
Advanced JavaScriptEasy
Q3. What does the await keyword do?
- A.Stops the program from running permanently
- B.Pauses async execution until a Promise settles✓ Correct
- C.Creates a timed delay between code statements
- D.Waits for CSS stylesheets to fully load
Explanation
await pauses async function execution until the Promise resolves.
Report an error in this question
Advanced JavaScriptEasy
Q4. What is the spread operator in JavaScript?
- A.The ... operator expanding iterables into elements✓ Correct
- B.The => operator for defining arrow function bodies
- C.The ** operator for exponentiation calculations
- D.The -> operator for creating arrow function syntax
Explanation
The spread operator (...) expands arrays, objects, or strings into individual elements.
Report an error in this question
Advanced JavaScriptEasy
Q5. What is an arrow function?
- A.A function that draws arrow graphics on canvas
- B.A built-in math function for calculations
- C.A recursive function that calls itself repeatedly
- D.A shorter syntax for writing functions using =>✓ Correct
Explanation
Arrow functions provide a concise syntax and do not have their own this binding.
Report an error in this question
Advanced JavaScriptEasy
Q6. What does fetch() do in JavaScript?
- A.Makes HTTP requests to retrieve network resources✓ Correct
- B.Downloads files directly to the local disk
- C.Imports CSS files into a JavaScript module
- D.Fetches DOM elements by their CSS selectors
Explanation
fetch() provides a modern way to make HTTP requests and returns a Promise.
Report an error in this question
Advanced JavaScriptEasy
Q7. What is a JavaScript module?
- A.A debugging tool for inspecting runtime state
- B.A browser plugin for extending functionality
- C.A testing framework for unit test execution
- D.A file that exports and imports reusable code✓ Correct
Explanation
Modules allow code to be organized into separate files that export and import code.
Report an error in this question
Advanced JavaScriptEasy
Q8. Which keyword is used to export from a module?
- A.output
- B.export✓ Correct
- C.module
- D.send
Explanation
The export keyword makes functions, objects, or values available for import.
Report an error in this question
Advanced JavaScriptEasy
Q9. What is the rest parameter in JavaScript?
- A.A sleep function that pauses code execution
- B.Syntax (...args) collecting remaining arguments✓ Correct
- C.A default parameter value for function calls
- D.A parameter specifically for REST API calls
Explanation
The rest parameter (...args) collects all remaining function arguments into an array.
Report an error in this question
Advanced JavaScriptEasy
Q10. What is try...catch used for?
- A.Testing CSS styles in the browser
- B.Importing modules from external files
- C.Handling errors and exceptions in code✓ Correct
- D.Creating loops that iterate over data
Explanation
try...catch handles runtime errors by catching exceptions.
Report an error in this question
Advanced JavaScriptMedium
Q11. What is Promise.all() used for?
- A.Running multiple promises and waiting for all✓ Correct
- B.Creating a sequential promise chain
- C.Resolving only a single individual promise
- D.Canceling all pending promises at once
Explanation
Promise.all() returns a single promise that resolves when all input promises resolve.
Report an error in this question
Advanced JavaScriptMedium
Q12. What is the difference between Promise.all() and Promise.allSettled()?
- A.Promise.allSettled() also fails immediately on rejection
- B.Promise.all() is always slower in execution speed
- C.Promise.all() fails on rejection; allSettled() waits for all✓ Correct
- D.They are identical in their behavior
Explanation
Promise.all() short-circuits on rejection, while Promise.allSettled() waits for all to settle.
Report an error in this question
Advanced JavaScriptMedium
Q13. What is optional chaining (?.) in JavaScript?
- A.Safely accesses nested properties without errors✓ Correct
- B.A ternary operator for conditional expressions
- C.A loop syntax for iterating over object entries
- D.A regex operator for pattern matching in strings
Explanation
Optional chaining returns undefined instead of throwing when accessing properties of null or undefined.
Report an error in this question
Advanced JavaScriptMedium
Q14. What is the nullish coalescing operator (??)?
- A.A ternary for inline conditional expressions
- B.Returns right operand when left is null/undefined✓ Correct
- C.A logical OR for boolean expressions
- D.A strict equality check comparing type and value
Explanation
?? returns the right operand only when the left is null or undefined.
Report an error in this question
Advanced JavaScriptMedium
Q15. What is a Proxy in JavaScript?
- A.A web proxy server for routing network traffic
- B.An object wrapping another to intercept operations✓ Correct
- C.A network library for making HTTP request calls
- D.A design pattern used only in OOP code contexts
Explanation
A Proxy wraps an object and lets you define custom behavior for fundamental operations.
Report an error in this question
Advanced JavaScriptMedium
Q16. What is the purpose of Object.entries()?
- A.To merge multiple objects into a combined one
- B.To return an array of [key, value] pairs✓ Correct
- C.To create new entries within an object literal
- D.To check if a specific object reference exists
Explanation
Object.entries() returns an array of [key, value] pairs from an object.
Report an error in this question
Advanced JavaScriptMedium
Q17. What is a Set in JavaScript?
- A.A type of map for key-value pair storage
- B.An array method for modifying element order
- C.A function to set values on object properties
- D.A collection of unique values with no duplicates✓ Correct
Explanation
A Set stores unique values of any type, automatically removing duplicates.
Report an error in this question
Advanced JavaScriptMedium
Q18. What is dynamic import in JavaScript?
- A.Using import() to load modules on demand at runtime✓ Correct
- B.Importing CSS styles dynamically at runtime
- C.Importing all application modules simultaneously
- D.A feature exclusive to the Webpack bundler tool
Explanation
Dynamic import() loads modules on demand, enabling code splitting.
Report an error in this question
Advanced JavaScriptMedium
Q19. What is the for...of loop used for?
- A.Iterating over the keys of an object
- B.Executing queries against a database
- C.A C-style for loop with index counters
- D.Iterating over values of iterable objects✓ Correct
Explanation
for...of iterates over the values of iterable objects.
Report an error in this question
Advanced JavaScriptMedium
Q20. What does Object.assign() do?
- A.Compares two objects for deep structural equality
- B.Assigns type annotations to JavaScript objects
- C.Creates a deep copy of all nested objects
- D.Copies enumerable own properties to a target (shallow)✓ Correct
Explanation
Object.assign() performs a shallow copy of properties from source to target objects.
Report an error in this question
Advanced JavaScriptHard
Q21. What is the difference between microtasks and macrotasks?
- A.Microtasks run on a separate background thread
- B.Macrotasks always have higher execution priority
- C.They are identical in execution priority
- D.Microtasks execute before macrotasks in the loop✓ Correct
Explanation
Microtasks are processed before the next macrotask in each event loop iteration.
Report an error in this question
Advanced JavaScriptHard
Q22. What is a SharedArrayBuffer?
- A.A binary data buffer shared between workers✓ Correct
- B.A database buffer for caching query results
- C.A shared CSS buffer for component styling
- D.An array with elements shared across files
Explanation
SharedArrayBuffer allows sharing memory between the main thread and web workers.
Report an error in this question
Advanced JavaScriptHard
Q23. What is the Reflect API in JavaScript?
- A.A browser debugging tool for inspecting elements
- B.A library for creating mirror image visual effects
- C.A CSS reflection API for reflecting element visuals
- D.A built-in object with interceptable operation methods✓ Correct
Explanation
Reflect provides static methods matching Proxy trap operations.
Report an error in this question
Advanced JavaScriptHard
Q24. What is structural typing in TypeScript?
- A.TypeScript uses nominal typing with explicit declarations
- B.JavaScript has stronger typing than TypeScript overall
- C.They use the identical type system without differences
- D.TypeScript checks compatibility based on type structure✓ Correct
Explanation
TypeScript uses structural typing where compatibility is determined by the shape of data.
Report an error in this question
Advanced JavaScriptHard
Q25. What is the AbortController API?
- A.A process manager for handling background server tasks
- B.An error handling mechanism for catching thrown errors
- C.An API to cancel fetch requests and async operations✓ Correct
- D.A method to stop all JavaScript execution immediately
Explanation
AbortController provides a signal to cancel ongoing asynchronous operations.
Report an error in this question
Advanced JavaScriptHard
Q26. What are Decorators in JavaScript/TypeScript?
- A.Functions that modify classes and members via @ syntax✓ Correct
- B.String formatting tools for template processing
- C.CSS decorations like border styles and shadows
- D.HTML attributes added to elements for metadata
Explanation
Decorators are special functions prefixed with @ that modify class declarations and members.
Report an error in this question
Advanced JavaScriptHard
Q27. What is the structuredClone() function?
- A.A function creating deep copies via structured clone✓ Correct
- B.A CSS cloning function for duplicating style rules
- C.A function to clone the DOM structure of elements
- D.A shallow copy method copying only top-level values
Explanation
structuredClone() creates a deep copy handling nested structures and circular references.
Report an error in this question
Advanced JavaScriptHard
Q28. What is the difference between for...in and for...of?
- A.for...in only works with arrays not objects
- B.for...of iterates over property keys of objects
- C.They are identical in their iteration behavior
- D.for...in iterates keys; for...of iterates values✓ Correct
Explanation
for...in loops over property names, while for...of loops over values of iterables.
Report an error in this question
Advanced JavaScriptHard
Q29. What is a FinalizationRegistry in JavaScript?
- A.An API to register a callback when an object is GC'd✓ Correct
- B.A module registry for tracking installed packages
- C.A service worker registry for managing active workers
- D.A software design pattern for object creation
Explanation
FinalizationRegistry registers cleanup callbacks that execute when objects are garbage collected.
Report an error in this question
Advanced JavaScriptHard
Q30. What is the Intl object in JavaScript?
- A.An interface definition for declaring TypeScript contracts
- B.An interval timer for scheduling repeated function calls
- C.An internal object for private variable storage
- D.A namespace for Internationalization with locale formatting✓ Correct
Explanation
Intl provides constructors for locale-sensitive formatting of strings, numbers, and dates.
Report an error in this question