πŸ“Š Machine Learning
Q. Which method receives the return value of setInterval() to cancel future invocations?
  • (A) clearInvocation()
  • (B) cancelInvocation()
  • (C) clearInterval()
  • (D) None of the mentioned
πŸ’¬ Discuss
βœ… Correct Answer: (C) clearInterval()

Explanation: Like setTimeout(), setInterval() returns a value that can be passed to clearInterval() to cancel any future invocations of the scheduled function.

πŸ“Š Machine Learning
Q. The setTimeout() belongs to which object?
  • (A) Element
  • (B) Window
  • (C) Location
  • (D) None of the mentioned
πŸ’¬ Discuss
βœ… Correct Answer: (B) Window

Explanation: The setTimeout() method of the Window object schedules a function to run after a specified number of milliseconds elapses.

πŸ“Š Machine Learning
Q. Which method receives the return value of setTimeout() to cancel future invocations?
  • (A) clearTimeout()
  • (B) clearInterval()
  • (C) clearSchedule()
  • (D) none of the mentioned
πŸ’¬ Discuss
βœ… Correct Answer: (A) clearTimeout()

Explanation: setTimeout() returns a value that can be passed to clearTimeout() to cancel the execution of the scheduled function.

πŸ“Š Machine Learning
Q. What will happen if we call setTimeout() with a time of 0 ms?
  • (A) Placed in stack
  • (B) Placed in queue
  • (C) Will run continuously
  • (D) None of the mentioned
πŸ’¬ Discuss
βœ… Correct Answer: (B) Placed in queue

Explanation: If you call setTimeout() with a time of 0 ms, the function you specify is not invoked right away. Instead, it is placed on a queue to be invoked “as soon as possible” after any currently pending event handlers finish running.

πŸ“Š Machine Learning
Q. To which object does the location property belong?
  • (A) Window
  • (B) Position
  • (C) Element
  • (D) Location
πŸ’¬ Discuss
βœ… Correct Answer: (A) Window

Explanation: The location property of the Window object refers to a Location object, which represents the current URL of the document displayed in the window, and which also defines methods for making the window load a new document.

πŸ“Š Machine Learning
Q. What is the result of the following code snippet?
window.location === document.location
  • (A) False
  • (B) True
  • (C) 0
  • (D) 1
πŸ’¬ Discuss
βœ… Correct Answer: (B) True

Explanation: The above code always results in a true value.