📚 IGCSE CIE Computer Science: Calculation Practice | IGCSE CIE 计算机:计算题专项训练
This comprehensive workout targets the key calculation-style questions that appear throughout the IGCSE CIE Computer Science syllabus. Each section is paired with step-by-step methods and bilingual explanation so that you can confidently tackle file size estimation, data transmission time, number conversions, binary arithmetic, logic circuits, compression ratios, encryption shifts, and checksum verification.
这份专项训练瞄准 IGCSE CIE 计算机课程中出现的核心计算题型。每个部分都配有循序渐进的方法和双语讲解,让你能自信应对文件大小估算、数据传输时间、数制转换、二进制算术、逻辑电路、压缩比、加密移位和校验码验证等题目。
1. Text File Size Calculation | 文本文件大小计算
Every character in a plain text file is typically stored using one byte (8 bits) if the encoding is ASCII or extended ASCII. To find the file size in bytes, multiply the number of characters by 1. If the question specifies Unicode with 2 bytes per character, multiply by 2. Always convert the final answer to the unit requested (KB, MB, etc.) by dividing by powers of 1024.
纯文本文件中每个字符通常用一个字节(8位)存储,前提是采用 ASCII 或扩展 ASCII 编码。要计算以字节为单位的文件大小,把字符数乘以 1。如果题目指定 Unicode 每个字符 2 字节,则乘以 2。最后务必通过除以 1024 的幂次,将结果转换为题目要求的单位(KB、MB 等)。
Example: A text file contains 3200 characters using ASCII. What is its size in kilobytes?
Size in bytes = 3200 × 1 = 3200 B. Size in KB = 3200 ÷ 1024 ≈ 3.125 KB.
示例:一个文本文件包含 3200 个 ASCII 字符。它以千字节为单位的大小是多少?
字节大小 = 3200 × 1 = 3200 B。KB 大小 = 3200 ÷ 1024 ≈ 3.125 KB。
2. Image File Size and Resolution | 图像文件大小与分辨率
An image’s raw file size depends on its resolution (pixel width × pixel height) and colour depth (bits per pixel). Compute the total number of pixels, multiply by the colour depth in bits, and then convert to bytes and larger units as needed. Keep track of units carefully: there are 8 bits in a byte, 1024 bytes in a KB, and 1024 KB in a MB.
图像的原始文件大小取决于它的分辨率(像素宽度 × 像素高度)和颜色深度(每像素位数)。先计算出像素总数,再乘以以位为单位的颜色深度,然后根据需要转换为字节和更大的单位。留心单位换算:1 字节 = 8 位,1 KB = 1024 字节,1 MB = 1024 KB。
Number of pixels = width × height
Size in bits = Number of pixels × colour depth (bits)
Example: A bitmap image is 1024×768 pixels with 24‑bit colour. Calculate its file size in MB.
Pixels = 1024 × 768 = 786,432. Bits = 786,432 × 24 = 18,874,368 bits. Bytes = 18,874,368 ÷ 8 = 2,359,296 B. KB = 2,359,296 ÷ 1024 ≈ 2304 KB. MB = 2304 ÷ 1024 = 2.25 MB.
示例:一幅位图图像为 1024×768 像素,24 位色彩。计算它的文件大小(MB)。
像素数 = 1024 × 768 = 786,432。位数 = 786,432 × 24 = 18,874,368 位。字节 = 18,874,368 ÷ 8 = 2,359,296 B。KB = 2,359,296 ÷ 1024 ≈ 2304 KB。MB = 2304 ÷ 1024 = 2.25 MB。
3. Sound File Size Calculation | 声音文件大小计算
Uncompressed sound file size is determined by sampling rate (Hz), bit depth (bits per sample), number of channels, and duration (seconds). Multiply these together to get the total bits, then divide by 8 for bytes, and by powers of 1024 for larger units. Be alert for stereo (×2) recordings and durations given in minutes – convert everything to seconds first.
未压缩的声音文件大小取决于采样率(Hz)、位深度(每采样点位数)、声道数和时长(秒)。将这些参数相乘得到总位数,再除以 8 得到字节,再除以 1024 的幂次得到更大单位。注意立体声(×2)以及以分钟给出的时长——全部先换算为秒。
Size in bits = sampling rate × bit depth × channels × duration (s)
Example: A 30‑second stereo track is sampled at 44.1 kHz with 16 bits per sample. Calculate the size in MB.
Sampling rate = 44,100 Hz. Bits = 44,100 × 16 × 2 × 30 = 42,336,000 bits. Bytes = 42,336,000 ÷ 8 = 5,292,000 B. MB = 5,292,000 ÷ (1024 × 1024) ≈ 5.05 MB.
示例:一段 30 秒的立体声录音以 44.1 kHz 采样,每采样点 16 位。计算其大小(MB)。
采样率 = 44,100 Hz。位数 = 44,100 × 16 × 2 × 30 = 42,336,000 位。字节 = 42,336,000 ÷ 8 = 5,292,000 B。MB = 5,292,000 ÷ (1024 × 1024) ≈ 5.05 MB。
4. Data Transmission Time | 数据传输时间
Transmission time is found by dividing the amount of data by the transfer speed. Always ensure both are in the same unit before dividing. Convert file size into bits (×8 if given in bytes) and speed into bits per second (e.g., 1 Mbps = 1,000,000 bps for networking, though sometimes 1,048,576 bps may be specified – check the question’s convention). Divide bits by bits per second to obtain time in seconds.
传输时间等于数据量除以传输速率。务必先统一两者的单位再相除。将文件大小换算成位(如果以字节给出则 ×8),速率换算成每秒位数(例如 1 Mbps 在组网中为 1,000,000 bps,尽管有时会指定 1,048,576 bps——看清题目的约定)。用位数除以每秒位数得到秒数。
Time (s) = File size (bits) ÷ Transfer rate (bits per second)
Example: A 2 MB image is sent over a 4 Mbps connection. How long does it take? (Use 1 MB = 1,048,576 B, 1 Mbps = 1,000,000 bps)
File size in bits = 2 × 1,048,576 × 8 = 16,777,216 bits. Rate = 4,000,000 bps. Time = 16,777,216 ÷ 4,000,000 ≈ 4.19 seconds.
示例:一张 2 MB 的图像通过 4 Mbps 连接发送。需要多长时间?(用 1 MB = 1,048,576 B,1 Mbps = 1,000,000 bps)
文件位数 = 2 × 1,048,576 × 8 = 16,777,216 位。速率 = 4,000,000 bps。时间 = 16,777,216 ÷ 4,000,000 ≈ 4.19 秒。
5. Binary and Hexadecimal Conversions | 二进制与十六进制转换
Conversions between denary (base‑10), binary (base‑2), and hexadecimal (base‑16) are fundamental. For binary-to-hex, group binary digits in sets of four from the right, converting each nibble to its hex equivalent. For hex-to-denary, multiply each hex digit by its place value (16ᵏ) and sum. Practice both directions fluently to save time in exams.
十进制(基数为 10)、二进制(基数为 2)和十六进制(基数为 16)之间的转换是基础。二进制转十六进制时,从右边开始每四位一组,将每个四位组转换为对应的十六进制数字。十六进制转十进制时,将每位十六进制数字乘以其位权(16ᵏ)再求和。熟练两个方向的转换可在考试中节省时间。
| Binary 4-bit | Hex |
|---|---|
| 0000 | 0 |
| 0001 | 1 |
| 0010 | 2 |
| 1010 | A |
| 1111 | F |
Example: Convert 11011010₂ to hexadecimal. Group as 1101 1010. 1101₂ = D, 1010₂ = A. Result: DA₁₆.
示例:将 11011010₂ 转换为十六进制。 分组为 1101 1010。1101₂ = D,1010₂ = A。结果:DA₁₆。
6. Binary Addition and Overflow | 二进制加法与溢出
Binary addition follows simple rules: 0+0=0, 0+1=1, 1+0=1, 1+1=0 carry 1, 1+1+carry=1 carry 1. When the result requires more bits than the available register size, an overflow error occurs. For two’s complement addition, overflow is detected when the carry into the sign bit differs from the carry out of the sign bit.
二进制加法遵循简单规则:0+0=0,0+1=1,1+0=1,1+1=0 进位 1,1+1+进位=1 进位 1。当结果所需的位数超出寄存器可用位数时,发生溢出错误。对于二进制补码加法,当进入符号位的进位与离开符号位的进位不同时,即可检测出溢出。
Example: Add the 8‑bit two’s complement numbers 01101010 (+106) and 00111001 (+57). Result: 10100011. The two carries into and out of the sign bit are both 0, so no overflow. In 8‑bit two’s complement, 10100011 represents −93, which is wrong because 106+57=163 exceeds +127, but the carries didn’t flag overflow in this non‑typical case — always check the range.
示例:将 8 位二进制补码数 01101010 (+106) 和 00111001 (+57) 相加。结果:10100011。进入和离开符号位的进位均为 0,因此无溢出。在 8 位补码中,10100011 表示 −93,这是错误的,因为 106+57=163 超出了 +127,但此例中进位未标记溢出——务必总是检查范围。
7. Logic Gates and Truth Tables | 逻辑门与真值表
Logic gates (AND, OR, NOT, NAND, NOR, XOR) form the building blocks of digital circuits. A truth table lists all possible input combinations and the corresponding output. You must be able to complete truth tables for a given logic circuit, and sometimes derive a Boolean expression. Count rows: for n inputs, there are 2ⁿ rows.
逻辑门(AND、OR、NOT、NAND、NOR、XOR)构成数字电路的基础模块。真值表列出了所有可能的输入组合及其对应输出。你必须能够为给定逻辑电路完成真值表,有时还需推导布尔表达式。行数计算:对于 n 个输入,有 2ⁿ 行。
Example: Fill the truth table for a circuit with inputs A, B and output Q = (A AND B) OR (NOT A).
| A | B | A AND B | NOT A | Q |
|---|---|---|---|---|
| 0 | 0 | 0 | 1 | 1 |
| 0 | 1 | 0 | 1 | 1 |
| 1 | 0 | 0 | 0 | 0 |
| 1 | 1 | 1 | 0 | 1 |
8. Compression Ratio and File Size After Compression | 压缩比与压缩后文件大小
Lossless compression uses algorithms like run‑length encoding (RLE) or Huffman coding. The compression ratio is defined as uncompressed size divided by compressed size. To calculate compressed size, examine the encoding pattern: for RLE, count how many bytes are used for runs. For dictionary‑based methods, apply the given dictionary. Understand that compression works best on data with repetition, and that lossy compression (JPEG, MP3) permanently discards some information.
无损压缩使用诸如游程编码(RLE)或霍夫曼编码等算法。压缩比定义为未压缩大小除以压缩后大小。要计算压缩后的大小,分析编码模式:对于 RLE,数出用于游程的字节数。对于基于字典的方法,则运用给定的字典。需理解:压缩在重复数据上效果最佳,而有损压缩(JPEG、MP3)会永久丢失部分信息。
Compression ratio = Uncompressed size ÷ Compressed size
Example: The string ‘AAAAABBCCCC’ is stored using RLE as ‘A5B2C4’ (7 bytes including the characters and digits). Uncompressed size is 11 bytes. Ratio = 11 ÷ 7 ≈ 1.57:1.
示例:字符串 ‘AAAAABBCCCC’ 用 RLE 存储为 ‘A5B2C4’(包括字符和数字共 7 字节)。未压缩大小为 11 字节。压缩比 = 11 ÷ 7 ≈ 1.57:1。
9. Encryption: Caesar Cipher Shift Calculation | 加密:凯撒密码移位计算
In the Caesar cipher, each letter in the plaintext is shifted by a fixed number of positions along the alphabet. To encrypt, add the key to the letter’s position (mod 26). To decrypt, subtract the key. Remember that the alphabet wraps around (after Z comes A). Also be able to state the number of possible keys (25, excluding 0) and why it is insecure.
在凯撒密码中,明文中的每个字母沿字母表移动固定位数。加密时,把密钥加到字母的位置上(模 26)。解密时,减去密钥。记住字母表是循环的(Z 之后回到 A)。同时要能说出可能的密钥数量(25 个,不含 0)以及为什么它不安全。
Example: Encrypt ‘COMPUTER’ with key = 3. C+3=F, O+3=R, M+3=P, P+3=S, U+3=X, T+3=W, E+3=H, R+3=U → ‘FRPSXWHU’.
示例:用密钥 3 加密 ‘COMPUTER’。 C+3=F,O+3=R,M+3=P,P+3=S,U+3=X,T+3=W,E+3=H,R+3=U → ‘FRPSXWHU’。
10. Parity and Checksum Verification | 奇偶校验与校验和验证
Parity checking adds a bit to make the total number of 1‑bits either even (even parity) or odd (odd parity). For a given data byte and parity type, compute the parity bit. Checksums use addition of data values; the sender computes a sum (often modulo 256) and appends it. The receiver repeats the addition and compares. Show the calculation clearly.
奇偶校验增加一位,使 1 的总数为偶数(偶校验)或奇数(奇校验)。对于给定的数据字节和校验类型,计算出校验位。校验和使用数据值的加法;发送方计算总和(通常模 256)并附加在数据后。接收方重复加法并比较。清晰写出计算过程。
Example: Determine the even parity bit for the 7‑bit data 1011001. Number of 1s = 4 (even). Even parity bit = 0, so the transmitted byte is 10110010.
示例:为 7 位数据 1011001 确定偶校验位。 1 的个数 = 4(偶数)。偶校验位 = 0,因此发送字节为 10110010。
Example checksum: Sender transmits bytes 12, 7, 45 and a checksum byte which is the sum modulo 256. Sum = 12+7+45=64. Mod 256 = 64. Transmitted checksum = 64. Receiver adds received bytes 12,7,45,64 and gets 128. If the sum and checksum do not produce the expected value (often zero after including checksum), an error is detected.
校验和示例:发送方发送字节 12、7、45 以及作为总和模 256 的校验和字节。 总和 = 12+7+45=64。模 256 = 64。发送的校验和 = 64。接收方将收到的字节 12、7、45、64 相加得 128。如果总和中包含校验和后得不到预期值(通常为零),则检测到错误。
11. Storage Size Conversions and Data Units | 存储容量换算与数据单位
Questions often test the ability to interconvert between bits, bytes, kilobytes, megabytes, gigabytes, and terabytes. In IGCSE CIE, the convention is usually that a kilobyte is 1024 bytes (binary prefix), not 1000 – but always read the question: some networking contexts use 1000. Practice multiplying and dividing by 1024, and also by 8 when moving between bits and bytes.
考题常考查位、字节、千字节、兆字节、千兆字节和太字节之间的互转。在 IGCSE CIE 中,惯例通常是 1 千字节 = 1024 字节(二进制前缀),而非 1000——但务必审题:某些组网场景使用 1000。练习乘以和除以 1024,以及在位与字节之间转换时除以或乘以 8。
1 B = 8 bits
1 KB = 1024 B
1 MB = 1024 KB
1 GB = 1024 MB
1 TB = 1024 GB
Example: How many 2 MB files can be stored on an 8 GB USB drive? (8 GB = 8 × 1024 MB = 8192 MB. Number of files = 8192 ÷ 2 = 4096.)
示例:一张 8 GB 的 U 盘能存储多少个 2 MB 的文件?(8 GB = 8 × 1024 MB = 8192 MB。文件数量 = 8192 ÷ 2 = 4096。)
12. IP Address and Subnet Calculations (Extension) | IP 地址与子网计算(拓展)
While IGCSE mainly expects understanding of IPv4 address format (dotted decimal, 4 bytes), some problems ask to calculate the number of addresses in a subnet given a prefix length. The number of addresses = 2^(32 − prefix). For example, a /28 network has 2^(4) = 16 addresses, with 14 usable for hosts because one is the network address and one is the broadcast address. Know the difference between IPv4 and IPv6 (128‑bit address, hexadecimal).
虽然 IGCSE 主要期望理解 IPv4 地址格式(点分十进制,4 字节),但有些题目会要求根据前缀长度计算子网内的地址数量。地址数量 = 2^(32 − 前缀)。例如,一个 /28 网络有 2^(4) = 16 个地址,其中 14 个可用于主机,因为一个是网络地址,一个是广播地址。需了解 IPv4 与 IPv6 的区别(128 位地址,十六进制表示)。
Example: Your school is assigned 192.168.10.0/24. How many devices can be given unique IP addresses? Prefix is 24, so host bits = 8. Number of addresses = 2^8 = 256. Usable hosts = 256 − 2 = 254.
示例:你的学校分配到 192.168.10.0/24 网段。可以为多少个设备分配唯一 IP 地址? 前缀为 24,主机位 = 8。地址数量 = 2^8 = 256。可用主机 = 256 − 2 = 254。
Published by TutorHao | Computer Science Revision Series | aleveler.com
更多咨询请联系16621398022(同微信)
屏轩国际教育cambridge primary/secondary checkpoint, cat4, ukiset,ukcat,igcse,alevel,PAT,STEP,MAT, ibdp,ap,ssat,sat,sat2课程辅导,国外大学本科硕士研究生博士课程论文辅导