Year 7 OCR Computer Science: Quick Reference Formulae & Theorems | Year 7 OCR 计算机:公式定理速查手册

📚 Year 7 OCR Computer Science: Quick Reference Formulae & Theorems | Year 7 OCR 计算机:公式定理速查手册

This handbook brings together the essential formulae, conversion rules, boolean laws and size calculation theorems every Year 7 OCR Computer Science student needs at their fingertips. Use it to tackle binary challenges, simplify logic expressions and work out file sizes with confidence.

本手册汇集了所有 Year 7 OCR 计算机科学学生必须掌握的公式、转换规则、布尔定律和大小计算定理,方便随时查阅。用它来攻克二进制难题、化简逻辑表达式并自信地计算文件大小。

1. Bits and Bytes | 位与字节

A bit is the smallest unit of data in a computer, holding either a 0 or a 1. Eight bits together form one byte, which can represent 2⁸ = 256 different values.

位(bit)是计算机中最小的数据单位,只能存储 0 或 1。8 个位组成一个字节(byte),可以表示 2⁸ = 256 种不同的值。

When we group bits, each extra bit doubles the number of possible combinations. The formula for the number of values with n bits is 2ⁿ.

当我们把位组合起来时,每增加一位,可能的组合数就翻倍。用 n 位可以表示的数值数量公式是 2ⁿ。


2. Binary Number Basics | 二进制基础

Binary is a base‑2 number system using only the digits 0 and 1. Each column in a binary number represents a power of 2, starting from 2⁰ on the right.

二进制是一种以 2 为基数的数字系统,只使用 0 和 1 两个数字。二进制数中的每一列都代表 2 的幂,从最右边的 2⁰ 开始。

For an 8‑bit binary number, the place values are: 2⁷ (128), 2⁶ (64), 2⁵ (32), 2⁴ (16), 2³ (8), 2² (4), 2¹ (2), 2⁰ (1). We place 1s and 0s in these columns to build any number from 0 to 255.

对于 8 位二进制数,位值依次为:2⁷ (128)、2⁶ (64)、2⁵ (32)、2⁴ (16)、2³ (8)、2² (4)、2¹ (2)、2⁰ (1)。我们在这些列中填入 1 或 0,就可以构建从 0 到 255 的任意数字。


3. Decimal to Binary Conversion Formula | 十进制转二进制公式

To convert a decimal number to binary, repeatedly divide the number by 2 and record the remainder at each step. Read the remainders from bottom to top to obtain the binary equivalent.

要将十进制数转换为二进制,需要反复将该数除以 2 并记录每一步的余数。从下往上读取余数,就得到了二进制表示。

Formally, keep dividing until the quotient becomes 0: Remainder₀ (least significant bit), Remainder₁, … , Remainderₙ₋₁ (most significant bit).

正式的做法是持续除以 2 直到商为 0:余数₀(最低位)、余数₁、……、余数ₙ₋₁(最高位)。

Example: Convert 13 to binary. 13 ÷ 2 = 6 r 1; 6 ÷ 2 = 3 r 0; 3 ÷ 2 = 1 r 1; 1 ÷ 2 = 0 r 1. Reading upwards gives 1101₂.

示例:将 13 转换为二进制。13 ÷ 2 = 6 余 1;6 ÷ 2 = 3 余 0;3 ÷ 2 = 1 余 1;1 ÷ 2 = 0 余 1。自下而上读得 1101₂。


4. Binary to Decimal Conversion Formula | 二进制转十进制公式

The value of a binary number is found by summing each digit × 2 to the power of its position. For an n‑bit number bₙ₋₁ bₙ₋₂ … b₀, the decimal value = bₙ₋₁×2ⁿ⁻¹ + bₙ₋₂×2ⁿ⁻² + … + b₀×2⁰.

二进制数的值等于每一位数字乘以 2 的位权次幂再求和。对于 n 位二进制数 bₙ₋₁ bₙ₋₂ … b₀,十进制值 = bₙ₋₁×2ⁿ⁻¹ + bₙ₋₂×2ⁿ⁻² + … + b₀×2⁰。

Example: 10110₂ = 1×2⁴ + 0×2³ + 1×2² + 1×2¹ + 0×2⁰ = 16 + 0 + 4 + 2 + 0 = 22.

示例:10110₂ = 1×2⁴ + 0×2³ + 1×2² + 1×2¹ + 0×2⁰ = 16 + 0 + 4 + 2 + 0 = 22。


5. Binary Addition Rules | 二进制加法规则

Binary addition follows four simple rules: 0 + 0 = 0; 0 + 1 = 1; 1 + 0 = 1; 1 + 1 = 0, carry 1 to the next higher column.

二进制加法遵循四条简单规则:0 + 0 = 0;0 + 1 = 1;1 + 0 = 1;1 + 1 = 0,并向高位进 1。

When adding two 1s and a carried 1, the sum is 1 with a carry of 1 (1 + 1 + 1 = 11₂). Always work from right to left, adding the carry into each column.

当两个 1 再加上一个进位 1 时,和为 1 并向高位进 1(1 + 1 + 1 = 11₂)。始终从右向左逐位相加,并将进位带入下一列。


6. Overflow in Binary Addition | 二进制加法中的溢出

Overflow occurs when the result of a binary addition exceeds the maximum value that can be stored in the fixed number of bits. For example, in 8‑bit unsigned binary, the largest number is 255 (11111111₂). Adding two 8‑bit numbers whose sum is 256 or more causes an overflow, and an extra bit would be needed to represent the result correctly.

当二进制加法的结果超出了固定位数所能存储的最大值时,就会发生溢出。例如,在 8 位无符号二进制中,最大值为 255(11111111₂)。两个 8 位数相加,若结果大于或等于 256,就会产生溢出,此时需要额外的位才能正确表示结果。

Overflow is usually signalled by a carry out of the most significant bit. In programming, it can lead to incorrect calculations, which is why we often use larger bit widths or detect overflow flags.

溢出通常表现为最高位产生进位。在编程中,溢出可能导致计算错误,因此我们常常使用更宽的位宽或检测溢出标志。


7. Storage Unit Conversion Formulae | 存储单位换算公式

Computer storage is measured in bytes, with larger units formed by multiplying repeatedly by 1024 (2¹⁰). The standard binary prefixes are:

计算机存储以字节为单位,更大的单位通过反复乘以 1024 (2¹⁰) 得到。标准的二进制前缀如下:

1 KiB (kibibyte) = 1024 bytes; 1 MiB = 1024 KiB = 1024² bytes; 1 GiB = 1024 MiB = 1024³ bytes; 1 TiB = 1024 GiB = 1024⁴ bytes.

1 KiB(千二进制字节)= 1024 字节;1 MiB = 1024 KiB = 1024² 字节;1 GiB = 1024 MiB = 1024³ 字节;1 TiB = 1024 GiB = 1024⁴ 字节。

Sometimes manufacturers use decimal prefixes (1 KB = 1000 bytes), but in OCR Computer Science we always use base‑2 conversions when discussing memory and file sizes.

有时制造商会使用十进制前缀(1 KB = 1000 字节),但在 OCR 计算机科学中,讨论内存和文件大小时我们始终使用以 2 为基数的换算。


8. Boolean Logic Truth Tables | 布尔逻辑真值表

The three fundamental logic gates produce predictable outputs based on their inputs. The truth table for the NOT gate contains one input and one output:

三种基本逻辑门根据输入产生可预测的输出。非门(NOT)的真值表有一个输入和一个输出:

Input A Output NOT A
0 1
1 0

The AND gate gives an output of 1 only when all inputs are 1. Its truth table for two inputs A and B is:

与门(AND)仅当所有输入都为 1 时才输出 1。两输入 A、B 的真值表如下:

A B A AND B
0 0 0
0 1 0
1 0 0
1 1 1

The OR gate gives an output of 1 if at least one input is 1. The two‑input truth table is:

或门(OR)只要至少有一个输入为 1 就输出 1。两输入真值表如下:

A B A OR B
0 0 0
0 1 1
1 0 1
1 1 1

9. Boolean Laws and Simplification | 布尔逻辑定律与化简

Boolean algebra allows us to simplify logic expressions using a set of laws. The commutative law states that the order of inputs does not matter: A AND B = B AND A and A OR B = B OR A.

布尔代数允许我们利用一套定律来化简逻辑表达式。交换律指出输入的顺序无关紧要:A AND B = B AND A 且 A OR B = B OR A。

The associative law lets us group inputs differently: (A AND B) AND C = A AND (B AND C); similarly for OR.

结合律允许我们以不同方式对输入进行分组:(A AND B) AND C = A AND (B AND C);OR 运算类似。

Identity laws are useful: A AND 1 = A, A OR 0 = A. Domination laws: A AND 0 = 0, A OR 1 = 1. Idempotent laws: A AND A = A, A OR A = A.

恒等律十分有用:A AND 1 = A,A OR 0 = A。支配律:A AND 0 = 0,A OR 1 = 1。幂等律:A AND A = A,A OR A = A。

The complement law: A AND (NOT A) = 0, A OR (NOT A) = 1. The double negation law: NOT (NOT A) = A.

互补律:A AND (NOT A) = 0,A OR (NOT A) = 1。双重否定律:NOT (NOT A) = A。

These laws help reduce the number of gates needed in a circuit, making the design more efficient.

这些定律有助于减少电路中所需逻辑门的数量,从而使设计更加高效。


10. Image File Size Formula | 图像文件大小公式

The file size of a bitmap image is determined by its resolution and colour depth. The basic formula is: Image file size (bits) = Image width (pixels) × Image height (pixels) × Colour depth (bits per pixel).

位图图像的文件大小由其分辨率和色彩深度决定。基本公式为:图像文件大小(位)= 图像宽度(像素)× 图像高度(像素)× 色彩深度(每像素位数)。

Colour depth tells you how many bits are used to store the colour of each pixel. A 1‑bit depth gives 2 colours, 8‑bit depth gives 2⁸ = 256 colours, and 24‑bit depth yields 16.7 million colours.

色彩深度表示用于存储每个像素颜色的位数。1 位深度可产生 2 种颜色,8 位深度产生 2⁸ = 256 种颜色,24 位深度可产生约 1670 万种颜色。

To express the final size in bytes, divide the result by 8. For example, a 100 × 100 pixel image with 24‑bit colour: 100 × 100 × 24 = 240,000 bits ÷ 8 = 30,000 bytes.

若要以字节表示最终大小,只需将结果除以 8。例如,一幅 100 × 100 像素、24 位色彩的图像:100 × 100 × 24 = 240,000 位 ÷ 8 = 30,000 字节。


11. Sound File Size Formula | 音频文件大小公式

A digital audio file records sound by sampling the amplitude thousands of times per second. The size formula is: Sound file size (bits) = Sample rate (Hz) × Bit depth × Duration (seconds) × Number of channels.

数字音频文件通过每秒数千次对振幅进行采样来录制声音。大小公式为:音频文件大小(位)= 采样率(Hz)× 位深度 × 时长(秒)× 声道数。

Typical sample rates are 44.1 kHz for CD‑quality audio. Bit depth is often 16 bits. Stereo sound uses 2 channels; mono uses 1.

CD 品质音频的典型采样率为 44.1 kHz。位深度通常为 16 位。立体声使用 2 个声道,单声道使用 1 个声道。

Example: 30 seconds of stereo CD‑quality audio: 44,100 × 16 × 30 × 2 = 42,336,000 bits. Divide by 8 to get bytes (5,292,000 bytes), then by 1,024 twice to reach approximately 5.04 MiB.

示例:30 秒立体声 CD 品质音频:44,100 × 16 × 30 × 2 = 42,336,000 位。除以 8 得到字节数 (5,292,000 字节),再除以两次 1024 则得到约 5.04 MiB。


Published by TutorHao | 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课程辅导,国外大学本科硕士研究生博士课程论文辅导

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