Javascript & DOM - Graded Quiz
10. Which method is used to create a new element in the DOM using JavaScript?
- createElement()
- createNode()
- addElement()
- appendChild()
11. What is AJAX an abbreviation for?
- Asynchronous JavaScript and XML
- Asynchronous JSON and XML
- Asynchronous JavaScript and XHTML
- Asynchronous JSON and XHTML
12. Which method is used to send an AJAX request in JavaScript?
- sendRequest()
- createRequest()
- XMLHttpRequest()
- ajaxRequest()
13. What is the purpose of the try-catch statement in JavaScript?
- It is used to define a block of code to be executed repeatedly.
- It is used to define a block of code to be executed conditionally.
- It is used to handle errors and exceptions that may occur during code execution.
- It is used to terminate the execution of a function or loop.
14. What is the purpose of the catch block in a try-catch statement?
- It defines the code to be executed if the try block encounters an error or exception.
- It defines the code to be executed if a specific condition is met.
- It defines the code to be executed unconditionally after the try block.
- It defines the code to be executed before the try block.
15. Which method is used to remove an element from the DOM using JavaScript?
- removeChild()
- deleteElement()
- removeElement()
- detachElement()
16. What is the purpose of the load event in AJAX?
- It is triggered when an error occurs during the AJAX request.
- It is triggered when the response from the AJAX request is received.
- It is triggered when the AJAX request is sent.
- It is triggered when the DOM is fully loaded and parsed.
17. Which statement is used to throw a custom error or exception in JavaScript?
- raiseError()
- throwException()
- throwError()
- throw
18. What is the purpose of the finally block in a try-catch statement?
- It defines the code to be executed if the try block encounters an error or exception.
- It defines the code to be executed if a specific condition is met.
- It defines the code to be executed unconditionally after the try block.
- It defines the code to be executed regardless of whether an error or exception occurred.
19. Which method is used to handle AJAX errors in JavaScript?
- handleError()
- onerror()
- catchError()
- onreadystatechange()