Fundamentals of Front End Development MCQs with Answers
Practice important Fundamentals of Front End Development MCQs with answers and explanations.
Multiple Choice Questions
Q1501: Which part of the code is responsible for defining the border of the canvas?
- A:
- B: getContext("2d") method
- C: fillRect() method
- D: style="border:1px solid #000000;"
View Answer
D
Q1502: Fill in the blank: The _______ element is only a container for graphics and requires a script to draw.
- A:
- B:
- C:
- D:
View Answer
BQ1503: Which of the following correctly draws a green filled rectangle on the canvas?
- A: ctx.fillStyle = "#00FF00"; ctx.fillRect(0,0,200,100);
- B: ctx.strokeStyle = "#00FF00"; ctx.strokeRect(0,0,200,100);
- C: ctx.fillStyle = "green"; ctx.drawRect(0,0,200,100);
- D: ctx.fillRect(0,0,200,100); ctx.fillStyle = "#00FF00";
View Answer
AQ1504: Fill in the blank: The method ctx.fillRect(0,0,200,100); will draw a rectangle starting at _______.
- A: (0,0)
- B: (0,200)
- C: (200,0)
- D: -100100
View Answer
AQ1505: What is the coordinate of the upper-left corner of the HTML5 canvas?
- A: (0,0)
- B: -100100
- C: -200200
- D: (0,200)
View Answer
AQ1506: Fill in the blank: The _______ method is used to define the starting point of a line in canvas.
- A: lineTo(x,y)
- B: moveTo(x,y)
- C: stroke()
- D: beginPath()
View Answer
BQ1507: Which method is used to actually display a line on the canvas after defining its path?
- A: draw()
- B: paint()
- C: fill()
- D: stroke()
View Answer
DQ1508: Fill in the blank: To draw a line on a canvas, the _______ method is used after defining the start and end points.
- A: beginStroke()
- B: startPath()
- C: stroke()
- D: drawLine()
View Answer
CQ1509: Which of the following correctly draws a line from (0,0) to (200,100) on a canvas?
- A: ctx.lineTo(0,0); ctx.moveTo(200,100); ctx.stroke();
- B: ctx.moveTo(0,0); ctx.lineTo(200,100); ctx.stroke();
- C: ctx.lineTo(200,100); ctx.stroke();
- D: ctx.moveTo(200,100); ctx.lineTo(0,0); ctx.stroke();
View Answer
BQ1510: Fill in the blank: The _______ method is used to specify the ending point of a line on the canvas.
- A: moveTo(x,y)
- B: lineTo(x,y)
- C: stroke()
- D: fill()
View Answer
B