HelpContactFor teachers and institutes
>_StemPy Lab
Mock TestsClasses

>_StemPy Lab

Learn. Solve. Code the solutions. Test yourself.

Live examsFree mock exams, timed and rankedEveryone starts together, and your score and rank come the moment it ends.See the exams →

Learn

  • Physics
  • Chemistry
  • Mathematics
  • Biology
  • Python Programming
  • Statistics & Data Science
  • Computer Science
  • Classes
  • Groups

Practice

  • Problems
  • Quizzes
  • Mock Tests
  • Prepare for an Exam
  • Question Sets
  • Exams
  • Certificates
  • Python Labs
  • AI Practice Generator
  • Student-Created Tests

Community

  • Discussions
  • Resources
  • Notes
  • Glossary
  • Blog

Account

  • Log in
© 2026 senLearn. All rights reserved.HelpFor SchoolsAboutContactPrivacy PolicyTerms of UseRefund Policy
  1. Problems
  2. /A programmer builds a program that works out a pupil's average mark from five tests…
MediumComputer ScienceHigh School (9–10)Computer Science › Algorithms and Problem-SolvingConceptualIGCSE

A programmer builds a program that works out a pupil's average mark from five tests…

StemPy LabContributed by StemPy Lab

Try it on paper first. A hint, the key idea and the worked solution are here when you need them.

A programmer builds a program that works out a pupil's average mark from five tests. During the testing stage, two problems appear.

Problem 1: a pupil who missed a test has only four marks, and the program cannot handle this. Nobody had said that a pupil might miss a test.

Problem 2: for the marks 606060, 707070, 808080, 909090 and 100100100, the program outputs 727272 instead of 808080. The design was right, but one line of the code adds the first mark twice and leaves out the last mark.

For each problem, say which stage the programmer should go back to, and why.

Need a reminder? The key ideaShowHide

The program development life cycle has four stages. Analysis: identify the problem and the requirements, with abstraction and decomposition. Design: decomposition, structure diagrams, flowcharts and pseudocode. Coding: write the program code, with iterative testing. Testing: test the whole program with test data.

The worked solution

Have you tried it?

Work it out on paper first. It is fine to get stuck or make a mistake: that is how we learn. When you are ready, go through the solution one step at a time, and check each step against your own.

Problem 1. The requirement "a pupil may miss a test" was never found. So the programmer goes back to analysis, adds the requirement, and then changes the design and the code to match.

Problem 2. The design was right, but the code does not follow it. So the programmer goes back to coding and corrects the line. Check the fault: 60+60+70+80+90=36060 + 60 + 70 + 80 + 90 = 36060+60+70+80+90=360, and 360÷5=72360 \div 5 = 72360÷5=72. That is the wrong output, so the line really does add the first mark twice. The right total is 400400400, and 400÷5=80400 \div 5 = 80400÷5=80.

Answer: problem 1, back to analysis (a missing requirement); problem 2, back to coding (the code does not match the design). After each change the program is tested again.

What if? If the design itself had used the wrong formula, the programmer would go back to design first.

Log in to save this for later
← All Problems
← In the analysis stage of the cinema ticket program, the manager adds a new requirement: a group of…A school gives every pupil a card for the canteen… →
More onComputer Science › Algorithms and Problem-Solving

Discussion (0)

Log in to join the discussion.

Loading…

Learn it in

  1. The program development life cyclePlanning a Program: Life Cycle, Decomposition and Flowcharts

More on this topic

  1. This is the kind of long scenario question that ends Paper 2…Hard
  2. A delivery company adds a check digit to each parcel number…Medium
  3. Name the check in each case. Say whether it is validation or verification…Easy
A bubble sort is changed so that it sorts in descending order: the comparison becomes IF…Hard
  • A shop stores the colours of the ten bicycles in its window in an array Colours: red, blue, red…Medium
  • All problems on this topic →