Computer Science Essentials, Unit 4, Lesson 5 of 5

Longer tasks

GCSE Computer Science, Onscreen programming, 45 minutes

Sign in

The longer questions at the end of an onscreen paper, worth 12 to 15 marks: decomposing a problem into subroutines, working part by part, testing as you go and managing your time.

What you will learn

  • Decompose a longer problem into subroutines
  • Work through a task one part at a time, testing after each
  • Use a given subroutine instead of repeating its code
  • Plan your time so every part gets an attempt

Decompose first

The last questions on an onscreen paper are longer: a whole small system, such as a club's membership or a shop's stock, worth 12 to 15 marks.

They are easier than they look once they are decomposed into small subroutines, each doing one job.

  1. Read the whole task and its data first: what is one record, one line, one cell?
  2. List the jobs: read a line, check a value, total, sort, print a report.
  3. Give each job a subroutine with a clear name and parameters.
  4. Write and test the smallest subroutine first.
  5. Build the next one on top, calling what already works rather than repeating it.

In the questions here each part is its own program in its own editor and is marked on its own, so a slip in one part never costs you the others.

The rest of this lesson and its 6 practice questions are locked.

In this lesson

  1. Decompose first
  2. Test as you go
  3. Your time
  4. Try it: A shop's stock

6 practice questions, marked as you go; about 45 minutes in all.

In this unit: Onscreen programming

Partly written Python programs to complete, amend, fix and extend, checked by running them against tests: subroutines, 2D lists, records from files, validation, strings and longer tasks in parts.

All of Onscreen programming