You are viewing a free preview of this lesson.
Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.
This lesson covers pseudocode and the OCR Exam Reference Language conventions, as required by OCR J277 Section 2.1. Pseudocode is used extensively in the OCR GCSE Computer Science exam, so understanding the OCR reference language is essential.
Pseudocode is a way of writing algorithms that looks like a simplified programming language but is not tied to any specific language. It uses structured, English-like statements to describe the logic of an algorithm.
Pseudocode is:
OCR Exam Tip: In the exam, pseudocode questions use the OCR Exam Reference Language. You do not need to use perfect syntax, but you should follow the OCR conventions. The reference language guide is available on the OCR website and will be familiar from your practice.
Variables are assigned using =:
name = "Alice"
age = 16
total = 0
| Data Type | Description | Example |
|---|---|---|
| Integer | Whole number | age = 16 |
| Real | Decimal number | price = 9.99 |
| Boolean | True or False | found = true |
| Character | Single character | grade = 'A' |
| String | Text (sequence of characters) | name = "Alice" |
| Operator | Meaning | Example | Result |
|---|---|---|---|
+ | Addition | 3 + 2 | 5 |
- | Subtraction | 10 - 4 | 6 |
* | Multiplication | 5 * 3 | 15 |
/ | Division | 10 / 3 | 3.33... |
MOD | Modulus (remainder) | 10 MOD 3 | 1 |
DIV | Integer division (quotient) | 10 DIV 3 | 3 |
^ | Exponentiation (power) | 2 ^ 3 | 8 |
OCR Exam Tip: MOD and DIV are commonly tested. MOD gives the remainder (10 MOD 3 = 1), DIV gives the whole number result of division (10 DIV 3 = 3). Learn these well — they appear in many exam questions.
// Input
name = input("Enter your name: ")
// Output
print("Hello")
print(name)
print("Your score is " + score)
if score >= 50 then
print("Pass")
endif
if score >= 50 then
print("Pass")
else
print("Fail")
endif
if score >= 70 then
print("Distinction")
elseif score >= 50 then
print("Pass")
else
print("Fail")
endif
switch day:
case "Monday":
print("Start of the week")
case "Friday":
print("End of the week")
default:
print("Midweek")
endswitch
for i = 1 to 10
print(i)
next i
for i = 0 to 20 step 2
print(i)
next i
while answer != "quit"
answer = input("Enter command: ")
endwhile
Subscribe to continue reading
Get full access to this lesson and all 10 lessons in this course.