Animation(Javascript ) Questions and Answers

Question 1. Which of the following can be implemented using animation?
  1.    Fireworks
  2.    Fade Effect
  3.    Roll-in or Roll-out
  4.    All of the mentioned
Explanation:-
Answer: Option D. -> All of the mentioned
You can use JavaScript to create a complex animation which includes but not limited to:
1. Fireworks
2. Fade Effect
3. Roll-in or Roll-out
4. Page-in or Page-out
5. Object movements

Question 2. Which is the function that calls another function after a time interval?
  1.    setTimeout()
  2.    setTime()
  3.    callafter()
  4.    none of the mentioned
Explanation:-
Answer: Option A. -> setTimeout()
The setTimeout(function, duration) calls function after duration milliseconds from now.

Question 3. Which is the property used to position the object in the left of the screen?
  1.    object.position = left
  2.    object = position.left
  3.    object.style.left
  4.    none of the mentioned
Explanation:-
Answer: Option C. -> object.style.left
The property object.style.left = distance in pixels or points sets distance from left edge of the screen.

Question 4. Which function is used to clear the timer value?
  1.    clearTimervalue()
  2.    clearTimeout()
  3.    clear()
  4.    flush(timer)
Explanation:-
Answer: Option B. -> clearTimeout()
The clearTimeout(setTimeout_variable) call clears any timer set by the setTimeout() functions.

Question 5. Which is the function used to call a function in every time duration?
  1.    callafter()
  2.    setInterval()
  3.    setTimeout()
  4.    setTime()
Explanation:-
Answer: Option B. -> setInterval()
The setInterval(function, duration) calls function after every duration milliseconds.

Question 6. How to assign the image source in JavaScript?
  1.    image = “url”
  2.    source(“url”)
  3.    image.src = “url”
  4.    none of the mentioned
Explanation:-
Answer: Option C. -> image.src = “url”
The image source is defined as image.src = “/images/html.gif”.

Question 7. How do we get the DOM object in JavaScript?
  1.    getElementbyId()
  2.    getObject()
  3.    getElement()
  4.    none of the mentioned
Explanation:-
Answer: Option A. -> getElementbyId()
The getElementbyId() is used to get the DOM object in JavaScript by simply calling that function associated with the HTML document.

Question 8. Which event handler is triggered when the user’s mouse moves onto a link?
  1.    onMouseOver
  2.    onMouseOut
  3.    onMouse
  4.    onMouseOnto
Explanation:-
Answer: Option A. -> onMouseOver
The onMouseOver event handler is triggered when the user’s mouse moves onto the link.

Question 9. Which event handler is triggered when the user’s mouse moves away from a link?
  1.    onMouseOver
  2.    onMouseOut
  3.    onMouse
  4.    onMouseOnto
Explanation:-
Answer: Option B. -> onMouseOut
The onMouseOut event handler is triggered when the user’s mouse moves away from the link.

Question 10. How do we create and preload an image object in JavaScript?
  1.    Use new keyword
  2.    Call Image()
  3.    Both Use new keyword and Call Image()
  4.    None of the mentioned
Explanation:-
Answer: Option C. -> Both Use new keyword and Call Image()
The Image() constructor creates and preloads a new image object.