MCQ Bank
______________________ is used to Insert content at the end of the selected elements.
- A) Prepend()
- B) Before()
- C) After()
- D) Append()
GET request sends data via:
- A) Header only
- B) Cookie
- C) URL
- D) Body
What is the best way to create an object in JavaScript?
- A) new Object()
- B) {} (object literal)
- C) create()
- D) Object()
How can you determine if a variable is an array in JavaScript?
- A) Inspecting the variable's constructor
- B) Using the typeof operator
- C) Checking if the variable's type is "array"
- D) Using the isArray() function
Which of the following is syntax of creating XMLHttpRequest?
- A) new AJAX()
- B) new HTTPRequest()
- C) createRequest()
- D) new XMLHttpRequest()
Which loop evaluates the condition after executing the code block?
- A) for loop
- B) do/while loop
- C) if statement
- D) while loop
The unary + operator is used to:
- A) Convert an object into an array
- B) Convert a number into a string
- C) Convert a string into a number
- D) Convert a boolean into a string
undefined means:
- A) String value
- B) Value not assigned yet
- C) Null value
- D) Number value
What is the function of document ready event?
- A) None of the given options
- B) To prevent an event from performing its default action
- C) To prevent any jQuery code from running after the document has finished loading
- D) To prevent any jQuery code from running before the document is finished loading
Which key is commonly used to open Developer Tools in most browsers?
- A) F10
- B) F12
- C) F5
- D) F1
HTML validation is performed by:
- A) Server only
- B) Browser automatically
- C) JavaScript only
- D) Database
Which of the following is a fast, small, and feature-rich JavaScript library?
- A) SQuery
- B) None of the given options
- C) FQuery
- D) jQuery
Which attribute triggers validation on form submit?
- A) onclick
- B) onsubmit
- C) onload
- D) onchange
What is responseXML used for?
- A) Rendering HTML only
- B) Handling CSS data
- C) Parsing XML response data
- D) Processing JSON only
What does setting async = true mean in an AJAX request?
- A) The server does not respond
- B) The browser stops execution until response is received
- C) The request is disabled
- D) The request runs in the background without blocking the page
What is the result of typeof NaN?
- A) string
- B) number
- C) undefined
- D) NaN
Which of the following method(s) is/are used for traversing up the DOM tree?
- A) parent()
- B) grandParents()
- C) parental()
- D) parents() and grandParents()
Loop performance improves when you:
- A) Move calculations outside the loop
- B) Use recursion
- C) Increase iterations
- D) Add extra variables
Why should we avoid eval()?
- A) All of the above
- B) It is unnecessary
- C) It has security risks
- D) It is slow
The break statement is commonly used in:
- A) Objects
- B) Functions
- C) Loops and switch statements
- D) Arrays