PRACTICE • LEARN • GROW
Module 6 Final Quiz: Asynchronous JavaScript MCQs
Solve topic-wise placement questions and improve your skills.
Module 6 Final Quiz: Asynchronous JavaScript Progress
0 of 12 completed
0%
Topic Track
You are viewing MCQs in preview mode. Log in to select options, submit answers, and track your progress.
Log In to Answer
1
Why does JavaScript require an event loop for non-blocking asynchronous operations?
A.
Because JavaScript uses multiple OS threads for user code
B.
Because JavaScript has a single call stack and would freeze UI rendering if long operations ran synchronously
C.
Because browsers cannot handle callbacks
D.
Because of prototype chain resolution
Explanation & Key
Correct Answer:
2
What will be printed to the console in this event loop ordering question?
console.log('1');
setTimeout(() => console.log('2'), 0);
Promise.resolve().then(() => console.log('3'));
console.log('4');
A.
1 2 3 4
B.
1 4 2 3
C.
1 4 3 2
D.
1 3 4 2
Explanation & Key
Correct Answer:
3
Which queue has strictly higher priority when the event loop checks for pending work?
A.
The Macrotask Queue (Task Queue)
B.
The Microtask Queue (Promises, queueMicrotask)
C.
Both queues alternate equally
D.
The rendering queue
Explanation & Key
Correct Answer:
4
What are the three possible states of a JavaScript Promise?
A.
Initial, Running, Complete
B.
Pending, Fulfilled, Rejected
C.
Active, Inactive, Suspended
D.
Waiting, Succeeded, Failed
Explanation & Key
Correct Answer:
5
What does an
async function always return?
A.
The raw value returned by its return statement
B.
A Promise (wrapping the returned value if it is not already a promise)
C.
An event listener
D.
undefined
Explanation & Key
Correct Answer:
6
What does the
await keyword actually pause?
A.
The entire JavaScript runtime thread and browser UI
B.
Only execution of the enclosing async function, allowing other script tasks and UI events to continue executing
C.
All network traffic in the browser
D.
The call stack indefinitely
Explanation & Key
Correct Answer:
7
How should errors be handled inside an async/await function?
A.
With a .catch() method call directly after await
B.
Wrapping the awaited calls in a standard try...catch block
C.
Using window.onerror
D.
Errors cannot be caught in async/await
Explanation & Key
Correct Answer:
8
What does
Promise.all([p1, p2, p3]) do if ONE promise rejects?
A.
It waits for all others to finish and ignores the error
B.
It immediately rejects with that error, discarding other results (fail-fast behavior)
C.
It returns an array with null for that rejected promise
D.
It retries the rejected promise
Explanation & Key
Correct Answer:
9
Which Promise combinator waits for ALL promises to settle regardless of whether they resolve or reject?
A.
Promise.race()
B.
Promise.all()
C.
Promise.allSettled()
D.
Promise.any()
Explanation & Key
Correct Answer:
10
What will be logged by this Promise chain?
Promise.resolve(1)
.then(x => x + 1)
.then(x => { throw new Error('Boom'); })
.catch(err => 99)
.then(x => console.log(x));
A.
Boom
B.
99
C.
2
D.
UnhandledPromiseRejection
Explanation & Key
Correct Answer:
11
What is 'Callback Hell' (Pyramid of Doom)?
A.
A recursive function that runs out of memory
B.
Deeply nested asynchronous callback functions that make code horizontal, unreadable, and hard to handle errors for
C.
A loop running infinitely in the event loop
D.
An invalid HTTP request status
Explanation & Key
Correct Answer:
12
What is the output of
setTimeout(fn, 0) when called inside synchronous code?
A.
It executes synchronously before the next line
B.
It is scheduled onto the Macrotask Queue and executes only after all current synchronous code has finished
C.
It cancels the call stack
D.
It executes after 1000 milliseconds
Explanation & Key
Correct Answer:
Question Palette
Answered
Current
Not Attempted
Wrong