MCQ Bank
What does readyState = 4 indicate in an XMLHttpRequest?
- A) Response is fully received and ready to use
- B) Request has not started
- C) Server is disconnected
- D) Request is being sent
Which object is used in AJAX?
- A) WebRequest
- B) XMLHttpRequest
- C) HttpRequest
- D) AJAXObject
Default parameters help to:
- A) Stop execution
- B) Create loops
- C) Remove function
- D) Prevent undefined values in functions
What happens when a break statement is executed?
- A) The loop restarts
- B) Only one iteration is skipped
- C) The loop terminates immediately and control exits the loop
- D) The loop continues execution
In JQuery, outerHeight() method returns:
- A) height of an element excluding padding
- B) height of an element including padding
- C) height of an element including border and padding
- D) height of an element excluding border and padding
In the statement var x = 5;, what gets hoisted?
- A) Nothing is hoisted
- B) The value 5
- C) The declaration var x
- D) The assignment x = 5
Which property returns string response?
- A) responseString
- B) responseText
- C) responseXML
- D) textResponse
What is the purpose of the pop() method in JavaScript arrays?
- A) Adds an element at the beginning of the array
- B) Sorts the elements of the array
- C) Removes the last element from the array
- D) Removes the first element from the array
Which comparison operator is used internally by the switch statement?
- A) <
- B) ===
- C) !=
- D) ==
How do you access the first element of an array cars in JavaScript?
- A) cars(0)
- B) cars.0
- C) cars{0}
- D) cars[0]
Which of the following feature is not part of the jQuery library?
- A) Effects and animations
- B) CSS manipulation
- C) None of the given options
- D) HTML/DOM manipulation
Which of the following is not a loop in JavaScript?
- A) for
- B) while
- C) for/in
- D) do in
Which keyword tests multiple conditions?
- A) switch
- B) break
- C) else if
- D) if
Which of the following function is not for traversing up the DOM tree?
- A) grandParents()
- B) parentsUntil()
- C) parent()
- D) parents()
In JQuery, outerWidth() method returns:
- A) width of an element including padding
- B) width of an element including border and padding
- C) width of an element excluding padding
- D) width of an element excluding border and padding
What term is used to describe arrays with named indexes in programming languages?
- A) Associative arrays
- B) Linear array
- C) Ordinal arrays
- D) Sequential arrays
onreadystatechange triggers when:
- A) State changes
- B) Form submits
- C) User clicks
- D) Page loads
What is the function of the prepend() method?
- A) Adds content after elements
- B) Adds content at the end
- C) Adds content at the beginning of elements
- D) Deletes content
What does parents() method return?
- A) Only child elements
- B) All ancestor elements up to the root element
- C) Only the direct parent
- D) Only sibling elements
What does the text() method return?
- A) Attribute values
- B) CSS styles
- C) Only the text content of elements
- D) HTML code