📚 GCSE Edexcel Computer Science: Calculation Practice | GCSE Edexcel 计算机:计算题专项训练
Calculation questions in GCSE Edexcel Computer Science test your ability to apply mathematical concepts to computing problems. From binary arithmetic and data representation to file sizes, encryption and processor performance, these skills underpin many areas of the specification. This article provides focused practice on the key calculation topics, with step-by-step methods and worked examples for each.
GCSE Edexcel 计算机科学中的计算题考查你将数学概念应用于计算机问题的能力。从二进制运算、数据表示到文件大小、加密和处理器性能,这些技能是考纲多个领域的基础。本文对关键计算主题进行专项训练,每个部分都给出了逐步方法和完整示例。
1. Binary to Denary Conversion | 二进制转十进制
To convert a binary number to denary, write the column headings as powers of 2 starting from 2⁰ on the right. Multiply each binary digit by its column value and sum the results.
要将二进制数转换为十进制,从右端开始写出以2为底的幂次作为位权,最右为2⁰。将每个二进制位与其位权相乘,然后求和。
Example: Convert 10101101₂ to denary.
示例:将 10101101₂ 转换为十进制。
Column values: 128 64 32 16 8 4 2 1
Binary: 1 0 1 0 1 1 0 1
位权:128 64 32 16 8 4 2 1
二进制:1 0 1 0 1 1 0 1
10101101₂ = 1×128 + 0×64 + 1×32 + 0×16 + 1×8 + 1×4 + 0×2 + 1×1 = 128 + 32 + 8 + 4 + 1 = 173₁₀
2. Denary to Binary Conversion | 十进制转二进制
To convert a denary number to binary, repeatedly divide the number by 2, recording the remainder each time. Read the remainders from bottom to top to get the binary equivalent.
要将十进制数转换为二进制,反复除以2,记录每次的余数。从下往上读出余数序列,即得到二进制表示。
Example: Convert 173₁₀ to binary.
示例:将 173₁₀ 转换为二进制。
173 ÷ 2 = 86 remainder 1
86 ÷ 2 = 43 remainder 0
43 ÷ 2 = 21 remainder 1
21 ÷ 2 = 10 remainder 1
10 ÷ 2 = 5 remainder 0
5 ÷ 2 = 2 remainder 1
2 ÷ 2 = 1 remainder 0
1 ÷ 2 = 0 remainder 1
173 ÷ 2 = 86 余 1
86 ÷ 2 = 43 余 0
43 ÷ 2 = 21 余 1
21 ÷ 2 = 10 余 1
10 ÷ 2 = 5 余 0
5 ÷ 2 = 2 余 1
2 ÷ 2 = 1 余 0
1 ÷ 2 = 0 余 1
Reading remainders upwards gives 10101101₂.
从下往上读出余数得到 10101101₂。
3. Hexadecimal Conversions | 十六进制转换
Hexadecimal (base 16) uses digits 0–9 and letters A–F where A=10, B=11, C=12, D=13, E=14, F=15. To convert binary to hex, group bits in fours from the right and replace each nibble with its hex digit.
十六进制(基数为16)使用数字0-9和字母A-F,其中A=10, B=11, C=12, D=13, E=14, F=15。将二进制转十六进制时,从右侧开始每四位一组,用对应的十六进制数字替换每个半字节。
Example: Convert 10101101₂ to hex. Group into nibbles: 1010 1101. 1010₂ = A₁₆, 1101₂ = D₁₆, so the result is AD₁₆.
示例:将10101101₂转十六进制。分成半字节:1010 1101。1010₂ = A₁₆,1101₂ = D₁₆,所以结果为 AD₁₆。
To convert denary to hex, divide by 16 repeatedly and read remainders. For 173: 173 ÷ 16 = 10 remainder 13 → A₁₆ and D₁₆, giving AD₁₆.
将十进制转十六进制,反复除以16,读出余数。对于173:173 ÷ 16 = 10 余 13 → A₁₆ 和 D₁₆,得到 AD₁₆。
4. Binary Addition and Overflow | 二进制加法与溢出
Binary addition follows these rules: 0+0=0, 0+1=1, 1+0=1, 1+1=0 with carry 1, 1+1+1=1 with carry 1. When the result exceeds the available number of bits, an overflow error occurs.
二进制加法规则:0+0=0,0+1=1,1+0=1,1+1=0 进位1,1+1+1=1 进位1。当结果超出可用位数时,会发生溢出错误。
Example: Add 1010₂ and 0111₂ in a 4-bit register.
示例:在4位寄存器中将 1010₂ 与 0111₂ 相加。
1010
+ 0111
1 carry
= 10001 (5 bits, overflow in 4-bit)
Since the result needs 5 bits but only 4 are stored, the most significant bit is lost, causing an incorrect value (0001₂). This is an overflow error.
因为结果需要5位但只存储4位,最高有效位丢失,导致数值错误(0001₂)。这就是溢出错误。
5. Logical Operators and Truth Tables | 逻辑运算符与真值表
Logic gates perform Boolean operations on binary inputs. The common gates are NOT, AND, OR and XOR. Truth tables show all possible input combinations and the resulting output.
逻辑门对二进制输入执行布尔运算。常见门包括非门、与门、或门和异或门。真值表列出所有可能的输入组合及对应的输出。
AND gate truth table:
与门真值表:
| Input A | Input B | Output Q |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
You can be asked to complete a truth table for a simple logic circuit or work out the output for given inputs. Write expressions like Q = A AND B.
考试可能要求你补全简单逻辑电路的真值表,或计算给定输入的输出。通常写出表达式,如 Q = A AND B。
6. Image File Size Calculation | 图像文件大小计算
Image file size depends on resolution and colour depth. The formula is:
图像文件大小取决于分辨率和颜色深度。计算公式为:
File size (bits) = width × height × colour depth
Colour depth is the number of bits used to represent the colour of each pixel. The number of colours = 2colour depth. A colour depth of 8 bits gives 256 colours.
颜色深度是表示每个像素颜色所用的位数。颜色数量 = 2颜色深度。8位颜色深度可显示256种颜色。
Example: An image is 800 × 600 pixels with a colour depth of 24 bits. Calculate the file size in kilobytes.
示例:一幅图像为800 × 600像素,颜色深度24位。计算文件大小,以千字节为单位。
Bits = 800 × 600 × 24 = 11,520,000 bits
Bytes = 11,520,000 ÷ 8 = 1,440,000 bytes
Kilobytes = 1,440,000 ÷ 1024 ≈ 1406.25 KB
位数 = 800 × 600 × 24 = 11,520,000 位
字节数 = 11,520,000 ÷ 8 = 1,440,000 字节
千字节数 = 1,440,000 ÷ 1024 ≈ 1406.25 KB
7. Sound File Size Calculation | 声音文件大小计算
Sound file size depends on sample rate, sample resolution (bit depth), duration and number of channels. Use the formula:
声音文件大小取决于采样率、采样分辨率(位深)、时长和声道数。使用以下公式:
File size (bits) = sample rate × bit depth × duration (seconds) × channels
Example: A stereo recording (2 channels) is made at a sample rate of 44.1 kHz with a bit depth of 16 bits. The duration is 3 minutes. Find the file size in megabytes.
示例:一段立体声录音(2声道),采样率44.1 kHz,位深16位,时长3分钟。求文件大小,以兆字节为单位。
Duration in seconds = 3 × 60 = 180 s
Bits = 44,100 × 16 × 180 × 2 = 254,016,000 bits
Bytes = 254,016,000 ÷ 8 = 31,752,000 bytes
Megabytes = 31,752,000 ÷ (1024 × 1024) ≈ 30.28 MB
时长(秒)= 3 × 60 = 180 秒
位数 = 44,100 × 16 × 180 × 2 = 254,016,000 位
字节数 = 254,016,000 ÷ 8 = 31,752,000 字节
兆字节数 = 31,752,000 ÷ (1024 × 1024) ≈ 30.28 MB
8. Compression Ratio | 压缩比计算
Compression ratio compares the original file size to the compressed file size.
压缩比比较原始文件大小与压缩后文件大小。
Compression ratio = original size ÷ compressed size
Example: A 24 MB image is compressed to 6 MB. What is the compression ratio?
示例:一幅24 MB的图像被压缩到6 MB。压缩比是多少?
Compression ratio = 24 ÷ 6 = 4:1
压缩比 = 24 ÷ 6 = 4:1
You can also calculate the percentage reduction: ((24 – 6) ÷ 24) × 100 = 75%.
也可以计算减少的百分比:((24 – 6) ÷ 24) × 100 = 75%。
9. Data Transmission Time | 数据传输时间
To find the time needed to transfer a file, divide the file size by the transfer rate. Make sure units match (bits with bits, bytes with bytes).
计算传输文件所需时间,将文件大小除以传输速率。确保单位一致(位对位,字节对字节)。
Time (seconds) = file size ÷ transfer rate
Example: A 20 MB file is downloaded over a 8 Mbps connection. Calculate the time in seconds. Note: 1 MB = 8 Mb (megabits).
示例:通过8 Mbps连接下载一个20 MB的文件。计算时间(秒)。注意:1 MB = 8 Mb(兆位)。
File size in bits = 20 × 8 = 160 Mb
Time = 160 Mb ÷ 8 Mbps = 20 seconds
文件大小(位)= 20 × 8 = 160 Mb
时间 = 160 Mb ÷ 8 Mbps = 20 秒
If the rate is given in bytes per second, convert the file to bytes: 20 MB = 20 × 1024 × 1024 bytes; time depends on the rate.
如果速率以字节/秒给出,将文件转为字节:20 MB = 20 × 1024 × 1024 字节;时间取决于速率。
10. Caesar Cipher Encryption | 凯撒密码加密计算
The Caesar cipher shifts each letter in the plaintext by a fixed number of positions in the alphabet. Wrapping occurs at the end (Z → A).
凯撒密码将明文中的每个字母在字母表中移动固定数量的位置。到达末尾时从A继续(Z → A)。
Example: Encrypt ‘COMPUTING’ with a shift of 5.
示例:用移位5加密’COMPUTING’。
C→H (C+5: C D E F G H), O→T, M→R, P→U, U→Z, T→Y, I→N, N→S, G→L. Ciphertext: HTRUZ YNSL (often grouped as HTRUZ YNSL).
C→H(C+5: C D E F G H),O→T,M→R,P→U,U→Z,T→Y,I→N,N→S,G→L。密文:HTRUZ YNSL(通常分组为HTRUZYNSL)。
To decrypt, shift back by the same key. In exam questions, you may need to find the plaintext given the ciphertext and shift, or determine the shift from a known pair.
解密时,向回移动相同的密钥。考试中,可能需要根据密文和移位找出明文,或根据已知配对确定移位值。
11. CPU Performance Calculations | CPU性能计算
CPU performance is often described by clock speed, number of cores and instructions per cycle. Basic timing uses the relationship between clock frequency and clock period:
CPU性能通常用时钟频率、核心数和每周期指令数来描述。基本计时使用时钟频率和时钟周期之间的关系:
Clock period (seconds) = 1 ÷ clock frequency (Hz)
If a CPU runs at 3 GHz, clock period = 1 ÷ (3 × 10⁹) ≈ 0.33 × 10⁻⁹ s = 0.33 ns.
如果一个CPU以3 GHz运行,时钟周期 = 1 ÷ (3 × 10⁹) ≈ 0.33 × 10⁻⁹ 秒 = 0.33 纳秒。
To find execution time for a program, you can use:
计算程序执行时间,可使用:
Execution time = (number of instructions × CPI) ÷ clock frequency
Where CPI is cycles per instruction. Example: A program has 2 million instructions, average CPI is 2.5, and the CPU clock is 2 GHz. Find execution time.
其中CPI为每条指令周期数。示例:一个程序有2百万条指令,平均CPI为2.5,CPU时钟为2 GHz。求执行时间。
Time = (2,000,000 × 2.5) ÷ (2 × 10⁹) = 5,000,000 ÷ 2,000,000,000 = 0.0025 seconds = 2.5 ms.
时间 = (2,000,000 × 2.5) ÷ (2 × 10⁹) = 5,000,000 ÷ 2,000,000,000 = 0.0025 秒 = 2.5 毫秒。
These calculations help compare the effect of faster clock speeds or improved CPI on performance.
这些计算有助于比较更高时钟频率或改进CPI对性能的影响。
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课程辅导,国外大学本科硕士研究生博士课程论文辅导