Module 1 · Practice

Practice questions

Three difficulty levels.

Section A — Easy

01

Define each:

(a) Decomposition (b) Abstraction (c) Pattern recognition
02

Match each flow-chart shape to its meaning: rectangle, diamond, parallelogram, rounded rectangle.

03

Write the Python keyword used to define a subroutine.

04

What does this Python loop do?

for i in range(3):
    t.forward(50)
    t.left(120)

Section B — Medium

05

Decompose the task "make a cup of tea" into at least 5 ordered steps.

06

Rewrite the following code more efficiently using a loop:

t.forward(100)
t.right(72)
t.forward(100)
t.right(72)
t.forward(100)
t.right(72)
t.forward(100)
t.right(72)
t.forward(100)
t.right(72)
07

Write a Python subroutine called draw_triangle that takes a parameter size and draws an equilateral triangle.

08

Write pseudocode for a program that asks the user for a number and outputs whether it is positive, negative or zero.

Section C — Hard

09

Using your draw_square(size) subroutine, write code that draws four squares in a row, each 50 pixels apart.

10

Write a Python subroutine draw_polygon(sides, size) that draws any regular polygon. Test it with a hexagon.

11

Draw a flow chart for a program that asks for a password. If correct, output "Welcome", otherwise let the user try again (loop until correct).

Check answers
← Back Notes Next → Answers