OCR A-Level Computer Science sample questions and answers (H446)
Guide overview All 16 topics Sample questions Papers and weighting Look inside Questions and answers
36 sample questions and answers
Taken from every topic of OCR A-Level Computer Science, specification H446. The full guide has 1,549.
Component 01
Processors: Structure, Performance and Types
91 questions in the guide, across 7 subtopics. More from this topic
-
Inside the CPU: ALU, control unit, registers and buses
What is held in the current instruction register, and what two parts does it split into?
Show the answer
The CIR holds the instruction currently being decoded and executed, copied there from the MDR at the end of the fetch. The control unit splits it into the opcode, which says what operation to perform, and the operand, which says what to perform it on: a value, a register, or a memory address. -
Inside the CPU: ALU, control unit, registers and buses
What travels on the control bus?
Show the answer
Control and timing signals rather than data. Typical signals are read, write, the clock pulse used to synchronise components, memory request, interrupt request, bus request and bus grant, and reset. It is bidirectional, because devices send signals back to the processor, an interrupt request being the obvious example. -
The fetch-decode-execute cycle
Which register tells you what the processor is doing right now, and which tells you what it is about to do?
Show the answer
The current instruction register holds the instruction being decoded or executed at this moment. The program counter holds the address of the instruction that will be fetched next.
Component 01
Input, Output and Storage
46 questions in the guide, across 4 subtopics. More from this topic
Component 01
Systems Software
97 questions in the guide, across 7 subtopics. More from this topic
-
Operating systems: need, function and purpose
How does an operating system provide a 'platform' for application software?
Show the answer
It exposes a consistent set of services and interfaces (often called an application programming interface) that applications call instead of controlling hardware. A word processor asks the operating system to save a file; it does not need to know whether the storage is a hard disk drive, a solid state drive or a network share. -
Memory management: paging, segmentation and virtual memory
What is virtual memory?
Show the answer
A technique in which a section of secondary storage is used as though it were RAM. Pages that are not currently needed are written out to this area, freeing real RAM for the pages that are needed, so programs larger than physical memory can run and more programs can be open at once than would otherwise fit. -
Memory management: paging, segmentation and virtual memory
A machine has 8 KiB of RAM available to processes and a page size of 1 KiB. A process needs 5.2 KiB. How many frames does it occupy and how much space is wasted?
Show the answer
5.2 KiB requires 6 pages, because a partly used page still needs a whole frame, so it occupies 6 frames of 1 KiB. The wasted space is 6 - 5.2 = 0.8 KiB, sitting unused inside the last page. This waste inside an allocated page is internal fragmentation.
Component 01
Applications Generation
64 questions in the guide, across 5 subtopics. More from this topic
-
Applications and utilities
What is application software?
Show the answer
Software that carries out a task the end user actually wants done, rather than running or maintaining the computer itself - for example a word processor, a spreadsheet, a web browser, a database front end, a photo editor or a game. It relies on system software to reach the hardware. -
Open source and closed source
What is open source software?
Show the answer
Software released with its source code, under a licence that allows anyone to read it, modify it and redistribute it. It is usually, though not necessarily, free of charge; the defining feature is the freedom granted by the licence, not the price. -
Translators: interpreters, compilers and assemblers
What is a compiler?
Show the answer
A translator that takes the whole of a high-level source program and translates it in one operation into object or machine code, producing an executable file. Once compiled, the program can be run repeatedly without the compiler or the source code being present.
Component 01
Software Development
41 questions in the guide, across 3 subtopics. More from this topic
-
The five development methodologies
State the stages of the waterfall lifecycle in order.
Show the answer
Feasibility study; requirements analysis; design; implementation (coding); testing; installation, then ongoing evaluation and maintenance. Each stage is completed and approved before the next begins. -
Writing and following algorithms
What is a trace table, and why is it used?
Show the answer
A table with a column for each variable, in which each row records the values after one step or one pass of the algorithm, together with any output produced. It is used to dry run an algorithm by hand, so that its behaviour can be checked without a computer and the exact point at which the values go wrong can be located.
Component 01
Types of Programming Language
64 questions in the guide, across 5 subtopics. More from this topic
-
Programming paradigms and procedural languages
What is a programming paradigm?
Show the answer
A style or approach to programming - a whole way of thinking about how a program should be organised and what a program fundamentally is. It determines how the problem is broken down, how data and instructions are represented and how the flow of the program is controlled, rather than merely which keywords are typed. -
Assembly language and the Little Man Computer
What does the DAT instruction do in the Little Man Computer, and why is it not really an instruction?
Show the answer
It reserves a mailbox to hold data rather than a program instruction, and optionally sets its initial value. It is an assembler directive: it generates no operation for the processor to carry out, it simply tells the assembler to set that memory location aside, usually with a label so the program can refer to it by name. -
Modes of addressing memory
In immediate addressing, what does the operand actually mean?
Show the answer
The operand is the data itself. No memory access is needed to fetch it, because the value to be used is held in the instruction, so the processor simply uses it. If the instruction is LDA with immediate addressing and the operand is 7, the accumulator is set to 7.
Component 01
Exchanging Data
122 questions in the guide, across 9 subtopics. More from this topic
-
Compression
Lossy compression generally produces much smaller files than lossless. Why, then, is lossless ever used?
Show the answer
Because for many kinds of data any loss at all destroys the file's meaning. Lossless is used whenever the exact original bits are needed, and the price of that guarantee is a smaller reduction in size. Lossy is only acceptable where an approximation is good enough for the human viewer or listener. -
Encryption
Describe how symmetric encryption works.
Show the answer
In symmetric encryption a single shared key is used both to encrypt the plaintext and to decrypt the ciphertext. The sender and the recipient must both hold that same secret key. The sender encrypts with it, transmits the ciphertext, and the recipient applies the same key to recover the plaintext. -
Hashing
What is a collision?
Show the answer
A collision occurs when two different inputs produce the same hash value. Collisions are unavoidable in principle because there are more possible inputs than there are possible fixed-size outputs, so a good hash function aims to make them rare and hard to engineer rather than impossible.
Component 01
Networks
92 questions in the guide, across 8 subtopics. More from this topic
-
Characteristics of networks, LANs and WANs, protocols and standards
Is the internet a LAN or a WAN?
Show the answer
The internet is the largest example of a wide area network - in fact a global collection of interconnected wide area networks. It spans the whole planet, no single organisation owns its infrastructure, and it exists to join together enormous numbers of separate networks including individual LANs. -
Protocol layering and the TCP/IP stack
Which protocols operate at each layer of the TCP/IP stack?
Show the answer
Application layer: HTTP, HTTPS, FTP, SMTP, POP3, IMAP, and DNS queries. Transport layer: TCP and UDP. Network layer: IP, which carries the addressing and routing. Link layer: the technologies that move frames over the physical medium, such as Ethernet on cable and Wi-Fi over radio.
Component 01
Web Technologies
71 questions in the guide, across 6 subtopics. More from this topic
-
Structure, presentation and behaviour, and HTML
What is the link element used for in the head of a page?
Show the answer
It attaches an external resource to the document, and its main use is to link the page to an external CSS stylesheet. Putting one link element in each page means every page shares one stylesheet, so the whole site is styled consistently from a single file and the browser can cache that file and reuse it across pages. -
CSS
Write and explain a CSS rule that makes all main headings blue.
Show the answer
h1 { color: blue; } The selector h1 chooses every first-level heading in any document that uses the stylesheet. The declaration inside the braces sets the property color to the value blue. Every such heading is then drawn in blue, and changing that one word changes them all. -
JavaScript
What does this produce? var total = 0; for (var i = 1; i <= 5; i++) { total = total + i; } alert(total);
Show the answer
A pop-up alert box showing 15. total starts at 0 and the loop runs with i taking the values 1, 2, 3, 4 and 5, adding each to total in turn: 0+1=1, then 3, then 6, then 10, then 15. When i becomes 6 the condition i <= 5 is false and the loop ends, so the alert displays the final value 15.
Component 01
Data Types and Number Representation
152 questions in the guide, across 9 subtopics. More from this topic
-
Primitive data types
Why is it dangerous to test two real numbers for exact equality?
Show the answer
Because rounding errors mean two calculations that should give the same value may differ in the last bits. A total built by adding 0.1 ten times may not equal 1.0 exactly. The safe test is whether the difference between the two values is smaller than a small tolerance, rather than whether they are identical. -
Primitive data types
In a language where + works on both, what is the difference between 5 + 3 and "5" + "3"?
Show the answer
5 + 3 is integer addition and gives 8. "5" + "3" is string concatenation and gives "53", because the operands are strings of characters, not numbers. The operator symbol is the same but the type of the operands decides which operation is performed. -
Binary, hexadecimal and denary conversion
Why does hexadecimal need the letters A to F?
Show the answer
Hexadecimal is base 16, so it needs sixteen distinct digit symbols. The denary digits only supply ten of them, so the remaining six values, ten to fifteen, are written A, B, C, D, E and F. A is 10, B is 11, C is 12, D is 13, E is 14 and F is 15.
Component 01
Data Structures
124 questions in the guide, across 9 subtopics. More from this topic
-
Arrays and records
How many elements does an array declared as 2 by 3 by 4 hold?
Show the answer
24. The sizes of the dimensions multiply: 2 x 3 x 4 = 24 elements. -
Arrays and records
An array of 4-byte integers begins at address 2000 and is indexed from 0. What is the address of element 6?
Show the answer
2024. Address = 2000 + (6 x 4) = 2000 + 24 = 2024. Note that if the array were indexed from 1 instead, you would use (6 - 1) x 4, giving 2020 - always check the base index. -
Lists and tuples, and creating, traversing, adding and removing items
What is a list?
Show the answer
An ordered, dynamic collection of items where each item has a position. Unlike an array, a list can grow and shrink at run time, items can be inserted and removed at any position, and in many languages the items do not all have to be the same data type. Underneath it may be implemented with a dynamic array or a linked list.
Component 01
Boolean Algebra
85 questions in the guide, across 5 subtopics. More from this topic
-
Logic Gates and Truth Tables
Describe the NAND gate and give its truth table.
Show the answer
The symbol is the AND gate's D shape with a small circle on its output, the circle indicating inversion. It is NOT AND, so its output is the exact opposite of AND: 1 in every case except when all inputs are 1. Truth table: 0,0 gives 1; 0,1 gives 1; 1,0 gives 1; 1,1 gives 0. -
Logic Gates and Truth Tables
What happens if you connect both inputs of a NAND gate to the same signal? Work it out from the truth table.
Show the answer
Only two rows are then reachable. With both inputs 0, NAND gives 1; with both inputs 1, NAND gives 0. That is exactly the behaviour of a NOT gate, so a NAND with its inputs tied together inverts. The same trick works with a NOR gate, whose 0,0 row gives 1 and 1,1 row gives 0. -
Defining Problems Using Boolean Logic
Write an expression, in terms of A and B only, that is true when exactly one of the two inputs is true, without using the XOR symbol.
Show the answer
Q = A.B' + A'.B - that is, A true and B false, or A false and B true. This is the sum-of-products form of exclusive OR, and it is exactly what an XOR gate does. Writing it out this way is useful when you need to build the function from AND, OR and NOT gates only.
Component 01
Legal, Moral, Cultural and Ethical Issues
73 questions in the guide, across 7 subtopics. More from this topic
Component 02
Elements of Computational Thinking
78 questions in the guide, across 5 subtopics. More from this topic
Component 02
Problem Solving and Programming
119 questions in the guide, across 10 subtopics. More from this topic
-
Programming techniques: Programming constructs
Why must a file be closed after a program has finished reading or writing it?
Show the answer
Closing releases the file for other programs and makes sure any data still held in a buffer is actually written to storage. -
Programming techniques: Programming constructs
What do the MOD and DIV operators return?
Show the answer
MOD returns the remainder of an integer division and DIV returns the whole-number quotient, so 12 MOD 5 is 2 and 12 DIV 5 is 2.
Component 02
Algorithms
230 questions in the guide, across 17 subtopics. More from this topic
-
Designing and analysing an algorithm
Explain how decomposition helps in the design of an algorithm.
Show the answer
Decomposition breaks a large problem into smaller sub-problems, each of which can be solved, tested and understood separately. It makes the design manageable, allows different sub-problems to be worked on independently or reused elsewhere, and means a fault can be located in one small part rather than across the whole solution. -
Comparing algorithms and choosing one for a task
Besides the number of operations, what else should you weigh when choosing an algorithm for a task?
Show the answer
How much memory it needs and how much is available, the size of the data set now and in the future, whether the data is already partly sorted, whether the data arrives all at once or item by item, whether equal items must keep their original order, and how complicated the algorithm is to implement correctly and maintain. -
Queues
Describe the algorithm for removing an item from a queue.
Show the answer
Check whether the queue is empty; if it is, report the error and stop. Otherwise read the item at the position given by the front pointer, move the front pointer on by one, decrease the count of items held, and return the item read.
OCR A-Level Computer Science Active Recall Guide
The other 1,513 questions, with the answers printed after each section.