OCR H446 A Level Computer Science · 1.2 Software and Software Development
Stretch tasks Types of Programming Language and Assembly
Quiz Challenge
A quiz game against four computer players, then short and long written answers.
- Quiz Blitz12 questions against the clock
- Quick Fire4 short answers
- Big Think2 long answers
About 20 minutes
This or That
Pixel the cat asks 8 questions. Each has two answers: pick the right one.
- Two answers to every question
- A fish treat for every right answer
- Streaks win Pixel shades, then a party hat
About 4 minutes
Memory Match
Flip the cards two at a time to match each code card to its meaning card.
- 12 cards: each code has a meaning
- One peek at every card
- Combo points for pairs found in a row
6 pairs, about 4 minutes
Sort It
Sort each statement into the right box, like the tick box tables in the exam.
- 12 cards to sort into 4 boxes
- Drag a card, tap a box or press its number
- Combo points for cards sorted in a row
12 cards, about 4 minutes
Code Word
Guess the lesson's secret words. Every guess shows which letters are right.
- A clue for every word
- Tiles turn green, amber or grey after each guess
- Fewer guesses win more points
3 words, about 4 minutes
Link Up
12 tiles hide 3 groups of 4. Work out what links them.
- Pick four tiles that belong together
- Four slips and the round is over
- Fewer slips win more points
3 groups, about 3 minutes
Bug Hunt
Two statements are true and one has a bug. Catch the bug before it gets away.
- Three statements in every round
- Tap the one with the mistake
- Streaks win bonus points
5 rounds, about 4 minutes
Brain games
Train your brain on this lesson
Logic, memory and speed, built from this lesson's own key ideas. Win up to three diamonds in each game.
Odd One Out
Four tiles: three share a link and one does not. Spot the odd one out, then see what links the rest.
- Three belong together, one does not
- A hint shows the link, for fewer points
- Quick answers and streaks win more
8 rounds, about 3 minutes
Memory Flash
Study the code cards, then they flip over. Find the card that goes with each clue, from memory.
- Three levels: 3, 4 and 6 cards
- Two tries to find each card
- Streaks win bonus points
3 levels, about 4 minutes
Fact or Fib
Statements fly in one at a time. Is each one a fact or a fib? Decide fast.
- Swipe, tap or use the arrow keys
- Every fib comes with its fix
- Streaks multiply your points
12 statements, about 3 minutes
The final challenge
City Run
Race a robot cat on inline skates through a neon cyber city, from Neon Station to the Hyper Tunnel. Every question is a row of neon gates across the tracks: skate through the one with the right answer, dodge the trains and barriers, and grab diamonds.
- 20 questions from this lesson, in four parts of the city
- Swipe, tap or use the arrow keys
- Dodge trains and holograms, and jump crates and cones
20 questions, about 6 minutes
Bonus challenge
Neon Roll
Roll a glowing ball down an endless neon slope, past towers lit up with neon signs of Pixel the cat. Steer, jump the gaps and dodge the blocks. Questions from this lesson wait at gates along the way: every right answer keeps the ball rolling.
- Questions from this lesson at every gate
- Hold the arrow keys or a side of the slope to steer
- 8 right answers win two diamonds, 15 win three
Endless, about 5 minutes
The games need JavaScript. Every question is below, with the answers at the end.
Read the lesson: Types of Programming Language and Assembly
Types of Programming Language and Assembly: the questions
Quiz Challenge, round 1: Quiz Blitz
In ADD #5, what does the # tell you?
- Add 5 to the index register
- The operand is the value 5 itself
- Add the contents of address 5
- Follow the address stored at 5
Which addressing mode suits stepping through an array?
- Indexed
- Immediate
- Direct
- Indirect
In LMC, BRP branches when the accumulator is zero or positive.
- True
- False
Which paradigm specifies what result is wanted rather than how to compute it?
- Procedural
- Object oriented
- Assembly
- Declarative
Which TWO are features of object oriented programming?
Tick 2.
- Inheritance
- Encapsulation
- Direct control of registers
- Immediate addressing
- Mnemonics such as LDA
Which LMC mnemonic stores the accumulator in memory?
What does LDA 20 do in LMC?
- Loads the contents of address 20 into the accumulator
- Loads the number 20 into the accumulator
- Stores the accumulator at address 20
- Branches to address 20
Order these from the most memory accesses needed to fetch the value to the fewest.
Number these 1 to 3.
- Direct
- Immediate
- Indirect
Object oriented programming is always the best choice of paradigm.
- True
- False
Why is assembly still used for some device drivers?
- It is easier to read than high level code
- It runs on every processor without change
- It needs no translation at all
- It gives direct control of registers and memory, with tight timing
What does this LMC program output if the input is 7?
INP SUB one OUT HLT one DAT 1- 7
- 8
- 1
- 6
Which paradigm bundles data with the methods that act on it?
- Declarative
- Assembly
- Object oriented
- Procedural
Quiz Challenge, round 2: Quick Fire
Explain the difference between direct and indirect addressing. [2 marks]
Explain why indexed addressing is useful for arrays. [2 marks]
Give two reasons a team building a large system might choose object oriented programming. [2 marks]
Describe what this LMC program does. [2 marks]
INP STA num ADD num OUT HLT num DAT
Quiz Challenge, round 3: Big Think
A games company is building a large game with many kinds of character that share most of their behaviour. Justify using an object oriented approach. [6 marks]
Explain why assembly language is still used, despite being hard to write. [4 marks]
This or That: tick the right answer
In ADD (60), what is stored at address 60?
- The address of the value
- The value to add
Which addressing mode is fastest?
- Immediate
- Indirect
Which LMC instruction branches only when the accumulator is zero?
- BRP
- BRZ
Which paradigm is SQL?
- Procedural
- Declarative
Which feature removes duplication by putting shared code in a superclass?
- Encapsulation
- Inheritance
A 50 line script tidies a spreadsheet once. Which paradigm suits it?
- Object oriented
- Procedural
Which is tied to one processor architecture?
- Assembly language
- Python
What does OUT do in LMC?
- Halts the program
- Outputs the accumulator
Memory Match: match each code to its meaning
| Code | Meaning |
|---|---|
| A LDA | 1 Branch if the accumulator is not negative |
| B STA | 2 Stop the program |
| C BRZ | 3 Store the accumulator in memory |
| D BRP | 4 Branch always |
| E BRA | 5 Branch only when the accumulator is zero |
| F HLT | 6 Load from memory into the accumulator |
Sort It: tick one box in each row
Which addressing mode does each card describe?
| Statement | Immediate | Direct | Indirect | Indexed |
|---|---|---|---|---|
ADD (60) | ||||
ADD 60 adds whatever is stored at address 60 | ||||
| The operand points to a location holding the address | ||||
| Lets a program follow a pointer | ||||
| The operand is the address of the value | ||||
ADD #5 | ||||
How LDA 20 works in Little Man Computer | ||||
| The operand is the value itself | ||||
| Ideal for stepping through an array | ||||
| Only the index register changes between elements | ||||
| Fastest, as no memory access is needed | ||||
| The address is the operand plus an index register |
Code Word: write the word that fits each clue
A short code such as LDA or STA that stands for a machine instruction. (8 letters)
A template from which objects are created. (5 letters)
An approach to structuring a program, such as procedural or object oriented. (8 letters)
Link Up: find the three groups
These 12 tiles make 3 groups of 4. Write each group in the table, and what links its tiles.
- Direct
- Encapsulation
- Polymorphism
- Classes
- STA
- BRZ
- Inheritance
- HLT
- LDA
- Indirect
- Immediate
- Indexed
| Group | The 4 tiles | What links them |
|---|---|---|
| Group 1 | ||
| Group 2 | ||
| Group 3 |
Bug Hunt: tick the statement that is wrong
In each set, two statements are true and one has a mistake in it.
- In direct addressing the operand is the address of the value.
- In immediate addressing the operand is the value itself.
- In indexed addressing the operand is the address of an address.
- BRP branches only when the accumulator is more than zero.
- STA copies the value in the accumulator to a memory address.
- BRZ branches only when the value in the accumulator is zero.
- Encapsulation lets an object protect its own state.
- Polymorphism means a class can only have one method.
- Inheritance puts shared code in a superclass.
- Procedural programs group instructions into procedures and functions.
- Declarative code spells out every step the computer must take.
- SQL is a declarative language.
- Assembly gives direct control over registers and memory.
- One assembly instruction usually matches one machine instruction.
- Assembly language programs run on any processor without changes.
Brain game: Odd One Out
Three tiles in each set share a link. Tick the odd one out, then write what links the other three.
- Direct
- LDA
- Indirect
- Immediate
What links the other three?
- STA
- Inheritance
- HLT
- LDA
What links the other three?
- Encapsulation
- Polymorphism
- STA
- Inheritance
What links the other three?
- Direct
- Polymorphism
- Indirect
- Immediate
What links the other three?
- Polymorphism
- STA
- BRZ
- LDA
What links the other three?
- Encapsulation
- Classes
- Inheritance
- Indirect
What links the other three?
Brain game: Memory Flash, on paper
Which code does this? Write your answer from memory.
Branch if the accumulator is not negative
Stop the program
Store the accumulator in memory
Branch always
Branch only when the accumulator is zero
Load from memory into the accumulator
Brain game: Fact or Fib
Tick Fact if the statement is true and Fib if it is not.
Assembly gives direct control over registers and memory.
- Fact
- Fib
Polymorphism means a class can only have one method.
- Fact
- Fib
Encapsulation lets an object protect its own state.
- Fact
- Fib
BRP branches only when the accumulator is more than zero.
- Fact
- Fib
Assembly language programs run on any processor without changes.
- Fact
- Fib
Declarative code spells out every step the computer must take.
- Fact
- Fib
In indexed addressing the operand is the address of an address.
- Fact
- Fib
SQL is a declarative language.
- Fact
- Fib
Object oriented programming is always the best choice of paradigm.
- Fact
- Fib
Procedural programs group instructions into procedures and functions.
- Fact
- Fib
In direct addressing the operand is the address of the value.
- Fact
- Fib
In immediate addressing the operand is the value itself.
- Fact
- Fib
City Run
City Run is a race through a neon cyber city, played on screen. It asks 20 of the questions above, from the quiz, This or That, Memory Flash and Fact or Fib.
Neon Roll
Neon Roll is a ball rolling down an endless neon slope, played on screen. Every right answer keeps it rolling. It asks the questions above, from the quiz, This or That, Memory Flash and Fact or Fib.
Answers
Round 1: Quiz Blitz
- The operand is the value 5 itself The # marks immediate addressing: the operand is the value, so no memory access is needed.
- Indexed The address is the operand plus an index register, so only the index changes from one element to the next.
- True BRP is branch if positive, and LMC counts zero as positive. Forgetting the zero case is a classic tracing mistake.
- Declarative SQL is declarative: you describe the rows you want and the database works out how to find them.
- Inheritance; Encapsulation Inheritance and encapsulation belong to object oriented programming. The others belong to assembly language.
- sta STA, code 3xx, stores the accumulator at address xx. LDA loads it.
- Loads the contents of address 20 into the accumulator LMC uses direct addressing: the operand is an address, so LDA 20 copies whatever is stored at address 20.
- Indirect → Direct → Immediate Indirect reads an address and then the value, direct reads the value once, and immediate already has it in the instruction.
- False For a short data script it adds overhead for no gain. The right paradigm depends on the problem.
- It gives direct control of registers and memory, with tight timing Assembly is fast and precise, though it is hard to maintain and tied to one processor.
- 6 INP puts 7 in the accumulator, SUB one subtracts the 1 stored at the label one, and OUT outputs 6.
- Object oriented Objects hold their own attributes and methods, so each object controls its own state.
Round 2: Quick Fire
- In direct addressing the operand is the address of the value
- In indirect addressing the operand is the address of a location holding the address of the value
Model answerIn direct addressing the operand is the address of the value. In indirect addressing the operand is the address of a location that holds the address of the value, like a pointer.
- The address is the operand plus the contents of an index register
- Only the index register changes to move to the next element
Model answerThe address used is the operand plus the contents of the index register, so to move to the next element of the array only the index register needs to be incremented.
- Inheritance reuses shared code, removing duplication
- Encapsulation lets each object protect its own data
- Polymorphism lets new types be added without changing existing code
- Separate classes can be built and tested independently
Model answerInheritance lets shared code sit in a superclass so it is reused rather than duplicated, and encapsulation means each object protects its own data so it stays valid.
- It inputs a number and stores it
- It outputs double the number
Model answerIt inputs a number, stores it in num, adds it to itself and outputs the result, so it outputs double the number.
Round 3: Big Think
- Each kind of character is a class, each character an instance
- Shared behaviour goes in a superclass that the others inherit
- Subclasses override only what is different
- Polymorphism lets the same method be called on every character
- New kinds of character can be added without changing existing code
- Encapsulation keeps each character's data private and valid
- A large team can work on separate classes at once
Model answerEach kind of character can be a class, and each character in the game an instance of it. The behaviour they share goes in a superclass, which the others inherit, so the code is not duplicated, and each subclass overrides only what is different. Polymorphism means the game can call the same method on every character, whatever its type, so new kinds of character can be added without changing existing code. Encapsulation keeps each character's data private, so its state stays valid, and a large team can work on separate classes at the same time.
- It gives direct control over registers, memory addresses and hardware
- The code is very fast and uses little memory
- It suits device drivers and constrained embedded systems
- Each instruction maps onto one machine instruction, so the programmer knows exactly what runs
- It is kept despite being specific to one processor and hard to maintain
Model answerAssembly gives direct control over registers and memory addresses, and each instruction maps one to one onto a machine instruction, so the programmer knows exactly what runs. The resulting code is very fast and uses little memory, which matters for device drivers and embedded systems with tight constraints. It is kept for these jobs even though it is specific to one processor and hard to maintain.
This or That
- The address of the value Brackets mean indirect addressing: address 60 holds a pointer to where the value really is.
- Immediate The value is inside the instruction, so no memory access is needed. Indirect needs two.
- BRZ BRZ is branch if zero. BRP branches if the accumulator is zero or positive.
- Declarative SQL describes what data you want, and the database decides how to fetch it.
- Inheritance Subclasses inherit the shared code. Encapsulation is about an object controlling its own state.
- Procedural A short series of steps is naturally procedural. Classes would add overhead for no gain.
- Assembly language Assembly maps onto one processor's machine code, so it must be rewritten for another. Python runs anywhere with an interpreter.
- Outputs the accumulator OUT, code 902, outputs whatever is in the accumulator. HLT stops the program.
Memory Match
- A 6 LDA: Load from memory into the accumulator
- B 3 STA: Store the accumulator in memory
- C 5 BRZ: Branch only when the accumulator is zero
- D 1 BRP: Branch if the accumulator is not negative
- E 4 BRA: Branch always
- F 2 HLT: Stop the program
Sort It
- Indirect
ADD (60)Brackets mark indirect addressing: address 60 holds the address of the value. - Direct
ADD 60adds whatever is stored at address 60 The operand 60 is an address, which is direct addressing. - Indirect The operand points to a location holding the address Indirect addressing follows a pointer to reach the value.
- Indirect Lets a program follow a pointer Indirect addressing is how pointers and dynamic data structures work.
- Direct The operand is the address of the value Direct addressing gives the address where the value is stored.
- Immediate
ADD #5The # marks immediate addressing, so this adds the number 5. - Direct How
LDA 20works in Little Man Computer LMC instructions use direct addressing: the operand is a mailbox address. - Immediate The operand is the value itself Immediate addressing carries the value inside the instruction.
- Indexed Ideal for stepping through an array Moving to the next element only needs the index register to change.
- Indexed Only the index register changes between elements The operand stays the same while the index steps along the array.
- Immediate Fastest, as no memory access is needed The value is already in the instruction, so nothing is fetched.
- Indexed The address is the operand plus an index register Indexed addressing adds the index register to the operand.
Code Word
- MNEMONIC A short code such as LDA or STA that stands for a machine instruction.
- CLASS A template from which objects are created.
- PARADIGM An approach to structuring a program, such as procedural or object oriented.
Link Up
- Addressing modes Immediate; Direct; Indirect; Indexed
- LMC mnemonics LDA; STA; BRZ; HLT
- Object oriented ideas Inheritance; Encapsulation; Polymorphism; Classes
Bug Hunt: the wrong statement, and why
- In indexed addressing the operand is the address of an address. That is indirect addressing. Indexed addressing adds the operand to the contents of an index register.
- BRP branches only when the accumulator is more than zero. BRP also branches when the accumulator is zero, because LMC treats zero as positive.
- Polymorphism means a class can only have one method. Polymorphism lets the same method call work on objects of different classes, each responding in its own way.
- Declarative code spells out every step the computer must take. That is procedural. Declarative code says what result is wanted and leaves the how to the system.
- Assembly language programs run on any processor without changes. Assembly is tied to one processor's instruction set, so it must be rewritten for a different architecture.
Odd One Out
- LDA is the odd one out: it goes with LMC mnemonics. The other three: Addressing modes.
- Inheritance is the odd one out: it goes with Object oriented ideas. The other three: LMC mnemonics.
- STA is the odd one out: it goes with LMC mnemonics. The other three: Object oriented ideas.
- Polymorphism is the odd one out: it goes with Object oriented ideas. The other three: Addressing modes.
- Polymorphism is the odd one out: it goes with Object oriented ideas. The other three: LMC mnemonics.
- Indirect is the odd one out: it goes with Addressing modes. The other three: Object oriented ideas.
Memory Flash
- BRP Branch if the accumulator is not negative
- HLT Stop the program
- STA Store the accumulator in memory
- BRA Branch always
- BRZ Branch only when the accumulator is zero
- LDA Load from memory into the accumulator
Fact or Fib
- Fact Assembly gives direct control over registers and memory.
- Fib Polymorphism means a class can only have one method. The fix: Polymorphism lets the same method call work on objects of different classes, each responding in its own way.
- Fact Encapsulation lets an object protect its own state.
- Fib BRP branches only when the accumulator is more than zero. The fix: BRP also branches when the accumulator is zero, because LMC treats zero as positive.
- Fib Assembly language programs run on any processor without changes. The fix: Assembly is tied to one processor's instruction set, so it must be rewritten for a different architecture.
- Fib Declarative code spells out every step the computer must take. The fix: That is procedural. Declarative code says what result is wanted and leaves the how to the system.
- Fib In indexed addressing the operand is the address of an address. The fix: That is indirect addressing. Indexed addressing adds the operand to the contents of an index register.
- Fact SQL is a declarative language.
- Fib Object oriented programming is always the best choice of paradigm. The fix: For a short data script it adds overhead for no gain. The right paradigm depends on the problem.
- Fact Procedural programs group instructions into procedures and functions.
- Fact In direct addressing the operand is the address of the value.
- Fact In immediate addressing the operand is the value itself.

