Skip to main content

Fundamentals of Front End Development MCQs with Answers

Practice important Fundamentals of Front End Development MCQs with answers and explanations.

Multiple Choice Questions

Q1641: How can you append received data to an element in the HTML document using SSE?
  • A: res.innerHTML += event.data + "
  • B: res.innerHTML = event.data;
  • C: res.appendChild(event.data);
  • D: res.textContent += event.data;
View Answer
A

Q1642: Fill in the blank: The server-side event stream syntax requires starting with the header "Content-Type: ______".
  • A: text/event-stream
  • B: application/json
  • C: text/html
  • D: application/x-www-form-urlencoded
View Answer
A

Q1643: What is a key feature of Server-Sent Events compared to older methods of receiving server updates?
  • A: The updates are sent automatically
  • B: The updates require a user prompt
  • C: The updates are sent less frequently
  • D: The updates are encrypted
View Answer
A

Q1644: Which JavaScript event is triggered when a message is received from the EventSource?
  • A: onmessage
  • B: onload
  • C: onerror
  • D: onchange
View Answer
A

Q1645: Fill in the blank: Server-Sent Events only work if the browser supports the ______ object.
  • A: EventSource
  • B: XMLHttpRequest
  • C: Fetch
  • D: WebSocket
View Answer
A

Q1646: What header should be set to enable Server-Sent Events in PHP?
  • A: Content-Type: application/json
  • B: Content-Type: text/html
  • C: Content-Type: text/event-stream
  • D: Content-Type: application/xml
View Answer
C

Q1647: Fill in the blank: In the PHP code, the header('Cache-Control: ______') ensures that the page is not cached.
  • A: no-cache
  • B: private
  • C: public
  • D: max-age=0
View Answer
A

Q1648: What is the correct format for sending data in a Server-Sent Event?
  • A: data: Your data here
  • B: content: Your data here
  • C: message: Your data here
  • D: info: Your data here
View Answer
A

Q1649: Which event occurs when a connection to the server is successfully opened using EventSource?
  • A: onopen
  • B: onmessage
  • C: onerror
  • D: onload
View Answer
A

Q1650: What is the default behavior for caching in Server-Sent Events?
  • A: Caching is enabled
  • B: Caching is disabled
  • C: Caching is optional
  • D: Caching is automatic
View Answer
B

Test Your Knowledge

Take a timed quiz on Fundamentals of Front End Development

🚀 Start Quiz Now