A Level Computer Science Paper 1 B: Computer Systems
A full length H446/01 paper: registers, pipelining and GPUs; scheduling, paging and interrupts; compilation, linking and development methodologies with a 9 mark evaluation; two's complement and floating point; stacks, trees, hash tables and linked lists; Karnaugh maps and adders; SQL run against a vet's database; networks and the web; and a 12 mark discussion of live facial recognition.
Instructions
- Time allowed
- 2 hours 30 minutes
- Total marks
- 140
- Calculator
- You must not use a calculator.
- Answer all the questions.
- The number of marks for each question is shown in brackets. Use it as a guide to how much to write.
- The clock at the top counts down from the real time allowed. When it reaches zero the paper is locked and marked, as it would be collected in the exam hall.
- Questions marked with 9 and 12 marks are extended responses. In the real exam they are marked in levels; here every relevant point you make earns a mark, up to the total.
- SQL answers are run against the tables printed in question 7, so they must be valid SQL.
- Use precise technical vocabulary. In the 9 and 12 mark questions, cover several sides of the issue, apply each point to the scenario and finish with a justified conclusion.
Questions
Answer every question, then finish the paper to have it marked. Marking as you go teaches you far less.
| PC | MAR | MDR | CIR | |
|---|---|---|---|---|
| Holds the address of the next instruction to be fetched | ||||
| Holds the address of the memory location about to be read from or written to | ||||
| Holds the data or instruction just fetched from memory, or about to be written to it | ||||
| Holds the instruction that is currently being decoded and executed |
Tick one box in each row.
- LHolds the address of the next instruction to be fetched: PC
- LHolds the address of the memory location about to be read from or written to: MAR
- LHolds the data or instruction just fetched from memory, or about to be written to it: MDR
- LHolds the instruction that is currently being decoded and executed: CIR
The program counter points to the next instruction, the MAR holds an address, the MDR holds what travels on the data bus, and the CIR holds the instruction being worked on.
- LThe fetch, decode and execute stages of different instructions overlap
- LSo the parts of the processor are not left idle and more instructions are completed each second
- LAfter a branch, the instructions already fetched and decoded may not be the ones that run next
- LSo the pipeline has to be flushed and refilled, wasting clock cycles
Pipelining overlaps the stages of the fetch-decode-execute cycle: while one instruction executes, the next is being decoded and the one after that fetched. No part of the processor sits idle, so more instructions complete per second. A conditional branch is not resolved until it executes, by which time the instructions after it have already been fetched and decoded. If the branch is taken those instructions are the wrong ones, so the pipeline must be flushed and refilled, wasting the cycles spent on them.
| CISC | RISC | |
|---|---|---|
| Has a large set of complex instructions, some taking many clock cycles | ||
| Has a small set of simple instructions, each completing in one clock cycle | ||
| A program compiles to fewer machine code instructions, so it takes up less memory | ||
| Pipelining is easier, because every instruction takes the same time |
Tick one box in each row.
- L1 mark for both: Has a large set of complex instructions, some taking many clock cycles: CISC; Has a small set of simple instructions, each completing in one clock cycle: RISC
- L1 mark for both: A program compiles to fewer machine code instructions, so it takes up less memory: CISC; Pipelining is easier, because every instruction takes the same time: RISC
CISC does more per instruction with more complex hardware; RISC keeps instructions simple and uniform, which suits pipelining.
- LA GPU has a very large number of simple cores
- LThey carry out the same instruction on many pieces of data at the same time (SIMD)
- LSo tasks made of many independent calculations, such as rendering images or training machine learning models, are much faster
A GPU contains thousands of simple cores designed to carry out the same instruction on many items of data at once. Tasks made of large numbers of independent, identical calculations, such as working out the colour of every pixel in an image or the matrix arithmetic in machine learning, can be split across all of those cores, so they complete far faster than on a CPU's few powerful cores.
- L12 ms
- L9 ms
- L11 ms
A runs 0-2, B 2-4, C 4-6, A 6-8, B 8-9 and finishes, C 9-11 and finishes, then A 11-12 and finishes.
Tick one box.
- LB Shortest job first
Shortest job first always picks the shortest process, so if short ones keep arriving a long one may never run.
- LPaging splits memory into blocks of a fixed size, called pages
- LSegmentation splits memory into blocks of variable size, called segments
- LPages are physical divisions, made without regard to the program's structure
- LSegments are logical divisions, matching parts of the program such as a subroutine or a data structure
Paging divides memory into equal, fixed-size pages. The divisions are physical: a page boundary can fall in the middle of a subroutine. Segmentation divides memory into segments of different sizes, and the divisions are logical, so each segment holds a complete part of the program, such as a subroutine or a data structure.
- LAt the end of each fetch-decode-execute cycle the processor checks the interrupt register
- LIf the interrupt has a higher priority than the current task it is serviced; otherwise it waits
- LThe contents of the registers, including the program counter, are saved onto a stack
- LThe address of the interrupt service routine is loaded into the program counter and the ISR runs
- LWhen it finishes, the saved values are popped from the stack and the original task resumes
At the end of every fetch-decode-execute cycle the processor checks the interrupt register. If an interrupt is waiting and its priority is higher than the current task, the processor saves the contents of its registers, including the program counter, onto a stack. The address of the matching interrupt service routine is loaded into the program counter, so the ISR runs. When it finishes, the saved values are popped back off the stack and the interrupted task carries on exactly where it stopped. An interrupt of lower priority waits until the current task allows it.
| Real-time | Distributed | Multi-user | Embedded | |
|---|---|---|---|---|
| Must respond to inputs within a guaranteed time, such as a car's anti-lock brakes | ||||
| Shares the processing of one task across several networked computers | ||||
| Lets several people use the resources of one computer at the same time | ||||
| Built into a device with limited resources to control one function |
Tick one box in each row.
- L1 mark for both: Must respond to inputs within a guaranteed time, such as a car's anti-lock brakes: Real-time; Shares the processing of one task across several networked computers: Distributed
- L1 mark for both: Lets several people use the resources of one computer at the same time: Multi-user; Built into a device with limited resources to control one function: Embedded
Guaranteed response times are real-time, work spread over networked computers is distributed, many users of one machine is multi-user, and an OS built into a device is embedded.
| Lexical analysis | Syntax analysis | Code generation | Optimisation | |
|---|---|---|---|---|
| Whitespace and comments are removed and the code is split into tokens | ||||
| The tokens are checked against the rules of the language and an abstract syntax tree is built | ||||
| Object code is produced from the abstract syntax tree | ||||
| Code is removed or changed so the program runs faster or uses less memory |
Tick one box in each row.
- LWhitespace and comments are removed and the code is split into tokens: Lexical analysis
- LThe tokens are checked against the rules of the language and an abstract syntax tree is built: Syntax analysis
- LObject code is produced from the abstract syntax tree: Code generation
- LCode is removed or changed so the program runs faster or uses less memory: Optimisation
Lexical analysis tokenises, syntax analysis checks the grammar and builds the tree, code generation produces object code and optimisation improves it.
- LStatic linking copies the library code into the executable file when it is built
- LSo the executable is larger, but self-contained: it runs without the library being present
- LDynamic linking loads the library from a separate file when the program runs, and it can be shared by several programs
- LSo executables are smaller and library updates apply to them automatically, but the program fails if the library is missing or the wrong version
With static linking the linker copies the library code the program uses into the executable. The file is larger, but it is self-contained and always has the version of the library it was built with. With dynamic linking the executable only holds a reference, and the library, a separate file such as a DLL, is loaded when the program runs and can be shared by many programs. Executables are smaller and pick up library updates automatically, but the program will not run if the library is missing or an incompatible version is installed.
| Waterfall | Rapid application development | Spiral model | Extreme programming | |
|---|---|---|---|---|
| Each stage is completed and signed off before the next one begins | ||||
| Prototypes are built quickly and refined with constant feedback from users | ||||
| Each cycle of development starts by identifying and resolving the biggest risks | ||||
| Programmers work in pairs, and the code is tested continually and refactored |
Tick one box in each row.
- LEach stage is completed and signed off before the next one begins: Waterfall
- LPrototypes are built quickly and refined with constant feedback from users: Rapid application development
- LEach cycle of development starts by identifying and resolving the biggest risks: Spiral model
- LProgrammers work in pairs, and the code is tested continually and refactored: Extreme programming
Sequential sign-off is waterfall, repeated prototypes are RAD, risk-driven cycles are the spiral model, and pair programming with continual testing is extreme programming.
- LWaterfall has clear stages, documentation and sign-off, so it is easy to plan and manage
- LBut waterfall fixes the requirements at the start, so changing them later is difficult and expensive
- LIn waterfall the client sees the product only near the end, so problems are found late
- LAgile works in short iterations, each producing a working version
- LAgile welcomes changing requirements, with regular feedback from the client and customers
- LExtreme programming's pair programming and continual testing give high quality code
- LA banking app must be secure and reliable: frequent, rigorous testing supports this, and documentation helps to show it meets regulations
- LAgile's drawbacks: less documentation, the client must stay closely involved, and the final cost and time are harder to estimate
- LA justified conclusion: an agile methodology suits this project better because its requirements will change
The waterfall model completes each stage, from analysis to maintenance, before the next begins, with documentation signed off at each step. That makes the project easy to plan and manage, and the thorough documentation helps a bank show regulators how the app was designed and tested. Its weakness here is that the requirements are fixed at the start: the client expects them to change as customers try the app, and in waterfall going back to change the design is slow and expensive. The client also sees a working product only near the end, so a misunderstanding may be discovered when it is most costly to fix. An agile methodology such as extreme programming builds the app in short iterations, each producing a working version that the client and real customers can try. Their feedback shapes the next iteration, so changing requirements are expected rather than a problem. Extreme programming also suits the need for security and reliability: programmers work in pairs, so every line is reviewed as it is written, and tests are written first and run continually, so faults are caught early and the code is refactored to stay clean. The drawbacks are that agile projects produce less documentation, which a bank may need for compliance, the client must stay closely involved throughout, and the final cost and delivery date are harder to predict. Overall an agile methodology is more suitable, because the requirements will certainly change, but the team should keep enough documentation of its security design and testing to satisfy the regulators.
- L10110111
- L11001001
73 is 0100 1001. In two's complement, invert to 1011 0110 and add 1: 1011 0111. In sign and magnitude, set the sign bit: 1100 1001.
- LCorrect answer, full marks: 5.5
- LMethod: The exponent is 3, so the binary point moves 3 places right: 0101.1000
The exponent 0011 is 3, so the binary point moves 3 places right: 0101.1000, which is 4 + 1 + 0.5 = 5.5.
- L0.1101000
- L0000
The mantissa must start 0.1, so shift it 2 places left to 0.1101000 and reduce the exponent by 2, from 2 to 0: 0000. Both represent 0.8125.
- LCorrect answer, full marks: -2.5
- LMethod: The exponent is 2, giving 101.10000, or the mantissa is found to be -0.625
The exponent 0010 is 2, so the binary point moves 2 places right: 101.10000. In two's complement that is -4 + 1 + 0.5 = -2.5.
- L00000110
- L10110101
- L01010101
AND with 0000 1111 keeps only the low four bits: 0000 0110. OR with 1000 0000 sets the top bit: 1011 0101. XOR with 1111 1111 flips every bit: 0101 0101.
- LTo give the greatest precision possible for the number of bits in the mantissa
- LSo that each number has only one representation
A normalised mantissa has no wasted leading bits, so every bit of the mantissa adds precision. It also means each number can be written in only one way, which makes numbers easy to compare.
- L-128
- L127
1000 0000 is -128 and 0111 1111 is 127.
| Position | Value |
|---|---|
| Top | |
| Middle | |
| Bottom |
- LTop: 1
- LMiddle and bottom: 3, 5
After push(5), push(9) and pop() the stack holds 5. push(3) and push(7) give 5, 3, 7, and pop() removes 7. push(1) gives 5, 3, 1 from bottom to top.
- L4
The items are in positions 4, 5, 0 and 1, wrapping round: 4 items.
| Traversal | 1st | 2nd | 3rd | 4th | 5th | 6th | 7th | 8th |
|---|---|---|---|---|---|---|---|---|
| Pre-order | ||||||||
| In-order | ||||||||
| Post-order |
- LRow 1: 50, 30, 20, 40, 35, 70, 60, 80
- LRow 2: 20, 30, 35, 40, 50, 60, 70, 80
- LRow 3: 20, 35, 40, 30, 60, 80, 70, 50
50 is the root, with 30 and 70 as its children, 20 and 40 under 30, 60 and 80 under 70, and 35 as the left child of 40. Pre-order visits the root first, in-order visits it between its subtrees, giving the values in order, and post-order visits it last.
- L4
50, then 30, then 40, then 35: four comparisons.
- LA hashing function is applied to the record's key to give its position (index) in the table
- LTo find it, the same function is applied to the key, and that position is read directly
- LA collision is when two keys hash to the same position
- LDealt with by storing the record in the next free position (linear probing), or by chaining in a linked list at that position
A hashing function is applied to the record's key to calculate its position in the table, and the record is stored there. To find it again, the same function is applied to the key, which leads straight to the right position without searching. If two keys hash to the same position, a collision, the second record can be put in the next free position, which is then searched in order, or each position can hold a linked list of every record that hashes to it.
Figure 1: a linked list held in an array. The start pointer is 1, the next free position is 5, and -1 marks the end of the list.
| Index | Data | Next |
|---|---|---|
| 0 | Kiwi | 4 |
| 1 | Apple | 3 |
| 2 | Fig | 0 |
| 3 | Banana | 2 |
| 4 | Mango | -1 |
| 5 |
- L2
- L5
Cherry belongs between Banana and Fig. Cherry takes Banana's old pointer, 2, so it points to Fig, and Banana's pointer changes to 5, Cherry's position.
Tick one box.
- LA Stack
The most recent call must return first, which is last in, first out: a stack.
- LA
A ∧ (B ∨ ¬B) = A ∧ 1 = A.
Tick one box.
- LD ¬A ∧ ¬B
De Morgan's law: negate each term and change OR to AND.
| AB | C = 0 | C = 1 |
|---|---|---|
| 00 | ||
| 01 | ||
| 11 | ||
| 10 |
- LRows 00 and 01: 0, 1, 0, 1
- LRows 11 and 10: 0, 1, 1, 1
Every cell where C is 1 is 1. A ∧ ¬B adds the cell where AB is 10 and C is 0.
Figure 2: a Karnaugh map. AB labels the rows and CD the columns.
| AB \\ CD | 00 | 01 | 11 | 10 |
|---|---|---|---|---|
| 00 | 0 | 1 | 0 | 0 |
| 01 | 0 | 1 | 0 | 0 |
| 11 | 1 | 1 | 1 | 1 |
| 10 | 0 | 1 | 0 | 0 |
Tick one box.
- LC (A ∧ B) ∨ (¬C ∧ D)
The row AB = 11 is all 1s, giving A ∧ B, and the column CD = 01 is all 1s, giving ¬C ∧ D.
| A | B | Sum | Carry |
|---|---|---|---|
| 0 | 0 | ||
| 0 | 1 | ||
| 1 | 0 | ||
| 1 | 1 |
- LSum column: 0, 1, 1, 0
- LCarry column: 0, 0, 0, 1
Sum is 1 when exactly one input is 1. Carry is 1 only when both are 1.
| AND | OR | XOR | NOT | |
|---|---|---|---|---|
| Sum | ||||
| Carry |
Tick one box in each row.
- LSum: XOR
- LCarry: AND
Sum = A XOR B and Carry = A AND B.
- LIt stores a single bit, so it is used as memory, for example in registers
- LThe output Q takes the value of the data input D when the clock pulse rises (on the rising edge)
- LThe output then stays the same, whatever D does, until the next rising edge
A D-type flip-flop stores one bit, so it is a building block of registers and memory. On each rising edge of the clock, the output Q takes the value of the data input D. Between rising edges Q holds that value, however D changes.
Figure 3
Owner
| OwnerID | Surname | Phone |
|---|---|---|
| 10 | Patel | 01632 960101 |
| 11 | Okafor | 01632 960245 |
| 12 | Byrne | 01632 960377 |
| 13 | Novak | 01632 960412 |
Pet
| PetID | Name | Species | OwnerID |
|---|---|---|---|
| 1 | Biscuit | Dog | 12 |
| 2 | Luna | Cat | 10 |
| 3 | Thumper | Rabbit | 11 |
| 4 | Ziggy | Dog | 12 |
| 5 | Clover | Rabbit | 13 |
| 6 | Mochi | Cat | 12 |
| 7 | Pepper | Rabbit | 10 |
Visit
| VisitID | PetID | Cost |
|---|---|---|
| 101 | 1 | 45.00 |
| 102 | 2 | 18.50 |
| 103 | 4 | 120.00 |
| 104 | 3 | 15.00 |
| 105 | 6 | 32.00 |
| 106 | 1 | 19.99 |
| 107 | 7 | 60.00 |
| 108 | 5 | 20.00 |
| Primary key | Foreign key | |
|---|---|---|
| PetID in the Pet table | ||
| OwnerID in the Pet table | ||
| PetID in the Visit table | ||
| VisitID in the Visit table |
Tick one box in each row.
- L1 mark for both: PetID in the Pet table: Primary key; OwnerID in the Pet table: Foreign key
- L1 mark for both: PetID in the Visit table: Foreign key; VisitID in the Visit table: Primary key
Each table's own ID is its primary key. OwnerID in Pet and PetID in Visit link to other tables, so they are foreign keys.
- LSELECT Name, Species
- LFROM Pet
- LWHERE OwnerID = 12
- LORDER BY Name (ASC)
ORDER BY sorts in ascending order unless DESC is given.
SELECT Name, Species
FROM Pet
WHERE OwnerID = 12
ORDER BY Name- LSELECT Surname, Name
- LFROM Owner, Pet, or an INNER JOIN of the two tables
- LJoins the tables: Owner.OwnerID = Pet.OwnerID
- LOnly the rabbits: Species = 'Rabbit'
The join condition pairs each pet with its own owner. An INNER JOIN ... ON Owner.OwnerID = Pet.OwnerID with WHERE Species = 'Rabbit' is equally correct.
SELECT Surname, Name
FROM Owner, Pet
WHERE Owner.OwnerID = Pet.OwnerID
AND Species = 'Rabbit'- LDELETE FROM Visit
- LWHERE Cost < 20: every visit costing less than £20.00 is removed
- LEvery visit costing £20.00 or more is kept, including the one costing exactly £20.00
Visit 108 cost exactly £20.00, so it must stay: the condition is < 20, not <= 20.
DELETE FROM Visit
WHERE Cost < 20- LWhen one user starts to edit a record, the record is locked
- LNo other user can change it until the first user's transaction is complete and the lock is released
- LSo the second change is made to the up-to-date record, instead of overwriting the first user's change
When the first user opens the record to edit it, the record is locked. A second user cannot change it until the first user's transaction has been completed and the lock released. The second user then works on the updated record, so their change is added to the first rather than overwriting it.
| Application | Transport | Internet | Link | |
|---|---|---|---|---|
| Splits the data into numbered packets and adds the port number | ||||
| Adds the source and destination IP addresses, which routers use to forward each packet | ||||
| Adds MAC addresses and sends the data as signals over the physical connection | ||||
| Uses the protocol for the program in use, such as HTTP or SMTP, to format the data |
Tick one box in each row.
- LSplits the data into numbered packets and adds the port number: Transport
- LAdds the source and destination IP addresses, which routers use to forward each packet: Internet
- LAdds MAC addresses and sends the data as signals over the physical connection: Link
- LUses the protocol for the program in use, such as HTTP or SMTP, to format the data: Application
Application formats, transport packetises and numbers, internet addresses and routes, link transmits.
- LThe computer first checks its own cache for the IP address
- LOtherwise the request is sent to a DNS server
- LIf that server does not know it, the request passes to other DNS servers in the hierarchy: the root, then the top level domain, then the authoritative server
- LThe IP address is returned, and the browser uses it to connect to the web server
The browser first checks its local cache in case the address was looked up recently. If not, it asks a DNS server. If that server does not hold the record, the query is passed up the hierarchy: a root server points to the server for the top level domain, such as .uk, which points to the domain's authoritative server, which holds the IP address. The address is returned to the browser, cached, and used to connect to the web server.
- LCircuit switching sets up a dedicated path for the whole communication
- LPacket switching splits the data into packets that can take different routes
- LPackets may arrive out of order and are reassembled using their sequence numbers
- LPacket switching shares the network efficiently and routes round failures; circuit switching suits real-time data because the path and order are guaranteed
Circuit switching sets up a dedicated path between the two ends for the whole communication, so data arrives in order with a constant delay, which suits real-time voice, but the path is reserved even when nothing is being sent. Packet switching splits data into numbered packets that each take the best route available, so the links are shared efficiently and packets can be rerouted around a failure. The packets may arrive out of order, and are reassembled using their sequence numbers.
- LCorrect answer, full marks: 1.425
- LMethod: Works out 2 / 4 + 1 / 1 = 1.5
2 / 4 + 1 / 1 = 1.5. 0.85 x 1.5 = 1.275. 0.15 + 1.275 = 1.425.
- LWords or patterns that occur often are stored once in a dictionary
- LEach occurrence in the file is replaced by a short reference to its dictionary entry
- LThe references take fewer bits than the words, and the file is rebuilt exactly from the dictionary, so it is lossless
Dictionary coding builds a dictionary of the words and patterns that appear in the file. Each occurrence is replaced by its short index in the dictionary, which takes far fewer bits than the word itself. The dictionary is stored with the file, so the original can be rebuilt exactly: the compression is lossless.
- LThe shop has a key pair: a public key it shares and a private key it keeps secret
- LThe customer's browser encrypts the card details with the shop's public key
- LOnly the shop's private key can decrypt them, so anyone who intercepts the data cannot read it
The shop publishes its public key and keeps the matching private key secret. The customer's browser encrypts the card details with the shop's public key. Data encrypted with that key can only be decrypted with the private key, which only the shop holds, so anyone intercepting the data in transit cannot read it.
- LA hash cannot be reversed, so if the database is stolen the passwords are not revealed
- LWhen a user logs in, the password they enter is hashed and compared with the stored hash
Hashing is one-way, so even if attackers steal the database they cannot turn the hashes back into passwords. The site never needs the password itself: it hashes whatever is typed at login and checks that it matches the stored hash.
- LIt can help catch wanted criminals and find missing people, improving public safety
- LEveryone's face is scanned without their consent, including innocent people, which affects their privacy
- LFaces are biometric data, special category personal data under the Data Protection Act 2018 and UK GDPR
- LThe data must be processed lawfully, kept only as long as necessary and kept secure
- LSurveillance by public bodies is governed by the Regulation of Investigatory Powers Act 2000
- LFalse matches mean innocent people may be stopped or wrongly accused
- LSystems trained on unrepresentative data can be less accurate for some ethnic groups, which is discriminatory
- LPeople may feel watched and avoid protests or public places, a chilling effect on freedom
- LFunction creep: the system could be extended to track ordinary people's movements
- LThe database could be hacked or leaked, an offence under the Computer Misuse Act 1990
- LSafeguards: a human checks every match, signs warn the public, and there is independent oversight
- LReaches a balanced, justified conclusion
Supporters argue that live facial recognition helps the police find wanted criminals and missing people quickly, and that its presence may deter crime, making the city centre safer. Legally, a face is biometric data, which the Data Protection Act 2018 and UK GDPR treat as special category personal data. The police need a clear lawful basis, must show the use is necessary and proportionate, must delete the images of people who do not match straight away and must keep the data secure. Covert surveillance by public bodies is also governed by the Regulation of Investigatory Powers Act 2000, and anyone who hacked the system or leaked the watch list would commit an offence under the Computer Misuse Act 1990. Morally, everyone who walks past is scanned without their consent, though nearly all of them are innocent, which is a serious intrusion on privacy. No system is perfectly accurate: a false match can lead to an innocent person being stopped and searched in public. Systems trained on unrepresentative data have been shown to be less accurate for some ethnic groups and for women, so the harm of false matches falls unequally, which is discriminatory. Culturally, people who know they are being watched may change their behaviour, for example avoiding a lawful protest, which has a chilling effect on freedom of expression and assembly and can damage trust between the public and the police. There is also the risk of function creep, in which a system introduced to find wanted criminals is gradually extended to track the movements of ordinary people. On balance the technology can be justified only with strong safeguards: a narrow watch list, a trained officer checking every match before anyone is stopped, clear signs telling the public it is in use, independent oversight and published accuracy figures. Without those, the harm to privacy and fairness outweighs the benefit.
This is an original paper modelled on the real OCR H446/01 past papers: the same structure, the same balance of topics, the same command words and mark tariffs, 140 marks in 2 hours 30 minutes, exactly as the real paper allows. It is not a past paper. Real past papers are the copyright of the exam board and cannot be republished here, so links to the official papers on the board's own site are on the exam papers page.