MCQ Bank
Where can $ still be used after noConflict()?
- A) Only in CSS
- B) Inside a function where it is passed as a parameter
- C) Nowhere
- D) Anywhere in code
A while loop executes:
- A) A fixed number of times
- B) Infinite number of times
- C) Only once
- D) As long as the condition remains true
How can we access a form using JavaScript?
- A) window.form()
- B) document.getElementByClass()
- C) document.forms["formName"]
- D) getForm()
undefined means:
- A) Value not assigned yet
- B) Null value
- C) String value
- D) Number value
Loop performance improves when you:
- A) Increase iterations
- B) Use recursion
- C) Move calculations outside the loop
- D) Add extra variables
What happens when a break statement is executed?
- A) The loop terminates immediately and control exits the loop
- B) Only one iteration is skipped
- C) The loop restarts
- D) The loop continues execution
Default parameters help to:
- A) Remove function
- B) Stop execution
- C) Prevent undefined values in functions
- D) Create loops
The unary + operator is used to:
- A) Convert a string into a number
- B) Convert a boolean into a string
- C) Convert an object into an array
- D) Convert a number into a string
AJAX is about:
- A) Both Sending and receiving data from server by reloading the whole page
- B) Receiving data from server without 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 is the purpose of the pop() method in JavaScript arrays?
- A) Sorts the elements of the array
- B) Adds an element at the beginning of the array
- C) Removes the last element from the array
- D) Removes the first element from the array
Which of the following method(s) is/are used for traversing up the DOM tree?
- A) parents() and grandParents()
- B) parent()
- C) parental()
- D) grandParents()
What value will be returned by the following JavaScript expression?
1 == "1"
- A) NaN
- B) Infinity
- C) True
- D) False
Which of the following statement is correct about Associative arrays?
- A) Arrays with named indexes.
- B) Arrays without named indexes.
- C) Arrays with indexes.
- D) Arrays without indexes.
What value will be returned by the following expression? 1 === "1"
- A) False
- B) NaN
- C) True
- D) -Infinity
Which of the following is not a valid JavaScript variable?
- A) None of the given options
- B) number
- C) 2number
- D) mynumber2
What value will be returned by the following expression?
0 == true
- A) False
- B) Infinity
- C) NaN
- D) True
For bit wise operations, a numeric operand is converted into ____________ binary numbers.
- A) 32-bit
- B) 8-bit
- C) 64-bit
- D) 16-bit
What will be the sequence of elements in the array "colour" after using sort function on it?
var colour = ["Blue", "Pink", "Purple", "Black"];
colour.sort();
- A) ["Black", "Purple ", "Pink ", "Blue "];
- B) ["Purple", "Pink", "Blue ", "Black"];
- C) ["Blue", "Pink", "Purple", "Black"];
- D) ["Black", "Blue ", "Pink ", "Purple "];
Which of the following function is used to define an alternative sort order?
- A) None of the above.
- B) Alternative function.
- C) Comparison function.
- D) Compare function.
Which of the following is NOT true about JavaScript?
- A) JavaScript can change HTML Attributes.
- B) JavaScript can not change HTML Content.
- C) JavaScript can change HTML Content.
- D) None of the given options