14
QuizMultiple Choice

Resources for Programmers — Unit test

Question 14 • Introduction to Information Technology - EL3701

Two programmers wrote very similar code. Compare the two to decide what the difference will be between them.Programmer A Programmer Bdef drawUnknown(): x = 20 pendown() forward(x) penup()def drawUnknown(): x = 50 pendown() forward(x) penup()

Answer
A
Programmer A draws a shorter line than Programmer B.
B
Programmer A draws a circle, while Programmer B draws a square.
C
Programmer A draws a longer line than Programmer B.
D
Programmer A draws an H, while Programmer B draws an E.

Explanation

Both programmers put the pen down, move forward once, and then lift the pen. Programmer A moves forward 20 units, while Programmer B moves forward 50 units, so A draws the shorter line. The correct choice is A: Programmer A draws a shorter line than Programmer B.

AI-written and checked against the verified answer.

Previous
Next