Which code example can be used to draw a rectangle on a <canvas> element that has
an id of myCanvas?
A. var canvas = document.getElementById(‘myCanvas’);
var ctx = canvas.getContext();
ctx.rectangle(10, 10, 50, 75);
B. var canvas = document.getElementById(‘myCanvas’);
canvas.rectangle(10, 10, 50, 75);
C. var canvas = document.getElementById(‘myCanvas’);
var ctx = canvas.getContext(‘2d’);
ctx.fillRect(10, 10, 50, 75);
D. var canvas = document.getElementById(‘myCanvas’);
var ctx = canvas.getContext();
ctx.fillRect(10, 10, 50, 75);
Correct answer: C
A. Incorrect:The getContext method requires the 2d parameter, and there is no rectangle
method on the context object.
B. Incorrect:To draw on the canvas, you need to execute the getContext method to get a
reference to a context object, and there is no rectangle method on the canvas object.
C. Correct:This is the correct code, in which a reference to a context object is obtained by
calling the getContext method with the 2d parameter.
D. Incorrect:The getContext method requires the 2d parameter.
You want to draw an arc that is approximately three-quarters of a circle. Which method is the easiest to use to accomplish this task?
A. arcTo( )
B. arc()
C. circle()
D. dot()
Correct answer: B
A. Incorrect:The arcTo method typically draws a line and an arc. Although it could accomplish the task, it would be very difficult in comparison to the arc method.
B. Correct:Using the arc method is the easiest way to accomplish this task.
C. Incorrect:The circle method does not exist.
D. Incorrect:The dot method does not exist.
The content of the <svg> element is in which format?
A. SGML
B. HTML
C. XHMTL
D. XML
Correct answer: D
A. Incorrect:HTML is derived from SGML, but the <svg> element is XML-based.
B. Incorrect:HTML is used for webpages, but the <svg> element is XML-based.
C. Incorrect:XHTML is used for webpages, but the <svg> element is XML-based.
D. Correct:The <svg> element is XML-based
On the <svg> element, what attribute provides a window into the drawing and enables
zoom capabilities?
A. zoom
B. window
C. viewBox
D. zoomWindow
Correct answer: C
A. Incorrect:The zoom attribute does not exist.
B. Incorrect:The window attribute does not exist.
C. Correct:The viewBox attribute provides a window into the drawing and enables zoom
capabilities.
D. Incorrect:The zoomWindow attribute does not exist.
You want to include a video on your webpage that has an .avi file extension. If you supply the codec information, what will be displayed in browsers that support the <video>
element but don’t have the codec?
A. The browser will show the <video> element, but will not play the video.
B. The browser will automatically download the codec and play the video.
C. The browser will display the contents of the <video> element.
D. The browser will automatically download a version of the browser that supports
the codec
Correct answer: A
A. Correct:The browser must support the codec that is specified but does not
attempt to download the specified codec automatically.
B. Incorrect:The browser does not attempt to download codecs automatically.
C. Incorrect:The browser only displays the contents of the <video> element if the
browser doesn’t support the <video> element.
D. Incorrect:The browser does not attempt to download a browser that is
compatible
You don’t want to supply an .ogg video because you find that the .ogg format is
choppy and low quality. What other video formats can you include to be compatible
with most browsers? (Choose all that apply.)
A. .webm
B. .avi
C. .mpg
D. .mp4
E. .mjpg
Correct answers: A and D
A. Correct:The .webm format is becoming popular on the latest browsers.
B. Incorrect:The .avi format is not compatible with most browsers.
C. Incorrect:The .mpg format is not compatible with most browsers.
D. Correct:The .mp4 format is compatible with Safari and Internet Explorer.
E. Incorrect:The .mjpg format is not compatible with most browsers.
The W3C standardized using which format for video?
A. .webm
B. .avi
C. .mpg
D. .mp4
E. No standard has been selected
Correct answer: E
A. Incorrect:The .webm format is becoming popular but has not been selected as a
standard.
B. Incorrect:The .avi format is not compatible with most browsers.
C. Incorrect:The .mpg format is not compatible with most browsers.
D. Incorrect:The .mp4 format is compatible with Safari and Internet Explorer but has
not been selected as a standard.
E. Correct:The W3C has not selected a standard format
You want to supply an audio file using a format that is compatible with the Internet
Explorer, Safari, and Chrome browsers. Which audio formats can you include to be
compatible with most browsers? (Choose all that apply.)
A. .mp4
B. .wav
C. .mp3
D. .oga
Correct answer: C
A. Incorrect:.The .mp4 format is not compatible with Chrome.
B. Incorrect:The .wav format is not compatible with Internet Explorer.
C. Correct:The .mp3 format is compatible with Internet Explorer, Safari, and Chrome.
D. Incorrect:The .oga format is not compatible with Internet Explorer.
You don’t want to supply an .mp3 format because you are concerned about potentially
paying royalties. What other audio formats can you include to be compatible with
most browsers? (Choose all that apply.)
A. .mp4
B. .wav
C. .h264
D. .oga
Correct answers: A, B, and D
A. Correct:The .mp4 format is becoming popular on the latest browsers.
B. Correct:The .wav format is compatible with most browsers.
C. Incorrect:The .h264 format is a video format.
D. Correct:The .oga format is compatible with most browsers
The <video> and <audio> elements inherit from which object?
A. HTMLMediaElement
B. MediaElement
C. MultiMediaElement
D. the Multimedia object
Correct answer: A
A. Correct:The <video> and <audio> elements inherit from the HTMLMediaElement
object.
B. Incorrect: The MediaElement object does not exist.
C. Incorrect:The MultiMediaElement object does not exist.
D. Incorrect:The Multimedia object does not exist
If you want your media to repeat continuously, which property would you set to true?
A. preload
B. readyState
C. seekable
D. loop
Correct answer: D
A. Incorrect:The preload property is used to indicate whether you want to preload
the data.
B. Incorrect:The readyState property is used to identify the current state of the
media.
C. Incorrect:The seekable property is used to indicate whether the media can be
seeked.
D. Correct:The loop property is used to indicate that you want to repeat the media
continuously when it reaches its end of stream
You want to trigger some code when the media is loaded. Which event should you
subscribe to?
A. onstalled
B. onseeked
C. onplay
D. onloadeddata
Correct answer: D
A. Incorrect:The onstalled event triggers when the browser is unable to retrieve the
media.
B. Incorrect:The onseeked event triggers when seeking has ended, after you perform a seek operation.
C. Incorrect:The onplay event triggers when the media starts playing.
D. Correct:The onloadeddata event triggers when the media is loaded.
You are creating a webpage that will collect data and send it to a server. Which element must you implement to be able to send data to the server?
A. <nav>
B. <form>
C. <textarea>
D. <div>
Correct answer: B
A. Incorrect:The <nav> element defines a menu section on your html page.
B. Correct:The <form> element is required to submit data back to the server.
C. Incorrect:The <textarea> element collects free-form text data.
D. Incorrect:The <div> element is a general-purpose element.
When you retrieve a webpage from the server that contains Customer information, you
want to be able to specify the id of the Customer within the URL. What can you use to
provide the id?
A. the PostBack
B. the QueryString
C. the domain name
D. a label
Correct answer: B
A. Incorrect:The PostBack data is not visible to you.
B. Correct:The QueryString is in the URL.
C. Incorrect:The domain name references the website, so assigning the id of the
Customer to the domain name will cause a different website to be referenced.
D. Incorrect:A label does not send its content to the server
You have serialized the form data that has an <input type=”email”> element. You
want to deserialize the data to see the email address as entered. Which function can
you use?
A. decodeURIComponent
B. deserialize
C. submit
D. deserializeEmail
Correct answer: A
A. Correct:The decodeURIComponent function can deserialize the QueryString.
B. Incorrect:Although jQuery has a serialize function, it has no deserialize function.
C. Incorrect:Although jQuery has a submit function, it serializes the form and sends
the data to the server.
D. Incorrect:There is no deserializeEmail function.
You are creating a webpage that prompts for a new user’s profile information. The profile page requires the user to provide a user name, and if no user name is provided, the
user will not be able to submit the page to the server. Which attribute must be placed
on the user name text box to enforce this requirement?
A. enforced
B. mandatory
C. required
D. user name
Correct answer: C
A. Incorrect:There is no enforced attribute.
B. Incorrect:There is no mandatory attribute.
C. Correct: The required attribute indicates a required field.
D. Incorrect:There is no user name attribute.
When you want to send form data to the server to update data in the database, which
HTTP method should you specify of the <form> element?
A. POST
B. GET
C. CONNECT
D. SEND
Correct answer: A
A. Correct:Using the POST method is generally preferred for sending updates to the
server.
B. Incorrect:Using the GET method is generally preferred for retrieving data from
the server.
C. Incorrect:The CONNECT method is used to establish a tunneled connection.
D. Incorrect:There is no SEND method
If you want to add a slider control to a webpage, which element do you use?
A. <input type=”slider” name=”myslider”/>
B. <input type=”number” name=”myslider”/>
C. <input type=”submit” name=”myslider”/>
D. <input type=”range” name=”myslider”/>
Correct answer: D
A. Incorrect:There is no slider type.
B. Incorrect:The number type accepts numbers and displays them in a text box.
C. Incorrect: The submit type creates a submit button.
D. Correct:The range type renders as a slider