Level:
Correct: 0
Incorrect: 0
Marks: 0/0
Exam Practice
Subject:
Topics:
Avg
score:
–
Topics
done:
0/32

Input, output and sequence

Practise 24 exam-style questions on Input, output and sequence for Cambridge IGCSE Computer Science (Paper 2). Write your answer as you would in the exam and get it marked in seconds against the mark scheme, point by point, with an AI tutor on hand if you get stuck.

  • 24 questions
  • 1–5 marks each
  • Instant marking
  • No sign-up needed
20 questions, marked as you go

Sample questions with model answers

Here are 4 of the questions in this topic, each with a model answer, an explanation of why it earns the marks and the mark scheme an examiner would use.

Question 1

1 mark

The flowchart shows an algorithm that converts a distance in miles into kilometres, using 1 mile = 1.6 km.

State what should be written in the blank box.

Flowchart, read from the top. START, then the input/output box "INPUT Miles", then a blank process box, then the input/output box "OUTPUT Km", then STOP.

Model answer

Km ← Miles * 1.6

Explanation

The box between the input and the output is the process: it must calculate the value that is output (Km) from the value that was input (Miles). A rectangle (process box) holds an assignment, so it uses ←. Each mile is 1.6 km, so the miles are multiplied by 1.6.

Mark scheme
  1. 1 mark

    Km ← Miles * 1.6

    accept Km ← 1.6 * Miles; the identifier Km must be used because it is output; do not accept = for assignment or Miles / 1.6

Question 2

2 marks

Look at this pseudocode.

Item ← "pens"
Quantity ← 3
Price ← 1.25
OUTPUT Quantity, " ", Item, " cost £", Quantity * Price

State exactly what is output.

Model answer

3 pens cost £3.75

Explanation

OUTPUT prints each item in order: the value of Quantity (3), a space, the value of Item (pens), the text ' cost £', and then the value of the expression Quantity * Price, which is 3 × 1.25 = 3.75. Expressions in an OUTPUT statement are calculated before they are printed.

Mark scheme
  1. 1 mark

    MP1 3 pens cost £ (the values and text in the correct order)

  2. 1 mark

    MP2 3.75 at the end

    full answer: 3 pens cost £3.75

Question 3

3 marks

A program calculates the cost of carpet for a rectangular room. Carpet costs £12 per square metre. These statements are in the wrong order:

A Cost ← Area * 12
B OUTPUT "Cost: £", Cost
C INPUT Width
D Area ← Length * Width
E INPUT Length

Write the letters A to E in an order that makes the program work correctly.

Model answer

E, C, D, A, B

Explanation

Work backwards from what each statement needs: the cost needs the area, the area needs both measurements, and the output needs the cost. So the inputs come first, then the area, then the cost, and the output last. The two inputs do not depend on each other, so they can be in either order.

Mark scheme
  1. 1 mark

    C and E (the two inputs) come first, in either order

    correct orders are E, C, D, A, B or C, E, D, A, B

  2. 1 mark

    D comes before A (the area is calculated before the cost)

  3. 1 mark

    B comes last

Question 4

4 marks

A pizza is cut into 8 slices.

Write pseudocode that inputs the number of pizzas ordered and the number of people sharing them, then outputs how many whole slices each person gets (everyone gets the same number) and how many slices are left over.

Model answer

OUTPUT "How many pizzas?"
INPUT Pizzas
OUTPUT "How many people?"
INPUT People
Slices ← Pizzas * 8
Each ← DIV(Slices, People)
LeftOver ← MOD(Slices, People)
OUTPUT "Slices each: ", Each
OUTPUT "Slices left over: ", LeftOver

Explanation

DIV gives the whole number of slices that can be shared equally, and MOD gives the remainder. For 3 pizzas and 5 people there are 24 slices: DIV(24, 5) = 4 each and MOD(24, 5) = 4 left over. Ordinary division would give 4.8, which is not a number of whole slices.

Mark scheme
  1. 1 mark

    MP1 inputs the number of pizzas and the number of people

    max 4

  2. 1 mark

    MP2 calculates the total number of slices as pizzas * 8

  3. 1 mark

    MP3 calculates the slices per person with DIV, e.g. DIV(Slices, People)

    do not accept Slices / People

  4. 1 mark

    MP4 calculates the slices left over with MOD, e.g. MOD(Slices, People)

  5. 1 mark

    MP5 outputs both results with messages

Ready to try the rest? Every answer you write is marked against the mark scheme, so you can see exactly where the marks are.

AI Tutor Hints first, answers after you try

Hi! Stuck? Ask me for a hint and I’ll help you work it out. Once you’ve checked your answer I can explain exactly where the marks are.