IB and Edexcel Computer Science: Calculation Drill | IB 与 Edexcel 计算机:计算题专项训练

📚 IB and Edexcel Computer Science: Calculation Drill | IB 与 Edexcel 计算机:计算题专项训练

This article provides a focused drill on the calculation-style questions commonly found in IB and Edexcel Computer Science exams. From binary conversions to algorithm efficiency, mastering these quantitative techniques is essential for top scores. Each section introduces a key topic, step-by-step methods, and worked examples.

本文针对 IB 和 Edexcel 计算机科学考试中常见的计算题型进行专项训练,涵盖二进制转换、算法效率等量化技巧。掌握这些计算方法是获取高分的关键。每节介绍一个核心主题,提供分步方法与具体示例。


1. Number Systems & Conversions | 数制与转换

The binary (base-2), decimal (base-10), and hexadecimal (base-16) systems are fundamental. To convert a binary number to decimal, sum the products of each bit and its place value (power of 2). For example, binary 1011₂ = 1×2³ + 0×2² + 1×2¹ + 1×2⁰ = 8+0+2+1 = 11₁₀.

二进制(基2)、十进制(基10)和十六进制(基16)是基础。将二进制数转换为十进制,需将每一位乘以对应的位权(2的幂次)并求和。例如,二进制 1011₂ = 1×2³ + 0×2² + 1×2¹ + 1×2⁰ = 8+0+2+1 = 11₁₀。

To convert decimal to binary, repeatedly divide the number by 2, recording remainders. Read the remainders from bottom to top. For 25₁₀: 25÷2=12 r1, 12÷2=6 r0, 6÷2=3 r0, 3÷2=1 r1, 1÷2=0 r1 → 11001₂. For hexadecimal, group binary digits in sets of four. e.g., 1101 0110₂ = D6₁₆.

十进制转二进制:反复除以2并记录余数,从下往上读余数。例如 25₁₀:25÷2=12 余1,12÷2=6 余0,6÷2=3 余0,3÷2=1 余1,1÷2=0 余1 → 11001₂。二进制转十六进制:将二进制数四位一组分组。如 1101 0110₂ = D6₁₆。


2. Integer Representation: Two’s Complement | 整数表示:补码

Two’s complement is the standard method for representing signed integers. In an n-bit system, the most significant bit is the sign bit (0 for positive, 1 for negative). To find the two’s complement of a negative number, invert all bits of its positive magnitude and add 1. Example: in 8 bits, represent -13. Positive 13 is 0000 1101. Invert to 1111 0010, add 1 → 1111 0011. So -13₁₀ = 1111 0011 (two’s complement).

补码是表示有符号整数的标准方法。在 n 位系统中,最高位为符号位(0 正,1 负)。求负数的补码:将其绝对值的二进制按位取反后加 1。例如,用 8 位表示 -13。正数 13 为 0000 1101。取反得 1111 0010,加 1 → 1111 0011。因此 -13₁₀ = 1111 0011(补码)。

To convert a negative two’s complement binary back to decimal, note the sign bit is 1, indicating negative. Invert the bits and add 1 to find the magnitude, then apply a negative sign. For 1111 0011, invert → 0000 1100, add 1 → 0000 1101 = 13, so the value is -13. The range for n-bit two’s complement is -2ⁿ⁻¹ to 2ⁿ⁻¹ – 1.

将负数的补码转回十进制:符号位为 1 表示负数,对数值位取反加 1 得到绝对值,再加负号。如 1111 0011,取反得 0000 1100,加 1 → 0000 1101 = 13,因此数值为 -13。n 位补码的表示范围为 -2ⁿ⁻¹ 到 2ⁿ⁻¹ – 1。


3. Floating-Point Representation | 浮点数表示

Floating-point numbers follow the IEEE 754 standard: sign (1 bit), exponent (8 bits for single precision, bias 127), and mantissa (23 bits, with implicit leading 1). To convert a decimal like 9.75 to binary floating point: binary of 9.75 = 1001.11₂ = 1.00111 × 2³. Sign = 0, exponent = 3 + 127 = 130 → 10000010₂, mantissa = 0011100…0. The 32-bit representation is 0 10000010 00111000000000000000000.

浮点数遵循 IEEE 754 标准:符号位(1 位)、指数位(单精度 8 位,偏移量 127)和尾数(23 位,有一个隐含的 1)。将十进制数 9.75 转换为二进制浮点数:9.75 的二进制为 1001.11₂ = 1.00111 × 2³。符号 = 0,指数 = 3 + 127 = 130 → 10000010₂,尾数 = 001110…0。32 位表示为 0 10000010 00111000000000000000000。

In the exam, you may need to calculate the decimal value from a binary IEEE 754 pattern. Parse sign, exponent, mantissa. Exponent actual = exponent field – 127. Value = (-1)^sign × (1 + mantissa fraction) × 2^(actual exponent). Practice with edge cases like denormalized numbers.

考试中可能需要根据 IEEE 754 二进制模式计算十进制值。解析符号、指数、尾数。实际指数 = 指数字段 – 127。值 = (-1)^符号 × (1 + 尾数小数部分) × 2^(实际指数)。同时练习非规格化数等特殊情况。


4. Boolean Algebra & Logic Gate Simplification | 布尔代数与逻辑门化简

Boolean algebra uses operators AND (·), OR (+), NOT (‾). Simplifying expressions reduces gate count. Apply laws like De Morgan’s, distribution, absorption. Example: Simplify A·B + A·(B+C). = A·B + A·B + A·C = A·B + A·C = A·(B+C). Use truth tables to verify equivalence.

布尔代数使用与 (·)、或 (+)、非 (‾

Published by TutorHao | IB 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