MCQ Bank
Which one is a reserved word?
- A) value
- B) myVar
- C) name
- D) class
A trailing comma in an array may cause:
- A) No change at all
- B) Better performance
- C) Unexpected behavior or errors in some cases
- D) Faster execution
All selectors in jQuery start with _______________.
- A) ~()
- B) $()
- C) %()
- D) #()
When does the finally block run in JavaScript?
- A) Only when there is an error
- B) It always runs whether there is an error or not
- C) Only when there is no error
- D) It never runs
How do you create an array in JavaScript using literal syntax?
- A) var arr = <>
- B) var arr = []
- C) var arr = ()
- D) var arr = {}
In DOM tree, a descendant can be ___________.
- A) Child, grand-child, great grand-child and so on.
- B) Parent, grand parent, great grand-parent and so on.
- C) Siblings
- D) All of the given options
What is the result of the expression "2" > "12" in JavaScript?
- A) Runtime error
- B) false
- C) true
- D) NaN
innerWidth() method of JQuery returns:
- A) width of an element including border
- B) width of an element excluding border
- C) width of an element including padding
- D) width of an element excluding padding
What is the result of Number("3.14")?
- A) NaN
- B) 3
- C) "3.14"
- D) 3.14
Which approach improves code reusability in AJAX programs?
- A) Loop structure
- B) Array usage
- C) Switch statement
- D) Callback function
What is the role of the first statement in a for loop?
- A) To display output
- B) To define the loop condition
- C) To initialize the loop variable
- D) To increment the loop variable
Which property returns XML data?
- A) getXML
- B) XMLResponse
- C) responseText
- D) responseXML
AJAX is about:
- A) Receiving data from server without reloading the whole page
- B) Both Sending and receiving data from server by reloading the whole page
- C) Sending data to server without reloading the whole page
- D) Both sending and receiving data from server without reloading the whole page
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