582). What is the purpose of the canvas element?
[A]Creates drawing surface
[B]Exposes powerful drawing API to client-side JavaScript
[C]Creates drawing surface & Exposes powerful drawing API to client-side JavaScript
[D]Creates a rectangular box
Show Answer
Correct Answer: Creates drawing surface & Exposes powerful drawing API to client-side JavaScript
Notes:
Answer: c
Explanation: The HTML canvas element is used to draw graphics, on the fly, via JavaScript. The canvas element is only a container for graphics. The canvas element has no appearance of its own but creates a drawing surface within the document and exposes a powerful drawing API to client-side JavaScript.
583). From which version of IE is canvas supported?
Show Answer
Correct Answer: 9
Notes:
Answer: c
Explanation: The canvas element is not supported by IE before IE9, but it can be reasonably well emulated in IE6, 7, and 8. It is supported from version 4 in chrome and 2 in firefox.
584). Which method is used to obtain the “drawing context” object?
[A]getContext()
[B] getObject()
[C]get()
[D]getDrawing()
Show Answer
Correct Answer: getContext()
Notes:
Answer: a
Explanation: The HTMLCanvasElement.getContext() method returns a drawing context on the canvas, or null if the context identifier is not supported. Most of the Canvas drawing API is defined not on the canvas element itself, but instead on a “drawing context” object obtained with the getContext() method of the canvas.
585). What is the returning value of the getContext() method?
[A]Drawing model
[B]CanvasRenderingContext2D object
[C]Context2D object
[D]Container
Show Answer
Correct Answer: CanvasRenderingContext2D object
Notes:
Answer: b
Explanation: Call getContext() with the argument “2d” to obtain a CanvasRenderingContext2D object that you can use to draw two-dimensional graphics into the canvas. It is important to understand that the canvas element and its context object are two very different objects.
586). How does SVG describe complex shapes?
[A]Path of lines
[B]Path of curves
[C]Path of lines and curves
[D]Planes
Show Answer
Correct Answer: Path of lines and curves
Notes:
Answer: c
Explanation: SVG stands for ‘Scalable Vector Graphics’ and it is used to define graphics for the Web. SVG is mostly used for vector type diagrams like Two-dimensional graphs in an X, Y coordinate system, Pie charts etc. SVG describes complex shapes as a “path” of lines and curves that can be drawn or filled.
587). Which is the method invoked to begin a path?
[A]begin()
[B]path()
[C]createPath()
[D]beginPath()
Show Answer
Correct Answer: beginPath()
Notes:
Answer: d
Explanation: The beginPath() method begins a path, or resets the current path. It is called before creating any path or curve.
588). Which is the method invoked to connect the last vertex back to the first?
[A]closePath()
[B]close()
[C]connectlast(first)
[D]connect()
Show Answer
Correct Answer: closePath()
Notes:
Answer: a
Explanation: The closePath() method connects the last vertex back to the first, thereby creating a path. It connects the last point to the first point thereby creating a closed figure.
589). Which of the following are not the properties of a canvas object?
[A]fillStyle
[B]strokeStyle
[C]lineWidth
[D]lineSize
Show Answer
Correct Answer: lineSize
Notes:
Answer: d
Explanation: The fillStyle property sets or returns the color, gradient, or pattern used to fill the drawing. The strokeStyle property sets or returns the color, gradient, or pattern used for strokes. There is no property called lineSize associated with the canvas object.
590). Which of the following is a property used to check how crisp or fuzzy shadows are?
[A]shadowColor
[B]shadowBlur
[C]strokeStyle
[D]stroke
Show Answer
Correct Answer: shadowBlur
Notes:
Answer: b
Explanation: shadowBlur is used to check how crisp or fuzzy shadows are. The shadowBlur property sets or returns the blur level for shadows.
591). How do you restore a saved coordinate system?
[A]restore()
[B]getback()
[C]set()
[D]back()
Show Answer
Correct Answer: restore()
Notes:
Answer: a
Explanation: The saved coordinate system is restored by calling the method restore() associated with the canvas object. The restore() method reset the canvas by “popping” the last state saved to the stack.