Javascript Multiple Choice Questions on “Scripted Media”.
1. What is the advantage of the code produced graphics being smaller than the images themselves?
a) Bandwidth saving
b) Increase in bandwidth
c) Dynamic advantages
d) Static advantage
Answer: a
Clarification: The code used to produce graphics on the client side is typically much smaller than the images themselves, creating substantial bandwidth savings.
2. Which of the following uses a lot of CPU cycles?
a) GUI
b) Statically generated graphics
c) Dynamically generated graphics
d) Images
Answer: c
Clarification: Dynamic graphics for data, means simulating motion or movement using the computer. It may also be thought of as multiple plots linked by time. Dynamically generating graphics from real-time data uses a lot of CPU cycles.
3. Which HTML element is used to include images?
a) image
b) img
c) src
d) sourcing
Answer: b
Clarification: Web pages include images using the HTML img element. src tag is used to include the image link.
4. What is the purpose of image replacement?
a) To replace an image
b) To implement special effects
c) Removal of image rollovers
d) Implementation of image rollovers
Answer: d
Clarification: Image replacement is a technique developed to allow designers to use image-based typesetting while meeting accessibility requirements. One common use for image replacement is to implement image rollovers, in which an image changes when the mouse pointer moves over it.
5. When is JavaScript called obtrusive?
a) JavaScript code is medium sized
b) JavaScript code is small
c) JavaScript code is so large
d) JavaScript code is Very small
Answer: c
Clarification: When the amount of JavaScript code is so large that it effectively obscures the HTML, we call JavaScript as obtrusive. On the other hand unobtrusive JavaScript is a best practice methodology for attaching JavaScript to the front-end of a website.
6. Which is a possible way of finding all the img elements in the document?
a) document(images)
b) document.images[]
c) document(img)
d) doc(img)
Answer: b
Clarification: The best suited option is document.image[] to find all img elements in the document.[index] is used to specify the index of which img tag is to be selected.
7. Which of the following elements are used to include audio?
a) audio
b) video
c) svg
d) aud
Answer: a
Clarification: The audio tag is used to include audio in the HTML document. The audio tag includes method like play(), pause() etc.
8. Which of the following attributes are common to both audio and video?
a) enter
b) control
c) controls
d) add
Answer: c
Clarification: Both audio and video support a controls attribute. When present, it specifies that audio controls should be displayed. Both audio and video support a controls attribute.
9. Which of the following is not the property of the video tag?
a) width
b) height
c) breadth
d) area
Answer: c
Clarification: The video tag does not contain a breadth property. The width and height property specifies the width and height of the video.
10. Which of the following is the parameter used to invoke the Audio() constructor?
a) File type
b) Music type
c) Both File and Music
d) Video type
