Loading

Quipoin Menu

Learn • Practice • Grow

Direction: Choose the correct option

Q1.

What is the <canvas> element in HTML?
A. A chart element
B. A video player
C. An image placeholder
D. A rectangular area for drawing graphics via JavaScript
Direction: Choose the correct option

Q2.

<canvas id="myCanvas" width="200" height="100"></canvas>
What are the width and height attributes for?
A. Maximum dimensions
B. Canvas dimensions in pixels
C. Canvas dimensions in inches
D. Minimum dimensions
Direction: Choose the correct option

Q3.

How do you draw on a canvas?
A. Using JavaScript to get the context and draw
B. Using SVG commands
C. Using HTML tags
D. Using CSS
Direction: Choose the correct option

Q4.

var canvas = document.getElementById('myCanvas');
var ctx = canvas.getContext('2d');
ctx.fillStyle = 'red';
ctx.fillRect(10, 10, 50, 50);
What does this code do?
A. Fills entire canvas red
B. Draws a red circle
C. Draws a red square at (10,10) 50×50
D. Creates a red border
Direction: Choose the correct option

Q5.

What happens if you don't specify width and height on canvas?
A. Canvas won't appear
B. Default is 300×150 pixels
C. Width is 100%
D. Height auto-adjusts