Skip to main content

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: tag
  • 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
B

Q1503: 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
A

Q1504: 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
A

Q1505: 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
A

Q1506: 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
B

Q1507: 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
D

Q1508: 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
C

Q1509: 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
B

Q1510: 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

Test Your Knowledge

Take a timed quiz on Fundamentals of Front End Development

🚀 Start Quiz Now