AdvertisementYour brand could be hereYour brand hereOn every Darslab page · students, parents and teachersinfo@darslab.comAsk for pricesPricesinfo@darslab.com
☰ Year plan · Computing

Planning and testing code

Week 3 · Unit 7.1: Block it out · 3 lessons
Answers are for parents and teachers.
1
Draw a flowchart for a program that asks for the number of laps a runner ran and the length of one lap in metres, and shows the total distance.
2
Trace this flowchart for the inputs 7 and 3. Write the trace table.
StartINPUT aINPUT bdiff = a - bOUTPUT diffEnd
3
Work these out by hand and then say what Python shows: (a) 6 + 4 * 3 (b) (6 + 4) * 3 (c) 24 / 4 / 2 (d) 3 ** 2 + 1.
4
A test plan expects 12 for the data 3 and 4 in a program that should multiply them. The program shows 7. Write the test plan row and say what the bug is.
5
Find the mistake in each program, say what it is, and write the correct version: (a) colour = input("Colour? ) (b) size = 5, then on the next line print("Size:", sise) (c) print "Done"