Written Answer (Explanation + Code)
Write a code sample (10-15 lines) that demonstrates making a fetch request with custom headers and handling the response. Use proper MDN terminology.
Multiple Choice (Select 1)
Which of the following correctly shows how to send an authentication key in the headers of a Fetch request?
fetch(url, { headers: { Authorization: 'Bearer token123' } })
fetch(url, { auth: 'Bearer token123' })
fetch(url).headers('Authorization', 'Bearer token123')
fetch(url).auth('Bearer token123')
What is the correct way to submit form data using Fetch and handle the response?
fetch(url, { method: 'POST', body: new FormData(form) }).then(r => r.json())
fetch(url, { method: 'POST', form: form }).then(r => r.text())
fetch.post(url, form).then(r => r.json())
fetch(url).form(new FormData(form)).then(response)
Multiple Select (Select all that apply)
Which of the following statements about JavaScript data types are correct?
null
undefined
Which control flow statement is best suited for checking a single variable against multiple possible values?
if...else if...else
switch
for
while
Which of the following are layers in the HTTP communication stack?
What does the header Access-Control-Allow-Origin: * mean?
Access-Control-Allow-Origin: *
What does cors({origin: true}) in Express do?
cors({origin: true})
Which statements correctly describe the differences between XML and HTML?
Which of the following is an example of well-formed XML?
<person><name>John</name><age>30</age></person>
<person><name>John</Name><age>30</person>
<person><name>John</name><age>30</person>
<Person><Name>John</name></Person>
Which of these are debugging features available in browser developer tools?
Which of the following best describes the difference between debugging methods and debugging techniques?
Which storage option is best suited for storing large amounts of data including files and blobs?
Which of the following are valid client-side storage mechanisms in browsers?
What is the correct order of the CSS box model from inside to outside?
When styling a web page to achieve specific visual results, which of the following should you consider?
Which of the following are valid UML diagram types used in software design?
Which of the following are recognized software development methodologies?
What is a key difference between Agile/Scrum and Waterfall methodologies?