Fundamentals of Front End Development MCQs with Answers
Practice important Fundamentals of Front End Development MCQs with answers and explanations.
Multiple Choice Questions
Q1631: How can you reuse a Web Worker after it has been terminated?
- A: By re-initializing it
- B: By setting the worker variable to undefined
- C: By creating a new worker object
- D: By calling terminate() again
View Answer
B
Q1632: Fill in the blank: Web Workers do not have access to the ______ object.
- A: document
- B: location
- C: navigator
- D: history
View Answer
A
Q1633: What is the purpose of the onmessage event listener in a Web Worker?
- A: To send messages to the worker
- B: To receive messages from the worker
- C: To terminate the worker
- D: To create a new worker
View Answer
B
Q1634: Fill in the blank: After creating a new Web Worker, you can listen for messages using the ______ property.
- A: onmessage
- B: postmessage
- C: ondata
- D: messageevent
View Answer
A
Q1635: What is the purpose of Server-Sent Events (SSE) in HTML5?
- A: To send updates to the server
- B: To receive updates from the server
- C: To manage client-side storage
- D: To handle client-server requests
View Answer
B
Q1636: How do you create a new EventSource object in JavaScript?
- A: var source = new EventSource("sse.php");
- B: var source = new EventSource("data.sse");
- C: var source = new EventSource("update.php");
- D: var source = new EventSource("events.php");
View Answer
A
Q1637: What is the correct content type for server-sent events?
- A: application/json
- B: text/html
- C: text/event-stream
- D: application/x-www-form-urlencoded
View Answer
C
Q1638: What method is used to handle incoming messages from an EventSource object?
- A: onmessage
- B: onupdate
- C: ondata
- D: onreceive
View Answer
A
Q1639: Fill in the blank: To check for Server-Sent Events support, use if(typeof(EventSource) !== "______").
- A: "undefined"
- B: "null"
- C: "object"
- D: "function"
View Answer
A
Q1640: What should you set the "Content-Type" header to in server-side code for SSE?
- A: application/json
- B: text/html
- C: text/event-stream
- D: application/x-www-form-urlencoded
View Answer
C