ExamYard Lectures

Pseudocode constructs: IF, CASE, records and arrays

A Level Computer Science 9618 · Chapter 11, Programming · 6-minute lecture

The teaching part (1 min) is free to watch. A free account opens the whole lecture: 6 practice questions, 2 real past-paper questions with the answers explained, the mistakes that lose marks, the full-marks tip, a one-card summary and a quick quiz.

What this lecture covers

  1. Reading code like a sentence
  2. Three constructs
  3. IF statements
  4. CASE statements
Read the transcript of the teaching part

Last time

Before we start: last time, in Finding errors in statements and following an algorithm, you learned these points. Here they are again on one card. Keep them in mind, because today builds on them.

Reading code like a sentence

Every algorithm in Paper 2 is built from three ideas. Do things in order. Choose between actions. Repeat actions. Once you can spot which is which, a page of pseudocode stops looking like a wall of words and becomes a few small, familiar pieces.

Three constructs

Sequence: statements run one after another, in the order written. Selection: IF or CASE chooses which statements run, depending on a condition. Iteration: a loop repeats statements. FOR repeats a fixed number of times. WHILE and REPEAT depend on a condition.

IF statements

IF condition THEN statements ELSE statements ENDIF chooses one of two routes. ELSE is optional. Conditions join with AND, OR and NOT. For a weight within 48 and 52 inclusive, both tests must be true. Nested IF statements test further conditions, only when the earlier one is false or true.

CASE statements

CASE OF tests one variable against several values or ranges. It is neater than a long chain of IF statements. Each branch gives a value or a range, then a colon, then statements. A range is written 70 TO 100. OTHERWISE catches everything else. End with ENDCASE. The branches must not overlap.

How often it comes up

How often Cambridge has asked each part, counted by ExamYard from every past paper in its question bank: Records · Searching and processing an array · Selection: IF and CASE.

The whole chapter: Programming Fundamentals.

Chapter 11: Programming

Also for A Level Computer Science 9618

Which topics come up most in A Level Computer Science 9618 past papers, counted from every paper since 2004: Paper 1 topic frequency, Paper 2 topic frequency.