Question 2

Edexcel Computer Science June 2022 Paper 2GCSE10 marks

On the specification

6.1 Develop code6.6 Subprograms
Question text

2 A program uses turtle graphics to draw a simple image. This is the image that must be produced. Both the circle and the outside square are centred on the horizontal and vertical grid lines. The outside square is 400 × 400. The circle is 200 across. The circle outline is coloured gold. All other lines are black. The program has errors and does not work correctly. Open file Q02.py Amend the code to: • add a comment to identify the data type of the argument to the turtle.mode () subprogram call on original line 19 turtle.mode ("standard") • fix the NameError on original line 23 screen.setup (WIDTH, HIGHT) • fix the AttributeError on original line 28 theTurtle = turtle.turtle () • fix the TypeError on original line 36 theTurtle.pendown (200) • fix the logic error that causes the vertical axis to be too far right on original line 42 theTurtle.setpos (100, 200) • fix the logic error that causes the vertical axis to be drawn too short on original line 48 theTurtle.forward (100) • fix the logic error that causes the outside square to tilt left of the vertical axis on original line 56 theTurtle.setheading (95) • add a line to set the size of the pen to the constant BIG on original line 68 • add a line to set the colour of the pen to gold on original line 71 • add a line to hide the turtle on original line 78. Do not change the functionality of the given lines of code. Do not add any additional functionality. Save your amended code file as Q02FINISHED.py (Total for Question 2 = 10 marks)