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

Q1511: What is the purpose of the ctx.stroke() method in HTML5 canvas?
  • A: To fill a shape
  • B: To begin a new path
  • C: To display a line on the canvas
  • D: To clear the canvas
View Answer
C

Q1512: Which of the following sequences correctly draws a line on a canvas?
  • A: moveTo() -> lineTo() -> stroke()
  • B: lineTo() -> moveTo() -> stroke()
  • C: stroke() -> moveTo() -> lineTo()
  • D: stroke() -> lineTo() -> moveTo()
View Answer
A

Q1513: Fill in the blank: The coordinate (0,0) represents the _______ of the canvas.
  • A: bottom-right corner
  • B: upper-right corner
  • C: upper-left corner
  • D: center
View Answer
C

Q1514: Which method is necessary to start the process of drawing a line on a canvas?
  • A: startLine()
  • B: beginDraw()
  • C: moveTo()
  • D: drawLine()
View Answer
C

Q1515: What method is used to create a linear gradient in HTML5 Canvas?
  • A: createLinearGradient
  • B: createRadialGradient
  • C: addColorStop
  • D: fillRect
View Answer
A

Q1516: What method specifies the color stops in a gradient?
  • A: addColorStop
  • B: createLinearGradient
  • C: createRadialGradient
  • D: fillStyle
View Answer
A

Q1517: What are the valid position values for color stops in a gradient?
  • A: 0 to 10
  • B: 0 to 1
  • C: 1 to 100
  • D: 0 to 100
View Answer
B

Q1518: Which method is used to create a radial gradient?
  • A: createLinearGradient
  • B: createRadialGradient
  • C: addColorStop
  • D: fillRect
View Answer
B

Q1519: In the code example, what colors are used in the linear gradient?
  • A: yellow and red
  • B: blue and white
  • C: yellow and blue
  • D: red and yellow
View Answer
C

Q1520: How do you fill a rectangle with a gradient in HTML5 Canvas?
  • A: ctx.fillStyle = grd; ctx.fillRect(0,0,200,80);
  • B: ctx.createLinearGradient(); ctx.addColorStop();
  • C: ctx.createRadialGradient(); ctx.addColorStop();
  • D: ctx.fillRect(); ctx.createLinearGradient();
View Answer
A

Test Your Knowledge

Take a timed quiz on Fundamentals of Front End Development

🚀 Start Quiz Now