11.) How do you set a custom HTTP header in an AJAX request?
A) addHeader()
B) setRequestHeader()
C) customHeader()
D) appendHeader()
12.) What is the purpose of the abort() method in AJAX?
A) Cancels an ongoing request
B) Logs errors in the request
C) Resends the request
D) Closes the connection
13.) Which HTTP response code indicates a successful request?
14.) What does a 404 HTTP response code mean?
A) Server error
B) Resource not found
C) Request timeout
D) Forbidden request
15.) Which AJAX technique updates only parts of a web page?
A) Partial rendering
B) DOM parsing
C) Page refresh
D) Lazy loading
16.) How do you handle errors in the Fetch API?
A) Using a catch() block
B) Using try…catch
C) Using onerror
D) Using then()
17.) What is the default content type for POST requests in AJAX?
A) text/plain
B) application/json
C) application/x-www-form-urlencoded
D) multipart/form-data
18.) What is JSONP in the context of AJAX?
A) A modern AJAX API
B) A method to fetch JSON data from other domains
C) A JSON parser for browsers
D) A replacement for XMLHttpRequest
19.) Which HTTP method is idempotent?
A) GET
B) POST
C) PUT
D) DELETE
20.) What does the credentials option in the Fetch API specify?
A) Include cookies in requests
B) Redirect behavior
C) Cache policy
D) Request timeout
Related