📚 GCSE OCR Computer Science: Calculation Practice | GCSE OCR 计算机科学:计算题专项训练
Calculation questions are at the heart of GCSE OCR Computer Science (J277). They appear across topics such as data representation, Boolean logic, networks, and algorithms. Mastering these numerical skills will boost your confidence and exam marks. This article provides targeted practice with clear step-by-step solutions.
计算题是 GCSE OCR 计算机科学(J277)的核心考点,遍布数据表示、布尔逻辑、网络和算法等章节。掌握这些数字技能会极大提升你的信心与考试成绩。本文提供专项训练,并给出清晰的步骤化解题过程。
1. Binary ↔ Denary Conversion | 二进制与十进制转换
To convert a binary number to denary, write the column headings (powers of 2) above each bit and add the values where a 1 appears. The rightmost bit is 2⁰, next 2¹, up to 2⁷ for an 8-bit number.
将二进制数转换为十进制时,先在每位上方标出位权(2 的幂),再把所有出现 1 的位权相加即可。最右边位是 2⁰,向左依次为 2¹,8 位数的最高位为 2⁷。
Example: Convert 10110110₂ to denary.
示例:将 10110110₂ 转换成十进制。
128 64 32 16 8 4 2 1
1 0 1 1 0 1 1 0
Add the values with a 1: 128 + 32 + 16 + 4 + 2 = 182. So 10110110₂ = 182₁₀.
把有 1 的位权相加:128 + 32 + 16 + 4 + 2 = 182,因此 10110110₂ = 182₁₀。
To convert denary to binary, repeatedly divide by 2 and record the remainders from bottom to top. Example: Convert 147₁₀ to binary.
十进制转二进制则采用除 2 取余法,从下往上记录余数。示例:将 147₁₀ 转换为二进制。
147 ÷ 2 = 73 r 1; 73 ÷ 2 = 36 r 1; 36 ÷ 2 = 18 r 0; 18 ÷ 2 = 9 r 0; 9 ÷ 2 = 4 r 1; 4 ÷ 2 = 2 r 0; 2 ÷ 2 = 1 r 0; 1 ÷ 2 = 0 r 1. Read remainders backwards: 10010011.
147 ÷ 2 = 73 余 1;73 ÷ 2 = 36 余 1;36 ÷ 2 = 18 余 0;18 ÷ 2 = 9 余 0;9 ÷ 2 = 4 余 1;4 ÷ 2 = 2 余 0;2 ÷ 2 = 1 余 0;1 ÷ 2 = 0 余 1。从下往上读余数得 10010011。
2. Binary Addition and Overflow | 二进制加法与溢出
Binary addition follows the same column method as denary: 0+0=0, 0+1=1, 1+0=1, 1+1=0 carry 1, 1+1+1=1 carry 1. In an 8-bit register, if the result exceeds 255 (the largest 8-bit value), an overflow occurs.
二进制加法与十进制列竖式类似:0+0=0,0+1=1,1+0=1,1+1=0 进位 1,1+1+1=1 进位 1。在 8 位寄存器中,如果结果超过 255(最大 8 位值),就会发生溢出。
Add 11001010₂ (202) and 01101101₂ (109).
计算 11001010₂(202)与 01101101₂(109)相加。
11001010
+ 01101101
———————
100110111 (9 bits)
The 9-bit result is 1 00110111. The leftmost 1 cannot fit into an 8-bit register, so the answer would be 00110111 with an overflow flag set. Without overflow, it would incorrectly be 55₁₀.
结果为 9 位:1 00110111。最左边的 1 无法放入 8 位寄存器,因此 8 位结果为 00110111 并置溢出标志。若不处理溢出,就会错误显示为 55₁₀。
Always check if the sum exceeds 11111111₂ (255). If it does, an overflow error occurs.
务必检查结果是否超过 11111111₂(255)。若超过,就会发生溢出错误。
3. Hexadecimal Conversion | 十六进制转换
Hexadecimal (hex) uses base 16: digits 0–9 and letters A–F (A=10, B=11, …, F=15). To convert binary to hex, split an 8-bit number into two nibbles (4 bits each), convert each nibble to its hex equivalent, then combine.
十六进制采用基数为 16:数字 0–9 与字母 A–F(A=10, B=11, …, F=15)。二进制转十六进制时,将 8 位数分成两个半字节(各 4 位),分别转换为等值十六进制,再合并。
Convert 11010111₂ to hex.
将 11010111₂ 转为十六进制。
Split: 1101 (left nibble) and 0111 (right nibble). 1101₂ = 13 = D, 0111₂ = 7. So hex = D7.
拆分:1101(左半字节)和 0111(右半字节)。1101₂ = 13 = D,0111₂ = 7。因此十六进制为 D7。
To convert hex to denary, multiply each digit by its place value (16¹ and 16⁰). For example, 3F₁₆ = 3×16 + 15 = 48 + 15 = 63.
十六进制转十进制:每位数字乘以其位权(16¹ 和 16⁰)。例如 3F₁₆ = 3×16 + 15 = 48 + 15 = 63。
4. Image File Size | 图像文件大小
Image file size = width in pixels × height in pixels × colour depth (bits per pixel). The result is in bits; divide by 8 to get bytes, then by 1024 for kilobytes (KB).
图像文件大小 = 宽度像素 × 高度像素 × 颜色深度(每像素位数)。结果单位为比特,除以 8 得字节,再除以 1024 得千字节(KB)。
Calculate the file size of a 300×200 pixel image with 16 colours. Colour depth: with 16 colours, bits per pixel = log₂16 = 4 bits.
计算一幅 300×200 像素、16 色图像的文件大小。颜色深度:16 色要求每像素位数 = log₂16 = 4 位。
Size in bits = 300 × 200 × 4 = 240,000 bits. In bytes: 240,000 ÷ 8 = 30,000 bytes. In KB: 30,000 ÷ 1024 ≈ 29.3 KB.
比特数 = 300 × 200 × 4 = 240,000 位。字节数 = 240,000 ÷ 8 = 30,000 字节。KB 数 = 30,000 ÷ 1024 ≈ 29.3 KB。
If metadata (e.g. 54 bytes for a BMP header) is included, add it to the total.
若包含元数据(如 BMP 文件头 54 字节),需将其加入总大小。
5. Sound File Size | 声音文件大小
Sound file size = sample rate (Hz) × bit depth × duration (seconds) × number of channels. Sound is often sampled at 44.1 kHz with 16 bits per sample for CD quality.
声音文件大小 = 采样率 (Hz) × 采样位数 × 时长 (秒) × 声道数。CD 质量通常采用 44.1 kHz 采样率、16 位采样位数。
Calculate the size of a 10-second stereo (2 channels) audio clip recorded at 44,100 Hz with 16-bit samples.
计算一段 10 秒立体声(2 声道)音频的大小,采样率 44,100 Hz,16 位采样。
Bits = 44100 × 16 × 10 × 2 = 14,112,000 bits. Bytes = 14,112,000 ÷ 8 = 1,764,000 bytes. KB = 1,764,000 ÷ 1024 ≈ 1722.7 KB. MB = 1722.7 ÷ 1024 ≈ 1.68 MB.
比特数 = 44100 × 16 × 10 × 2 = 14,112,000 位。字节数 = 14,112,000 ÷ 8 = 1,764,000 字节。KB = 1,764,000 ÷ 1024 ≈ 1722.7 KB。MB = 1722.7 ÷ 1024 ≈ 1.68 MB。
6. Text and Compression Calculations | 文本与压缩计算
Text size depends on character encoding. ASCII uses 7 bits per character (often stored as 8 bits), Unicode UTF-8 can use 8, 16, or more bits. Extended ASCII uses 8 bits per character.
文本大小取决于字符编码。ASCII 每字符 7 位(常按 8 位存储),Unicode UTF-8 可使用 8、16 或更多位。扩展 ASCII 每字符 8 位。
Example: A paragraph contains 2,500 characters. With extended ASCII (8 bits per character), size = 2500 × 8 = 20,000 bits = 2,500 bytes = 2.44 KB.
示例:一段文字包含 2,500 个字符。若采用扩展 ASCII(每字符 8 位),大小 = 2500 × 8 = 20,000 位 = 2,500 字节 = 2.44 KB。
Compression ratio = original size / compressed size. If a file of 500 KB is compressed to 200 KB, the ratio is 500 / 200 = 2.5:1. The space saving is (300/500)×100 = 60%.
压缩比 = 原始大小 / 压缩后大小。若 500 KB 文件压缩至 200 KB,压缩比为 500 / 200 = 2.5:1。空间节省率为 (300/500)×100 = 60%。
7. Logic Gates and Truth Tables | 逻辑门与真值表
Logic gates perform Boolean operations. OCR expects you to draw truth tables for combinations of AND, OR, NOT, XOR gates. For NAND and NOR, simply invert the outputs of AND and OR.
逻辑门执行布尔运算。OCR 要求能为 AND、OR、NOT、XOR 门组合绘制真值表。对于 NAND 和 NOR,只需将 AND 和 OR 的输出取反即可。
Given the expression Q = (A AND B) OR (NOT C), complete the truth table.
给定表达式 Q = (A AND B) OR (NOT C),完成真值表。
| A | B | C | A AND B | NOT C | Q |
|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 1 | 1 |
| 0 | 0 | 1 | 0 | 0 | 0 |
| 0 | 1 | 0 | 0 | 1 | 1 |
| 0 | 1 | 1 | 0 | 0 | 0 |
| 1 | 0 | 0 | 0 | 1 | 1 |
| 1 | 0 | 1 | 0 | 0 | 0 |
| 1 | 1 | 0 | 1 | 1 | 1 |
| 1 | 1 | 1 | 1 | 0 | 1 |
This systematic approach helps in designing logic circuits and checking equivalence.
这种系统方法有助于设计逻辑电路并检查等价性。
8. Simplifying Logic Circuits | 逻辑电路简化
Simplification often uses Boolean identities or Karnaugh maps (OCR may include simple maps). For example, Q = A AND (A OR B) can be simplified to A using absorption.
简化常用布尔恒等式或卡诺图(OCR 可能包含简单卡诺图)。例如,Q = A AND (A OR B) 可运用吸收律简化为 A。
Simplify P = (A AND B) OR (A AND NOT B).
简化 P = (A AND B) OR (A AND NOT B)。
Factor out A: P = A AND (B OR NOT B). Since B OR NOT B = 1, P = A AND 1 = A. This reduces two gates to a wire.
提取公因子 A:P = A AND (B OR NOT B)。因为 B OR NOT B = 1,所以 P = A AND 1 = A。这样就把两个门简化为一条连线。
Always show one step of working for each mark.
务必展示每一步推导以获取相应分数。
9. Network Transmission Time | 网络传输时间
Time = amount of data / transmission speed. Convert all units to bits and seconds. Common speeds: 100 Mbps (10⁸ bps), 1 Gbps (10⁹ bps). Data sizes often given in MB, so convert to bits (×8×1024²).
时间 = 数据量 / 传输速率。将所有单位转换为比特和秒。常见速率:100 Mbps(10⁸ bps)、1 Gbps(10⁹ bps)。数据大小常用 MB,需转换为比特(×8×1024²)。
How long to transfer a 25 MB file over a 100 Mbps connection?
通过 100 Mbps 连接传输 25 MB 文件需要多长时间?
Data bits = 25 × 1024 × 1024 × 8 = 209,715,200 bits. Speed = 100,000,000 bps. Time = 209,715,200 / 100,000,000 = 2.097 seconds (roughly 2.1 s).
数据比特 = 25 × 1024 × 1024 × 8 = 209,715,200 位。速率 = 100,000,000 bps。时间 = 209,715,200 / 100,000,000 = 2.097 秒(约 2.1 秒)。
For more precision, 1 MB = 1,048,576 bytes; 100 Mbps = 100,000,000 bits/s. Always use correct conversion factors.
为求精确,1 MB = 1,048,576 字节;100 Mbps = 100,000,000 比特/秒。始终使用正确的换算因子。
10. Algorithm Efficiency – Counting Steps | 算法效率 – 步数统计
In GCSE OCR, you may be asked to determine the number of passes or comparisons in bubble sort, merge sort, or linear/binary search. For bubble sort on n items, the maximum number of comparisons is n(n-1)/2.
GCSE OCR 可能要求确定冒泡排序、归并排序或线性/二分查找的趟数或比较次数。对于 n 个元素的冒泡排序,最大比较次数为 n(n-1)/2。
A list of 8 numbers is sorted using bubble sort. How many comparisons are made in the first two passes?
对 8 个数字的列表进行冒泡排序,前两趟共进行多少次比较?
Pass 1: 7 comparisons. Pass 2: 6 comparisons. Total = 7 + 6 = 13. After each pass, the largest remaining element bubbles to the end, reducing comparisons by 1.
第 1 趟:7 次比较。第 2 趟:6 次比较。合计 = 7 + 6 = 13。每趟结束后,当前最大元素冒泡到位,比较次数减少 1。
For binary search on a sorted list of 16 items, the maximum number of checks is log₂16 = 4.
在包含 16 个元素的有序列表中二分查找,最大检查次数为 log₂16 = 4。
Understanding these patterns is crucial for the algorithm questions.
理解这些规律对算法题至关重要。
Published by TutorHao | GCSE Computer Science Revision Series | aleveler.com
更多咨询请联系16621398022(同微信)
屏轩国际教育cambridge primary/secondary checkpoint, cat4, ukiset,ukcat,igcse,alevel,PAT,STEP,MAT, ibdp,ap,ssat,sat,sat2课程辅导,国外大学本科硕士研究生博士课程论文辅导Cancel reply