Test Series - html

Test Number 18/72

Q: Which of the following element is used for canvas graphics?
A. 
B. 
C. 
D. 
Solution: CSS i.e. Cascading Style Sheet is a scripting language. Canvas graphics is introduced in HTML5. Element used for canvas graphics is . The HTML canvas element is used to draw graphics, on the fly, via scripting (usually JavaScript).
Q: Which of the following statement is not true?
A. SVG stands for Scalable Vector Graphics
B. SVG is used to define graphics for the Web
C. SVG is a W3C recommendation
D. SVG doesn’t support event handlers
Solution: SVG stands for “Scalable Vector Graphics”, it is used to draw graphics for the web. W3C recommends SVG graphics. SVG also supports event handlers which is not supported in canvas.
Q: To draw on the canvas, authors must first obtain a reference to a context using the ______________ method of the canvas interface element.
A. getImageData
B. toDataURL
C. getContext
D. restore
Solution: The method getImageData(), returns an imageData that copies pixel data for a specified thing in canvas. ContextType is a DOMString containing the context identifier defining the drawing context associated to the canvas.
Q: The ___________ method must add the scaling transformation described by the arguments to the transformation matrix.
A. scale(x, y)
B. translate(x, y)
C. rotate(angle)
D. skew(x,y)
Solution: HTML5 canvas provides scale(x, y) method which is used to increase or decrease the units in our canvas grid. The position (0, 0) is remaped in canvas by translate(x, y) method. If one want to rotate the current drawing then rotate(angle) method can be used.
Q: Which method must clear the pixels in the specified rectangle that also intersects the current clipping region to a fully transparent black, erasing any previous image?
A. strokeRect(x, y, w, h)
B. clearRect(x, y, w, h)
C. fillRect(x, y, w, h)
D. removeRect(x,y,w,h)
Solution: StrokeRect(x, y, w, h) draws rectangle without filling it. The clearRect() method clears the specified pixels within a given rectangle. FillRect(x, y, w, h) method draws filled rectangle.
Q: When the _____________ method is passed an animated image as its image argument, the user agent must use the poster frame of the animation, or, if there is no poster frame, the first frame of the animation.
A. measureText()
B. imageData()
C. drawImage()
D. setImage()
Solution: The width of specified text present in an object is given by measureText() method. The drawImage() method draws an image, canvas, or video onto the canvas. ImageData() method provides image data in pixels in canvas.
Q: The ____________ method must create a new clipping region by calculating the intersection of the current clipping region and the area described by the current path, using the non-zero winding number rule.
A. fill()
B. stroke()
C. clip()
D. get()
Solution: The path one defines is drawn by stroke() method. Any region/shape or size in canvas is clipped by clip(). The fill() method fills the current drawing (path). The default color is black. There is no method like get().
Q: The ____________ method must fill all the subpaths of the current path, using fillStyle, and using the non-zero winding number rule.
A. fill()
B. stroke()
C. clip()
D. get()
Solution: The path one defines is drawn by stroke() method. Any region/shape or size in canvas is clipped by clip(). The fill() method fills the current drawing (path). The default color is black. There is no method like get().
Q: Which of the following methods must empty the list of subpaths so that the context once again has zero subpaths?
A. closePath()
B. beginPath()
C. moveTo(x, y)
D. endPath()
Solution: ClosePath() creates a path that starts from current point up to the starting point. The beginPath() method begins a path, or resets the current path. MoveTo(x, y) moves the point specified in canvas but without creating the line. There is nothing like endPath() in canvas.
Q: An API is an application programming interface consisting of methods and properties which allow the author to get or set data or execute commands to the user agent.
A. True
B. False
C. .
D. 0
Solution: API, an abbreviation of application program interface, is a set of routines, protocols, and tools for building software applications. API allow the author/owner to get or set data or execute commands to the user agent.

You Have Score    /10