Chhetri AcademyGCSE & A level Paper Builder

1.2.1Flowcharts, pseudocode and program code

Edexcel GCSE Computer Science (1CP2) · Computational thinking › Algorithms

Practise Flowcharts, pseudocode and program code. 13 exam-style questions plus unlimited generated ones on this subtopic, at up to four difficulty levels, with full mark schemes and a progress tracker. Free, no account needed.

Build a paper on this topic

▶ Watch videos on Flowcharts, pseudocode and program code (Craig 'n' Dave Edexcel on YouTube) · Practise all of Algorithms

Quick recall

Cover the answers and test yourself. The app has these as flashcards that come back just before you'd forget them.

State the output when the user enters 8 for the length and 7 for the width.
Large room
Give the line number where the count-controlled loop starts.
02

Sample questions

Written for this site in the style of Edexcel exam questions. They are not taken from real past papers.

Question 1Easy4 marks
Here is a program.
01 length = int(input("Enter length: "))
02 width = int(input("Enter width: "))
03 area = length * width
04 if area > 50:
05     print("Large room")
06 else:
07     print("Small room")
(a) State the output when the user enters 8 for the length and 7 for the width.[1]
(b) State the output when the user enters 5 for the length and 10 for the width.[1]
(c) Give the line number of a line that uses selection.[1]
(d) State the purpose of line 03.[1]
Show the answer and mark scheme
(a) Answer: Large room
  • Large room
(b) Answer: Small room (the area is 50, which is not greater than 50)
  • Small room
(c) Answer: 04
  • 04 (accept 06)
(d) Answer: It calculates the area by multiplying the length by the width and stores it in area.
  • calculates the area (length × width) and stores it in area
Question 2Medium6 marks
A program is needed that asks the user for a temperature in degrees Celsius (C), converts it to degrees Fahrenheit (F) using F = C × 1.8 + 32, and outputs the result. If the temperature in Fahrenheit is above 86, the program must also output Heat warning.
(a) Write an algorithm for the program. You may use a flowchart, pseudocode or program code.[4]
(b) State what the program outputs when the input is 35.[2]
Show the answer and mark scheme
(a) Answer:
celsius = float(input("Temperature in C: "))
fahrenheit = celsius * 1.8 + 32
print(fahrenheit)
if fahrenheit > 86:
    print("Heat warning")
  • inputs the temperature in Celsius (as a real number)
  • calculates F = C × 1.8 + 32
  • outputs the temperature in Fahrenheit
  • outputs Heat warning only when F is greater than 86
(b) Answer: 95.0 and Heat warning
  • 95 / 95.0
  • Heat warning
Question 3Hard8 marks
A teacher wants a program to analyse test marks. The teacher enters the marks one at a time. Entering −1 stops the input. The program then outputs the highest mark, the lowest mark and the mean mark. You may assume that at least one mark is entered before −1.
(a) Write the program in Python.[6]
(b) Explain why initialising highest to 0 would work for this data but initialising lowest to 0 would not.[2]
Show the answer and mark scheme
(a) Answer:
mark = int(input("Enter a mark (-1 to stop): "))
highest = mark
lowest = mark
total = 0
count = 0
while mark != -1:
    total = total + mark
    count = count + 1
    if mark > highest:
        highest = mark
    if mark < lowest:
        lowest = mark
    mark = int(input("Enter a mark (-1 to stop): "))
print("Highest:", highest)
print("Lowest:", lowest)
print("Mean:", total / count)
  • inputs marks as integers, both before and inside the loop (or at the start of each pass)
  • a loop that stops when −1 is entered
  • −1 is not included in any of the results
  • total and count are initialised and updated for each mark
  • highest is initialised suitably (e.g. to the first mark) and updated when a mark is higher
  • lowest is initialised suitably (e.g. to the first mark) and updated when a mark is lower
  • the mean is calculated as total ÷ count after the loop
  • outputs the highest, lowest and mean marks
(b) Answer: Marks cannot be negative, so the first real mark will be at least 0 and highest is correct. No mark is lower than 0, so lowest would stay 0 even if every mark was higher.
  • marks cannot be negative, so any mark is at least as big as 0 and highest is updated correctly
  • no mark is lower than 0, so lowest would stay at 0 (and be wrong) unless someone scored 0

Related subtopics

Stuck? Get 1-to-1 help. Chhetri Academy tutors GCSE and A level Maths and Science online, with a free 30-minute trial lesson.

Book a free trial