← All subjects 2210

O Level Computer Science

Build a rock-solid understanding of how computers work and learn to solve problems with algorithms and pseudocode, with the past-paper practice you need for a top grade.

What you'll learn

Every syllabus topic, taught clearly and practised with exam-style questions.

Paper 1: Computer Systems

  1. Data representation
  2. Data transmission
  3. Hardware
  4. Software
  5. The internet and its uses
  6. Automated and emerging technologies

Paper 2: Algorithms, Programming and Logic

  1. Algorithm design and problem-solving
  2. Programming
  3. Databases
  4. Boolean logic

How lessons work

Personal, live online lessons built around your syllabus and your goals.

Exam-style practice

Topic-by-topic past-paper questions, marked against the official mark schemes.

Pseudocode & trace tables

Step-by-step practice writing, tracing and correcting algorithms for Paper 2.

Revision resources

Mindmaps, infographics and flashcards for quick, effective revision.

Course materials

Free notes, revision resources and practice for this course.

Pseudocode practice

Questions in the Paper 2 style. Try each one first, then open the answer. For precise notes on each topic with practice after it, use the coding roadmap. For more questions to code and run, use Coding practice.

Basic program

A teacher needs a program to record the details of a student.

Write pseudocode to:

  • declare a suitable variable, with the most appropriate data type, for each of: the student's name, the student's marks as a whole number, the student's average marks, whether the student has been promoted and the student's grade as a single letter
  • input the name and the marks, with a suitable prompt before each input
  • output the name and the marks, each with a suitable message.
[7]

Total: 7 marks

Show the answer
Loading…
Open file
Try it in the editor

Using constants

The radius of a circle can be found from its circumference using the formula: radius = circumference ÷ (2 × Pi).

(a)

Write pseudocode to:

  • declare the constant Pi with the value 3.14
  • declare suitable variables for the radius and the circumference
  • input the circumference, with a suitable prompt
  • calculate the radius
  • output the radius with a suitable message.
[5]
(b)

Give one reason why Pi is stored as a constant and not as a variable.

[1]

Total: 6 marks

Show the answer

(b) The value does not change while the program runs, so it cannot be changed by accident. (Or: the value only needs to be edited in one place.)

Loading…
Open file
Try it in the editor

Input and output

A program is needed to produce a marksheet.

(a)

Suggest a suitable identifier and the most appropriate data type for each of these items of data:

  • the student's name
  • the student's marks as a whole number
  • the student's grade as a single letter
  • the student's percentage, which may include a decimal part
  • whether the student has passed or failed.
[5]
(b)

Write pseudocode to:

  • output the message: This is the program of a marksheet
  • input the student's name, with a suitable prompt
  • output the message: The name input was, followed by the name.
[3]

Total: 8 marks

Show the answer

(a) StudentName : STRING. StudentMarks : INTEGER. Grade : CHAR. Percentage : REAL. PassOrFail : BOOLEAN.

Loading…
Open file
Try it in the editor

Output a menu

A membership program offers its user three options.

Write pseudocode to output a heading that asks the user to enter their choice, followed by these options on separate lines:

  • 1. Input a new member
  • 2. Output Membership Codes, First/Last
  • 3. Stop the program
[4]

Total: 4 marks

Show the answer
Loading…
Open file
Try it in the editor

Validate a menu with REPEAT

A menu has three options, numbered 1, 2 and 3. The user's choice must be validated.

(a)

Write pseudocode to:

  • declare the variable Choice with a suitable data type
  • output a menu of three options
  • use a REPEAT...UNTIL loop to input Choice until it is a value from 1 to 3 inclusive
  • output the message: Invalid Choice, each time the value is out of range.
[6]
(b)

State the name of this type of validation check.

[1]

Total: 7 marks

Show the answer

(b) Range check.

Loading…
Open file
Try it in the editor

Validate a menu with WHILE

The user's menu choice must be a value from 1 to 3 inclusive.

(a)

Write pseudocode to input Choice, with a suitable prompt, and use a WHILE loop to ask the user to re-enter the value until it is in range.

[4]
(b)

State one difference between a WHILE loop and a REPEAT...UNTIL loop.

[1]
(c)

Give one item of normal test data, one item of abnormal test data and one item of extreme test data for this validation check.

[3]

Total: 8 marks

Show the answer

(b) A WHILE loop tests its condition at the start, so its statements may never run. A REPEAT...UNTIL loop tests at the end, so its statements run at least once.

(c) Normal: 2. Abnormal: any value out of range, such as 7 or -1. Extreme: 1 or 3.

Loading…
Open file
Try it in the editor

Validate a password

A program only continues when the correct password, abc, has been entered.

(a)

Write pseudocode to input Password, with a suitable prompt, and use a WHILE loop to ask the user to re-enter it until it is correct.

[4]
(b)

State the meaning of the operator <>

[1]

Total: 5 marks

Show the answer

(b) Not equal to.

Loading…
Open file
Try it in the editor

Area of a circle

The area of a circle is found using the formula: area = Pi × radius².

(a)

Write pseudocode to:

  • declare the constant Pi with the value 3.14
  • declare suitable variables for the radius and the area
  • assign the value 10 to the radius
  • calculate the area
  • output the radius and the area, each with a suitable message.
[5]
(b)

State the area that is calculated.

[1]

Total: 6 marks

Show the answer

(b) 314

Loading…
Open file
Try it in the editor

Find the errors

This pseudocode algorithm inputs a positive whole number. It should output how many multiples of that number are less than or equal to 100.

01 DECLAR Count : INTEGER
02 DECLARE Number,Value : INTEGER
03 Count ← 0
04 INPUT Number
05 Value ← Count * Number
06 WHILE Value <= 100 DO
07 Count ← Count + 1
08 Value ← Count * Number
09 ENDWHIL
10 Count ← Count - 1
11 OUTPUT Count
(a)

Identify the line number of each of the two errors in the pseudocode and suggest a correction for each error.

[2]
(b)

State the output of the corrected algorithm when the input is 30.

[1]
(c)

Explain what happens when the input is 0.

[2]

Total: 5 marks

Show the answer

(a) Line 01: DECLAR should be DECLARE. Line 09: ENDWHIL should be ENDWHILE.

(b) 3

(c) Value stays at 0, so the condition Value <= 100 is always true and the loop never ends.

Try it in the editor

String functions

The first character of a string is in position 1.

(a)

State the output of each of these statements:

  • OUTPUT SUBSTRING("hello world", 1, 5)
  • OUTPUT SUBSTRING("hello world", 7, 5)
  • OUTPUT SUBSTRING("hello world", 1, 1)
  • OUTPUT LENGTH("INTEGRATED DEVELOPMENT ENVIRONMENT")
[4]
(b)

The variable Text stores the string "Computer Science Class". Write pseudocode to use a FOR loop to output each character of Text on a separate line. You must use the library routines LENGTH and SUBSTRING.

[4]

Total: 8 marks

Show the answer

(a) hello, then world, then h, then 34.

Loading…
Open file
Try it in the editor

Ready to start O Level Computer Science?

Book a free 15-minute intro call. We'll talk about your goals and make a plan together.

Book a free intro call