AS OCR Computer Science: Unit Test Mock Paper Walkthrough | AS OCR 计算机:单元测试模拟卷解析

📚 AS OCR Computer Science: Unit Test Mock Paper Walkthrough | AS OCR 计算机:单元测试模拟卷解析

This article provides a comprehensive walkthrough of a mock unit test designed for the AS OCR Computer Science specification. It covers typical questions found in Component 01 (Computer Systems) and Component 02 (Algorithms and Problem Solving), helping you reinforce key concepts and gain confidence in exam technique. Each section presents a simulated question, followed by detailed steps and common pitfalls to avoid.

本文对一份针对 AS OCR 计算机科学规格的模拟单元测试进行了详细解析。内容覆盖了组件 01(计算机系统)和组件 02(算法与问题解决)中的典型题目,帮助你巩固关键概念并建立考试技巧的信心。每个小节都呈现一道模拟题,并给出详细的步骤解析以及需要规避的常见错误。


1. Binary and Hexadecimal Conversions | 二进制与十六进制转换

Question: Convert the binary number 1011 0110 into hexadecimal. Show how you group the bits into nibbles and convert each group.

题目:将二进制数 1011 0110 转换为十六进制。展示如何将位分组为半字节并逐组转换。

Solution: Split the binary string into 4-bit nibbles starting from the right. Here we have 1011 and 0110. The nibble 1011 equals 8+2+1 = 11, which is B in hex. The nibble 0110 equals 4+2 = 6, so it becomes 6. Combining them gives B6. Therefore, 1011 0110₂ = B6₁₆.

解析:从右侧开始将二进制串分成 4 位半字节。这里得到 1011 和 0110。半字节 1011 等于 8+2+1=11,十六进制记作 B。半字节 0110 等于 4+2=6,记为 6。组合后得到 B6。因此,1011 0110₂ = B6₁₆。

Reverse conversion: Convert hexadecimal 2F into binary. 2 splits into 0010 and F (15) becomes 1111. So 2F₁₆ = 0010 1111₂.

反向转换:将十六进制 2F 转为二进制。2 拆分为 0010,F(即 15)拆分为 1111。所以 2F₁₆ = 0010 1111₂。

Always check that each hex digit maps exactly to a 4-bit nibble; leading zeros can be added to the left to form complete nibbles in the binary representation.

务必检查每个十六进制数字都准确映射到一个 4 位半字节;在二进制表示左侧可以添加前导零以形成完整的半字节。

Binary Nibble Decimal Hex
0000 0 0
1010 10 A
1011 11 B
1111 15 F

2. Representing Characters: ASCII vs Unicode | 字符表示:ASCII 与 Unicode

Question: Explain why Unicode was introduced despite the widespread use of ASCII. State the typical number of bits per character in extended ASCII and in UTF-8 Unicode, and give one example where Unicode is essential.

题目:解释尽管 ASCII 已经被广泛使用,为何还要引入 Unicode。说出扩展 ASCII 和 UTF-8 Unicode 中每个字符通常使用的位数,并举出一个 Unicode 必不可少的情形。

Answer: Standard ASCII uses 7 bits (128 characters), while extended ASCII uses 8 bits (256 characters). This is insufficient for global character sets such as Chinese, Arabic, or emojis. Unicode can represent over 1 million characters. UTF-8 is a variable-length encoding using 1 to 4 bytes per character; it is backwards compatible with ASCII. Unicode is essential for multilingual documents, websites, and international software.

答案:标准 ASCII 使用 7 位(128 个字符),扩展 ASCII 使用 8 位(256 个字符)。这不足以表示中文、阿拉伯文或表情符号等全球字符集。Unicode 可以表示超过 100 万个字符。UTF-8 是一种可变长度编码,每个字符使用 1 到 4 个字节,并与 ASCII 向下兼容。Unicode 对于多语言文档、网页和国际软件至关重要。

A common exam pitfall is confusing the fixed 8-bit nature of extended ASCII with the variable-width encoding of UTF-8. Remember: extended ASCII = 8 bits per character; UTF-8 = minimum 8 bits, but can use more.

常见的考试误区是将扩展 ASCII 固定的 8 位特性与 UTF-8 的变长编码混淆。请记住:扩展 ASCII 每字符 8 位;UTF-8 至少 8 位,但可能使用更多位。


3. Image and Sound Representation | 图像与声音表示

Question: A bitmap image has a resolution of 800 x 600 pixels with a colour depth of 24 bits. Calculate the raw file size in megabytes (MB), assuming 1 MB = 1,000,000 bytes. State your answer to two decimal places.

题目:一张位图图像的分辨率为 800 x 600 像素,色深为 24 位。计算其原始文件大小(以兆字节 MB 为单位,假设 1 MB = 1,000,000 字节)。结果保留两位小数。

Solution: Total pixels = 800 × 600 = 480,000. Total bits = 480,000 × 24 = 11,520,000 bits. Convert to bytes: 11,520,000 / 8 = 1,440,000 bytes. Convert to MB: 1,440,000 / 1,000,000 = 1.44 MB.

解析:总像素数 = 800 × 600 = 480,000。总位数 = 480,000 × 24 = 11,520,000 位。转换为字节:11,520,000 / 8 = 1,440,000 字节。转换为 MB:1,440,000 / 1,000,000 = 1.44 MB。

The formula can be summarised as:

该公式可概括为:

File size (bits) = width × height × colour depth

Question: A stereo audio recording lasts 30 seconds, using a sample rate of 44.1 kHz and a 16-bit sample depth. Calculate the uncompressed file size in megabytes. (1 MB = 1,000,000 bytes)

题目:一段立体声音频录制时长 30 秒,采样率为 44.1 kHz,采样深度 16 位。计算未经压缩的文件大小(以 MB 为单位,1 MB = 1,000,000 字节)。

Solution: Samples per second = 44,100. Bits per sample per channel = 16. Channels = 2. Total bits = 30 × 44,100 × 16 × 2 = 42,336,000 bits. Bytes = 42,336,000 / 8 = 5,292,000 bytes. MB = 5,292,000 / 1,000,000 = 5.29 MB.

解析:每秒采样数 = 44,100。每通道每样本位数 = 16。通道数 = 2。总位数 = 30 × 44,100 × 16 × 2 = 42,336,000 位。字节数 = 42,336,000 / 8 = 5,292,000 字节。MB = 5,292,000 / 1,000,000 = 5.29 MB。


4. CPU Architecture and Fetch-Decode-Execute Cycle | CPU 架构与取指-解码-执行周期

Question: Describe the steps of the fetch-decode-execute (FDE) cycle with reference to the Program Counter (PC), Memory Address Register (MAR), Memory Data Register (MDR), and Current Instruction Register (CIR).

题目:描述取指-解码-执行(FDE)周期的步骤,涉及的程序计数器(PC)、内存地址寄存器(MAR)、内存数据寄存器(MDR)和当前指令寄存器(CIR)。

Answer: During the fetch stage, the address in the PC is copied to the MAR. The CPU sends a read signal along the control bus and the contents of that memory location are transferred via the data bus into the MDR. The PC is incremented to point to the next instruction. The instruction from the MDR is copied to the CIR. In the decode stage, the Control Unit decodes the opcode in the CIR. In the execute stage, the instruction is carried out, which may involve the ALU, accumulator, or memory access.

答案:在取指阶段,PC 中的地址被复制到 MAR。CPU 通过控制总线发送读信号,该内存单元的内容经数据总线传入 MDR。随后 PC 递增以指向下一条指令。MDR 中的指令被复制到 CIR。在解码阶段,控制单元对 CIR 中的操作码进行解码。在执行阶段,指令被执行,这可能涉及 ALU、累加器或内存访问。

Key registers and their roles are often examined:

考试中经常考查关键寄存器及其作用:

Register Function 中文
PC Holds address of next instruction 存放下一条指令地址
MAR Holds address of memory location to be read/written 存放待读写内存地址
MDR Holds data just read or to be written 存放刚读取或待写入的数据
CIR Holds the current instruction being decoded 存放正在解码的当前指令

5. Registers and Assembly Language | 寄存器与汇编语言

Question: Consider the following Little Man Computer (LMC) style assembly code. Assuming initial values: accumulator (ACC) = 0, and memory locations are as described. Trace the execution after three instructions: LDA #5, ADD #3, STA 99. Show the contents of ACC and the memory location 99.

题目:考虑以下类 LMC 汇编代码。假设初始值:累加器(ACC)= 0,内存单元按描述。追踪三条指令执行后:LDA #5, ADD #3, STA 99。展示 ACC 和内存单元 99 的内容。

Solution: LDA #5 loads the immediate value 5 into ACC. ACC becomes 5. ADD #3 adds 3 to the current ACC, so ACC becomes 8. STA 99 stores the value of ACC (8) into memory address 99. Therefore, ACC = 8, memory[99] = 8.

解析:LDA #5 将立即数 5 加载到 ACC。ACC 变成 5。ADD #3 将 3 加到当前 ACC 值,ACC 变成 8。STA 99 将 ACC 的值(8)存入内存地址 99。故 ACC = 8,内存单元 99 = 8。

Understanding assembly helps to visualise the FDE cycle and the role of the accumulator. For the exam, you might also be asked about opcodes and operands. Opcode determines the operation (e.g., LDA, ADD, STA), while the operand provides the data or address.

理解汇编有助于将 FDE 周期和累加器的作用形象化。在考试中,你可能还会被问到操作码和操作数的区分。操作码决定执行的操作(如 LDA、ADD、STA),而操作数提供数据或地址。


6. Systems Software and the OS | 系统软件与操作系统

Question: Explain how an operating system handles a hardware interrupt. Include the terms interrupt register, interrupt service routine (ISR), and stack in your answer.

题目:解释操作系统如何处理硬件中断。答案中须包含”中断寄存器”、”中断服务例程(ISR)”和”栈”等术语。

Answer: When a hardware device raises an interrupt, the CPU finishes the current fetch-decode-execute cycle. The system checks the interrupt register to identify the source and priority. The CPU then pushes the contents of the program counter and other critical registers onto the stack to save the current state. The program counter is loaded with the address of the corresponding ISR. The ISR executes and sends an end-of-interrupt signal. Finally, the saved state is popped from the stack, and the original program resumes.

答案:当硬件设备发出中断时,CPU 完成当前的取指-解码-执行周期。系统检查中断寄存器以确定中断源和优先级。然后 CPU 将程序计数器和其他关键寄存器的内容压入栈中,以保存当前状态。程序计数器被加载上对应 ISR 的地址。ISR 执行并发送中断结束信号。最后,从栈中弹出保存的状态,恢复原程序的执行。

Common OS functions like memory management, multitasking, and providing a user interface are also heavily examined. Be ready to describe how the OS allocates memory slices and uses a scheduler.

操作系统常见的功能,如内存管理、多任务处理和提供用户界面,也是常考内容。请准备好描述 OS 如何分配内存时间片以及如何使用调度器。


7. Translators: Compiler, Interpreter, Assembler | 翻译器:编译器、解释器、汇编器

Question: Compare the working of a compiler and an interpreter. State one advantage and one disadvantage of each, considering execution speed and error reporting.

题目:比较编译器与解释器的工作方式。从执行速度和错误报告两方面,各陈述一个优点和一个缺点。

Answer: A compiler translates the entire source code into machine code (object code) before execution. This produces a standalone executable file and generally results in faster execution. However, error reporting happens after the whole compilation, and debugging can be slower. An interpreter translates and executes the source code line by line. It stops at the first error, making debugging easier. But interpreted programs run more slowly and require the interpreter to be present each time the code is run.

答案:编译器在执行前将整个源代码翻译成机器码(目标代码)。这会生成一个独立的可执行文件,通常执行速度更快。但错误报告在整个编译结束后才给出,调试可能较慢。解释器逐行翻译并执行源代码。它遇到第一个错误时就停止,使得调试更容易。但解释执行程序运行较慢,且每次运行都需要解释器在场。

An assembler translates assembly language into machine code, often in a one-to-one mapping. Be careful not to confuse it with a compiler.

汇编器将汇编语言翻译为机器码,通常是一条语句对应一条机器指令。注意不要将其与编译器混淆。


8. Networks and the TCP/IP Stack | 网络与 TCP/IP 协议栈

Question: Given the IP address 192.168.1.105 with a subnet mask of 255.255.255.0, calculate the network address. Also identify which layer of the TCP/IP stack handles the IP protocol and name one protocol at the transport layer.

题目:给定 IP 地址 192.168.1.105 和子网掩码 255.255.255.0,计算网络地址。并指出 TCP/IP 协议栈中哪一层处理 IP 协议,以及列举一个传输层协议。

Solution: Perform a bitwise AND between the IP and the subnet mask. 192.168.1.105 AND 255.255.255.0 yields 192.168.1.0. This is the network address. The TCP/IP stack has four layers: Application, Transport, Internet, and Link/Network Access. The Internet layer handles the IP protocol. Examples of transport layer protocols are TCP (Transmission Control Protocol) and UDP (User Datagram Protocol).

解析:对 IP 地址和子网掩码执行按位逻辑与操作。192.168.1.105 与 255.255.255.0 进行与运算得到 192.168.1.0。这就是网络地址。TCP/IP 协议栈有四层:应用层、传输层、互联网层和链路层/网络接入层。互联网层负责处理 IP 协议。传输层协议的例子有 TCP(传输控制协议)和 UDP(用户数据报协议)。

Remember the mnemonic for layers: Application, Transport, Internet, Link (ATIL). Application protocols include HTTP, FTP, SMTP. The Link layer covers Ethernet and Wi-Fi.

记忆层次的助记符:Application, Transport, Internet, Link (ATIL)。应用层协议包括 HTTP、FTP、SMTP;链路层涵盖以太网和 Wi-Fi。


9. SQL Queries and Database Normalisation | SQL 查询与数据库规范化

Question: A relational database contains tables: Students(StudentID, Name, Year), Courses(CourseID, Title), and Enrolments(StudentID, CourseID, Grade). Write an SQL query to list the names of all students enrolled in the course titled ‘Computer Science’.

题目:一个关系数据库包含以下表:Students(StudentID, Name, Year)、Courses(CourseID, Title) 和 Enrolments(StudentID, CourseID, Grade)。写出一条 SQL 查询,列出所有选修了课程标题为 ‘Computer Science’ 的学生姓名。

The required SQL is:

所需的 SQL 为:

SELECT Students.Name
FROM Students
JOIN Enrolments ON Students.StudentID = Enrolments.StudentID
JOIN Courses ON Enrolments.CourseID = Courses.CourseID
WHERE Courses.Title = ‘Computer Science’;

This query uses JOIN to combine rows based on matching primary and foreign keys, then filters by the condition on Title.

该查询通过 JOIN 依据主键与外键的匹配来合并行,然后通过 Title 上的条件进行筛选。

Also, you may be asked about normalisation. Starting from an unnormalised table with repeating groups, move to 1NF (no repeating groups), 2NF (no partial dependencies on a composite key), and 3NF (no transitive dependencies). Always link your explanation to the given data.

此外,你可能被问到规范化。从含重复组的非规范化表开始,过渡到 1NF(消除重复组)、2NF(消除对复合键的部分依赖)和 3NF(消除传递依赖)。解释时要始终与给定数据结合。


10. Floating Point Binary Representation | 浮点数二进制表示

Question: A binary floating-point

Published by TutorHao | AS Computer Science Revision Series | aleveler.com

更多咨询请联系16621398022(同微信)

Comments

屏轩国际教育cambridge primary/secondary checkpoint, cat4, ukiset,ukcat,igcse,alevel,PAT,STEP,MAT, ibdp,ap,ssat,sat,sat2课程辅导,国外大学本科硕士研究生博士课程论文辅导Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from aleveler.com

Subscribe now to keep reading and get access to the full archive.

Continue reading

Exit mobile version