📚 GCSE OCR Computer Science: Typical Exam Questions Explained | GCSE OCR 计算机:典型例题详解
Welcome to this comprehensive guide covering typical exam-style questions for the OCR GCSE Computer Science specification. We will walk through representative problems from key topics, showing step‑by‑step solutions and explaining the underlying concepts. Whether you’re revising binary arithmetic, logic gates, or Python code, these worked examples will help you feel confident on exam day.
欢迎阅读这篇涵盖 OCR GCSE 计算机科学考试典型例题的详细指南。我们将逐一讲解各核心主题的代表性题目,展示分步解题过程并解释背后概念。无论你正在复习二进制运算、逻辑门还是 Python 代码,这些详解例题都能帮你在考试日信心倍增。
1. Binary to Decimal Conversion | 二进制转十进制
Question: Convert the 8‑bit binary number 10110110 into denary. Show your working.
题目:将 8 位二进制数 10110110 转换为十进制。写出计算过程。
To convert, we write down place values for each bit from 2⁷ (128) down to 2⁰ (1). The bits from left to right are 1, 0, 1, 1, 0, 1, 1, 0. We multiply each bit by its place value and sum the results: 1×128 + 0×64 + 1×32 + 1×16 + 0×8 + 1×4 + 1×2 + 0×1 = 128 + 32 + 16 + 4 + 2 = 182. So the denary value is 182.
转换时,从最高位 2⁷(128)到最低位 2⁰(1)列出各位权值。从左到右的比特位为 1, 0, 1, 1, 0, 1, 1, 0。将每位乘以对应权值并求和:1×128 + 0×64 + 1×32 + 1×16 + 0×8 + 1×4 + 1×2 + 0×1 = 128 + 32 + 16 + 4 + 2 = 182。因此十进制值为 182。
Common mistakes include misaligning place values or forgetting that the leftmost bit represents 128. Always start from 2⁷ for 8‑bit numbers.
常见错误包括权值对齐错误或忘记最左边位代表 128。8 位二进制数务必从 2⁷ 开始计算。
2. Binary Addition | 二进制加法
Question: Add the binary numbers 01011010 and 00101111. Give your answer as an 8‑bit binary number and state whether overflow occurs.
题目:将二进制数 01011010 与 00101111 相加。结果用 8 位二进制表示,并说明是否发生溢出。
We line up the numbers and add column by column from the right, carrying 1 when the sum reaches 2. 0+1=1, 1+1=2 → write 0 carry 1, and so on. The full addition gives: 01011010 + 00101111 = 10001001. As the result is still within 8 bits and no carry out from the most significant bit, there is no overflow. However, if the numbers were unsigned, 10001001 is 137 in denary, which fits into 8 bits (0‑255). So overflow does not occur.
我们将两数对齐,从右向左逐位相加,和达到 2 时写 0 进 1。0+1=1,1+1=2 → 写 0 进 1,等等。完整加法过程得到:01011010 + 00101111 = 10001001。结果仍在 8 位内且最高位无进位输出,故未发生溢出。若为无符号数,10001001 是十进制 137,处于 0‑255 范围内,因此无溢出。
Overflow in unsigned addition occurs when a carry out of the MSB happens. In signed two’s complement, overflow is detected differently – when the carry into and out of the sign bit differ.
无符号加法溢出发生在最高位产生进位时。对于有符号补码运算,溢出判断则要看符号位的进位输入与输出是否不同。
3. Hexadecimal to Binary | 十六进制转二进制
Question: Represent the hexadecimal value 2F3A as a 16‑bit binary number. You should show nibble boundaries.
题目:将十六进制数 2F3A 表示为 16 位二进制数,并标出半字节边界。
Each hex digit maps to a 4‑bit binary nibble. Convert each digit separately: 2 = 0010, F = 1111, 3 = 0011, A = 1010. Concatenating them gives 0010 1111 0011 1010. This is exactly 16 bits. We can present it with spaces between nibbles for clarity.
每个十六进制数字对应一个 4 位二进制半字节。分别转换:2 = 0010,F = 1111,3 = 0011,A = 1010。拼接得到 0010 1111 0011 1010,恰好 16 位。为清晰可标出半字节间隔。
Always ensure you write leading zeros when a hex digit yields fewer than 4 bits (e.g. 2 becomes 0010, not 10). This is a common slip.
务必记住:十六进制数字转换若不足 4 位,须补前导零(例如 2 写成 0010 而非 10)。这是常见失分点。
4. Logic Gates and Truth Table | 逻辑门与真值表
Question: The circuit has two inputs A and B. They pass into an AND gate; the output of the AND gate and input B are fed into an OR gate. Draw the truth table for the final output Q.
题目:某电路有两个输入 A 和 B。它们先经过与门;与门的输出和 B 被送入或门。画出最终输出 Q 的真值表。
We label intermediate output X = A AND B. Then Q = X OR B. We evaluate for all four combinations of A, B: 00 → X=0 → Q=0 OR 0=0; 01 → X=0 → Q=0 OR 1=1; 10 → X=0 → Q=0 OR 0=0; 11 → X=1 → Q=1 OR 1=1. The truth table is:
我们设中间输出 X = A AND B,然后 Q = X OR B。对 A、B 四种组合求值:00 → X=0 → Q=0 OR 0=0;01 → X=0 → Q=0 OR 1=1;10 → X=0 → Q=0 OR 0=0;11 → X=1 → Q=1 OR 1=1。真值表如下:
| A | B | X (A AND B) | Q (X OR B) |
| 0 | 0 | 0 | 0 |
| 0 | 1 | 0 | 1 |
| 1 | 0 | 0 | 0 |
| 1 | 1 | 1 | 1 |
Notice that the final column Q is identical to B. This circuit simplifies to just B; the AND gate is redundant.
注意最终列 Q 与 B 完全相同。此电路可简化为 B,与门在这里是冗余的。这类化简分析也是考试常考内容。
5. CPU Architecture: MAR and MDR | CPU 架构:MAR 与 MDR
Question: Describe the roles of the Memory Address Register (MAR) and the Memory Data Register (MDR) in the fetch‑execute cycle. Explain what happens to these registers during the fetch stage.
题目:描述取指‑执行周期中存储器地址寄存器 (MAR) 和存储器数据寄存器 (MDR) 的作用。解释在取指阶段这些寄存器发生了什么。
During fetch, the Program Counter (PC) contains the address of the next instruction. This address is copied to the MAR, which holds the address of the memory location the CPU is about to read from or write to. The MAR sends this address to main memory via the address bus. The instruction stored at that address is then fetched and placed temporarily in the MDR. The MDR holds the actual data or instruction that has been retrieved from memory (or is to be stored). Once the instruction is in the MDR, it is copied to the Current Instruction Register (CIR) for decoding.
在取指阶段,程序计数器 (PC) 存放下一条指令的地址。该地址被复制到 MAR 中,MAR 保存 CPU 即将读或写的内存地址,并通过地址总线发送给主存。随后,该地址处的指令被取出并临时存入 MDR。MDR 保存刚从内存读取(或即将写入)的实际数据或指令。一旦指令进入 MDR,它会被复制到当前指令寄存器 (CIR) 以供译码。
A common exam question asks about the flow of data. Remember: PC → MAR, then memory → MDR, then MDR → CIR.
考试常见问题是数据流向。记住:PC → MAR,然后 内存 → MDR,再 MDR → CIR。
6. Network Topologies: Star vs. Bus | 网络拓扑:星型与总线型对比
Question: Compare a star network topology with a bus topology. For each, give one advantage and one disadvantage.
题目:比较星型网络拓扑与总线型拓扑。各给出一个优点和一个缺点。
Star topology: each node connects to a central switch. Advantage: if one cable fails, only that node is affected; the rest of the network continues working. Disadvantage: the central switch is a single point of failure – if it fails, the whole network goes down. Bus topology: all devices share a single backbone cable. Advantage: cheaper to install and requires less cable. Disadvantage: if the backbone cable breaks, the entire network is disconnected. Also, security is weaker because all data travels along the shared medium.
星型拓扑:每台节点通过独立线缆连接到中央交换机。优点:某一根线缆故障只影响单节点,网络其余部分仍正常工作。缺点:中央交换机是单点故障源——一旦故障,全网瘫痪。总线型拓扑:所有设备共享一根主干电缆。优点:安装成本低且所需线缆少。缺点:主干电缆断裂会导致全网中断。此外,安全性较弱,因为所有数据都流经共享介质。
In OCR exams, you may also be asked to draw or label these topologies and identify them from diagrams.
在 OCR 考试中,还可能要求画出或标注这些拓扑结构,并根据图示加以识别。
7. SQL Query on a Database | 数据库 SQL 查询
Question: A table called Students has fields: StudentID, Name, YearGroup, TutorGroup. Write an SQL statement that returns the Name and TutorGroup of all students in YearGroup 11, ordered alphabetically by Name.
题目:一个名为 Students 的库表包含字段:StudentID, Name, YearGroup, TutorGroup。写一条 SQL 语句,返回所有 YearGroup 为 11 的学生的 Name 与 TutorGroup,并按 Name 字母顺序排列。
The SQL query is: SELECT Name, TutorGroup FROM Students WHERE YearGroup = 11 ORDER BY Name ASC; You specify the required fields in SELECT, the table in FROM, the condition in WHERE, and the sort order with ORDER BY. ASC (ascending) is the default, but it’s good practice to include it.
对应的 SQL 语句为:SELECT Name, TutorGroup FROM Students WHERE YearGroup = 11 ORDER BY Name ASC;在 SELECT 后指定所需字段,FROM 后给出表名,WHERE 后列出筛选条件,排序使用 ORDER BY。ASC(升序)是默认值,但写出更规范。
Always end an SQL statement with a semicolon. For OCR, you may be asked to interpret or write simple SELECT statements, often involving wildcards like * or comparison operators.
SQL 语句末尾务必加分号。OCR 考试可能要求解释或编写简单 SELECT 语句,常涉及通配符 * 或比较运算符。
8. Bubble Sort Walkthrough | 冒泡排序分步演示
Question: Show the steps of a bubble sort on the list [4, 2, 5, 1, 3] to sort it into ascending order. Give the state of the list after each pass.
题目:对列表 [4, 2, 5, 1, 3] 采用冒泡排序,按升序排列。展示每一遍排序后列表的状态。
Pass 1: compare and swap adjacent elements if left > right. 4>2 swap → [2,4,5,1,3]; 4<5 no swap; 5>1 swap → [2,4,1,5,3]; 5>3 swap → [2,4,1,3,5]. End of pass 1, largest number 5 is in place. Pass 2: 2<4 no swap; 4>1 swap → [2,1,4,3,5]; 4>3 swap → [2,1,3,4,5]. Pass 3: 2>1 swap → [1,2,3,4,5]; 2<3, 3<4 no swaps. Pass 4: check 1<2, 2<3, 3<4, 4<5 — no swaps, list is sorted.
第一遍:自左向右比较相邻元素,若左大于右则交换。4>2 交换得 [2,4,5,1,3];4<5 不动;5>1 交换得 [2,4,1,5,3];5>3 交换得 [2,4,1,3,5]。第一遍结束,最大数 5 已就位。第二遍:2<4 不动;4>1 交换得 [2,1,4,3,5];4>3 交换得 [2,1,3,4,5]。第三遍:2>1 交换得 [1,2,3,4,5];2<3、3<4 不动。第四遍:检查相邻对,均无交换,列表已有序。
You may also be asked to state the maximum number of passes (n‑1 for n items) or to identify a more efficient version with a flag to detect early completion.
考试还可能要求给出最大遍数(n 个元素最多 n‑1 遍),或指出可用标志位提前结束的更高效版本。
9. Python Code Tracing: Loop and Accumulator | Python 代码追踪:循环与累加器
Question: Study the following Python code. What is the output when the program is executed?
total = 0
for i in range(1, 5):
total = total + i * 2
print(total)
题目:阅读下面的 Python 代码。程序执行后的输出是什么?
total = 0
for i in range(1, 5):
total = total + i * 2
print(total)
The loop variable i takes values 1, 2, 3, 4 (range(1,5) excludes 5). In each iteration, i * 2 is added to total. Calculate: i=1 → add 2 → total=2; i=2 → add 4 → total=6; i=3 → add 6 → total=12; i=4 → add 8 → total=20. After the loop, print(total) outputs 20.
循环变量 i 依次取值 1, 2, 3, 4(range(1,5) 不包含 5)。每次迭代将 i * 2 累加至 total。计算过程:i=1 → 加 2 → total=2;i=2 → 加 4 → total=6;i=3 → 加 6 → total=12;i=4 → 加 8 → total=20。循环结束后,print(total) 输出 20。
Be careful with indentation and range boundaries. OCR may also ask you to identify logic errors or rewrite code using a while loop.
注意缩进与 range 边界。OCR 也可能要求识别逻辑错误或用 while 循环重写代码。
10. Data Security: Phishing and Encryption | 数据安全:网络钓鱼与加密
Question: Explain how phishing attacks work and describe one way encryption can help protect data even if an attacker intercepts it.
题目:解释网络钓鱼攻击如何运作,并说明即使攻击者截获数据,加密为何能提供保护。
Phishing typically involves fraudulent emails or messages that appear to come from a legitimate source (like a bank). The message urges the recipient to click a link and enter personal details, such as passwords or credit card numbers, on a fake website. The attacker then harvests this information. To avoid falling for phishing, users should check the sender’s email address, never click suspicious links, and verify requests through official channels.
网络钓鱼通常是指看似来自合法来源(如银行)的欺诈邮件或消息,诱使收件人点击链接并在假网站上输入个人资料(如密码或信用卡号)。攻击者随后收集这些信息。防范钓鱼可检查发件人邮箱、不点击可疑链接,并通过官方渠道核实请求。
Encryption scrambles data into ciphertext using an algorithm and a key. Even if an attacker intercepts the encrypted message, they cannot read it without the correct decryption key. For example, HTTPS uses TLS encryption to protect data in transit between a browser and a web server.
加密利用算法和密钥将数据打乱成密文。即便攻击者截获加密的消息,没有正确解密密钥也无法读取其中内容。例如 HTTPS 使用 TLS 加密保护浏览器与服务器间的传输数据。
11. Sorting Algorithm Efficiency | 排序算法效率比较
Question: Compare bubble sort and merge sort in terms of speed on large datasets. Suggest why bubble sort might still be useful in certain situations.
题目:比较冒泡排序与归并排序在处理大型数据集时的速度。说明为何在某些场景下冒泡排序仍有用处。
Merge sort has O(n log n) time complexity on average and worst case, making it far faster than bubble sort (O(n²)) for large n. However, bubble sort uses less memory and is simpler to code. It can be efficient if the list is nearly sorted, as it can stop early when no swaps occur. For small lists or educational purposes, bubble sort is easier to understand and implement.
归并排序的平均和最坏时间复杂度均为 O(n log n),在处理大规模数据时远比冒泡排序(O(n²))快。但冒泡排序占用内存较少且编码简单。若列表几乎有序,冒泡排序可因无交换发生而提前终止,体现其效率。对于小规模列表或教学场景,冒泡排序更易理解和实现。
OCR expects you to know which algorithms are more suited for different data sizes and why.
OCR 期望你了解不同算法对不同数据规模的适用性及其原因。
12. IP Addressing and DNS | IP 地址与 DNS
Question: Explain the purpose of an IP address and the role of the Domain Name System (DNS) on the internet.
题目:解释 IP 地址的用途以及域名系统 (DNS) 在互联网上的作用。
An IP address is a unique numerical label assigned to each device connected to a network that uses the Internet Protocol. It serves two main functions: identifying the host and providing the location of the host in the network, enabling routing. DNS translates human‑friendly domain names (like http://www.bbc.co.uk) into IP addresses (like 151.101.0.81), so browsers can load the correct website. Without DNS, users would have to remember numerical IP addresses for every site.
IP 地址是分配给网络中每台使用 IP 协议的设备的唯一数字标识,主要功能是识别主机并提供其在网络中的位置,从而实现路由。DNS 将人类友好的域名(如 http://www.bbc.co.uk)翻译为 IP 地址(如 151.101.0.81),使浏览器能加载正确的网站。没有 DNS,用户就不得不记住每个网站的数字 IP 地址。
In exams, you may be asked to describe the process of a DNS query, including the roles of recursive resolvers and authoritative servers.
考试中可能要求描述 DNS 查询过程,包括递归解析器和权威服务器的角色。
Published by TutorHao | GCSE OCR Computer Science Revision Series | aleveler.com
更多咨询请联系16621398022(同微信)
屏轩国际教育cambridge primary/secondary checkpoint, cat4, ukiset,ukcat,igcse,alevel,PAT,STEP,MAT, ibdp,ap,ssat,sat,sat2课程辅导,国外大学本科硕士研究生博士课程论文辅导