📚 IGCSE Computer Science: Core Concepts of Data Representation | IGCSE计算机:数据表示核心概念
In the IGCSE Computer Science syllabus, data representation is a fundamental topic. It explains how all data inside a computer is stored, processed and transmitted using binary code.
在IGCSE计算机科学课程大纲中,数据表示是一个基础主题。它解释了计算机内部如何用二进制代码来存储、处理和传输所有数据。
1. Binary and Denary Conversion | 二进制与十进制转换
Denary (or decimal) is base 10 and uses the digits 0-9. Binary is base 2 and uses only the digits 0 and 1. Every digital device uses binary because electronic circuits have two stable states: on and off.
十进制以10为基数,使用0-9十个数字。二进制以2为基数,只使用0和1。每台数字设备都使用二进制,因为电子电路有两种稳定状态:开和关。
The place values in binary are powers of 2: from right to left they are 1, 2, 4, 8, 16, 32 and so on. Each binary digit is called a bit.
二进制中的位值是2的幂:从右向左依次是1、2、4、8、16、32等。每个二进制数字称为一位(bit)。
To convert a binary number to denary, multiply each bit by its place value and add the results. For example, 1101₂ represents:
要将二进制数转换为十进制,需要用每一位乘以它的位值,然后将结果相加。例如,1101₂ 表示:
1101₂ = 1×8 + 1×4 + 0×2 + 1×1 = 13
To convert a denary number to binary, repeatedly divide by 2 and record the remainders from bottom to top.
要将十进制数转换为二进制,可以不断除以2并记录余数,从下往上读取余数即可。
2. Hexadecimal and Its Uses | 十六进制及其用途
Hexadecimal (hex) is base 16 and uses the digits 0-9 followed by A-F, where A=10, B=11, C=12, D=13, E=14, F=15. Each hex digit can represent four binary bits.
十六进制以16为基数,使用0-9,然后是A-F,其中A=10,B=11,C=12,D=13,E=14,F=15。每个十六进制数位可以表示四位二进制数。
Hexadecimal is used in computer systems because it is much shorter and easier for humans to read than long binary strings.
计算机系统使用十六进制是因为它比长串二进制更简短、更易于人类阅读。
To convert hex to binary, write each hex digit as a 4-bit binary group. For example, 2A₁₆ = 0010 1010₂ = 42 in denary.
将十六进制转换为二进制时,只需把每个十六进制数位写成4位二进制。例如,2A₁₆ = 0010 1010₂ = 十进制的42。
To convert denary to hex, divide by 16 repeatedly and record remainders, or convert through binary.
将十进制转换为十六进制,可以不断除以16并记录余数,或者先转换为二进制再分组。
3. Data Units: Bit to Terabyte | 数据单位:从位到太字节
A bit is the smallest unit of data and holds either a 0 or a 1. A nibble is 4 bits, and a byte is 8 bits.
位(bit)是最小的数据单位,保存一个0或一个1。半字节(nibble)等于4位,一字节(byte)等于8位。
Larger units are usually based on powers of 2 in IGCSE Computer Science:
在IGCSE计算机科学中,较大的单位通常基于2的幂:
1 KB = 2¹⁰ bytes = 1024 bytes
1 MB = 2²⁰ bytes = 1024 KB
1 GB = 2³⁰ bytes = 1024 MB
1 TB = 2⁴⁰ bytes = 1024 GB
When calculating file sizes, you must use consistent units. Always check whether the question asks for bits or bytes.
计算文件大小时,必须使用一致的单位。务必注意题目要求的是位还是字节。
4. Two’s Complement for Signed Integers | 二进制补码表示有符号整数
Computers need a way to represent negative numbers. Two’s complement is the standard method.
计算机需要一种表示负数的方法。二进制补码就是常用的标准方法。
In two’s complement, the most significant bit (MSB) represents the sign: 0 for positive, 1 for negative. For an 8-bit number, the MSB has place value −128.
在二进制补码中,最高位表示符号:0为正数,1为负数。对于8位二进制数,最高位的位值是 −128。
To find the two’s complement of a positive number, invert all bits and add 1. For example, +5 is 00000101₂. Inverting gives 11111010₂, then adding 1 gives 11111011₂, which represents −5.
要得到一个正数的补码,先把所有位取反,再加1。例如,+5是00000101₂,取反后为11111010₂,再加1得11111011₂,这就是−5。
The range of an 8-bit two’s complement number is −128 to +127. For n bits, the range is −2ⁿ⁻¹ to 2ⁿ⁻¹−1.
8位二进制补码的范围是 −128 到 +127。对于n位,范围是 −2ⁿ⁻¹ 到 2ⁿ⁻¹−1。
5. Binary Addition and Overflow | 二进制加法与溢出
Binary addition follows four simple rules:
二进制加法遵循四条简单规则:
0+0=0, 0+1=1, 1+0=1, 1+1=10 (carry 1)
When adding two binary numbers, digits are added from right to left. If a column produces a carry, that carry is added to the next column.
两个二进制数相加时,从右向左逐位相加。如果某一位产生进位,就把进位加到下一列。
Overflow occurs when the result is too large to fit in the fixed number of bits. For example, adding 01111111₂ (+127) and 00000001₂ (+1) in 8 bits gives 10000000₂, which in two’s complement is −128, not +128. This is because the result exceeds the 8-bit signed range.
当结果超出固定位数所能表示的范围时,就会发生溢出。例如,8位中计算 01111111₂(+127)加 00000001₂(+1),结果应为 10000000₂,这实际上表示−128,而不是+128。这是因为结果超过了8位有符号数的范围。
Always check whether overflow has occurred when adding signed integers. In logic circuits, the carry out of the MSB indicates overflow.
在添加有符号整数时,一定要检查是否发生了溢出。在逻辑电路中,最高位的进位输出表示溢出。
6. Character Encoding: ASCII and Unicode | 字符编码:ASCII与Unicode
Characters such as letters, digits and symbols must be stored as binary codes. ASCII (American Standard Code for Information Interchange) uses 7 bits to code 128 characters.
字母、数字和符号等字符必须以二进制代码存储。ASCII(美国信息交换标准代码)使用7位来编码128个字符。
Extended ASCII uses 8 bits and codes 256 characters. However, ASCII cannot represent all world languages, so Unicode was developed.
扩展ASCII使用8位,可编码256个字符。然而,ASCII无法表示世界上所有语言,因此出现了Unicode。
Unicode uses variable-length encoding, such as UTF-8, and can represent over a million characters from most of the world’s writing systems.
Unicode使用可变长度编码,例如UTF-8,可以表示来自世界上大多数书写系统的一百多万个字符。
When comparing ASCII and Unicode, remember that Unicode is more flexible but requires more storage space.
比较ASCII和Unicode时,要记住Unicode更灵活,但需要更多存储空间。
7. Image Representation: Pixels and Colour Depth | 图像表示:像素与颜色深度
Digital images are made of tiny squares called pixels. The number of pixels in an image is its resolution, often measured as width × height.
数字图像由称为像素的小方块组成。图像中的像素数量称为分辨率,通常用宽×高表示。
Each pixel is stored as a binary code. The colour depth is the number of bits used per pixel. For example, 1 bit gives 2 colours, 4 bits give 16 colours, and 8 bits give 256 colours.
每个像素都以二进制代码存储。颜色深度是每个像素使用的位数。例如,1位可表示2种颜色,4位可表示16种颜色,8位可表示256种颜色。
Image file size can be calculated as:
图像文件大小可以这样计算:
File size (bits) = resolution × colour depth
For example, an image of 1024 × 768 with a 16-bit colour depth has a file size of 1024 × 768 × 16 bits = 12,582,912 bits = 1.5 MB (approximately).
例如,一幅1024×768、颜色深度为16位的图像,文件大小为1024×768×16位 = 12,582,912位,约等于1.5 MB。
8. Sound Representation: Sampling and Bit Depth | 声音表示:采样与位深度
Sound is analogue in nature, so computers convert it into digital form by sampling. Sampling is the process of measuring the amplitude of a sound wave at regular intervals.
声音在本质上是模拟的,因此计算机通过采样将其转换为数字形式。采样是每隔一定间隔测量声波振幅的过程。
The sample rate is the number of samples taken per second, measured in hertz (Hz). A higher sample rate gives more accurate sound but a larger file size.
采样率是每秒采样的次数,单位是赫兹(Hz)。采样率越高,声音越真实,但文件也越大。
The bit depth (sample resolution) is the number of bits used to store each sample. For example, 16-bit audio stores each sample as a 16-bit binary value.
位深度(采样分辨率)是存储每个样本所用的位数。例如,16位音频将每个样本存储为一个16位二进制值。
For a mono recording, the sound file size is:
对于单声道录音,声音文件大小为:
File size (bits) = sample rate × bit depth × duration (seconds)
If the recording is stereo, multiply the result by 2.
如果是立体声,则结果需要乘以2。
9. Compression: Lossless and Lossy | 压缩:无损与有损
Compression reduces file size so that files take up less storage space and are faster to transmit.
压缩可以减少文件大小,使文件占用更少的存储空间,传播速度也更快。
Lossless compression preserves all original data exactly. The original file can be perfectly reconstructed. Examples include run-length encoding (RLE) and ZIP files.
无损压缩可以精确保留所有原始数据,能够完美重建原始文件。例如游程编码(RLE)和ZIP文件。
Lossy compression permanently removes some data that is less noticeable to humans. This can reduce file size significantly but lowers quality. Examples include JPEG for images and MP3 for audio.
有损压缩会永久删除一些人类不太容易察觉的数据。这可以显著减小文件大小,但会降低质量。例如图像的JPEG格式和音频的MP3格式。
In an exam, remember that lossless is used for text and executable files where accuracy is essential, while lossy is often acceptable for multimedia files.
在考试中,要记住对文本和可执行文件等要求精确的场景使用无损压缩,而对多媒体文件通常可以接受有损压缩。
10. Exam Tips and Common Pitfalls | 考试技巧与常见陷阱
Always show your working when converting between number systems. Follow the steps from the syllabus and use the correct subscript notation.
在数制转换时,一定要写出计算过程。按照大纲中的步骤,并使用正确的下标表示法。
Do not confuse bits and bytes. Read the question carefully: a file size may be needed in bytes even when the calculation gives bits.
不要混淆位和字节。仔细读题:即使计算结果是位,题目也可能要求用字节表示文件大小。
When dealing with images and sound, check the units of resolution, colour depth, sample rate and duration before multiplying.
处理图像和声音时,在乘法计算之前,检查分辨率、颜色深度、采样率和时间单位的单位是否一致。
Remember that two’s complement overflow happens only when the result falls outside the allowed range for the fixed number of bits. Practise adding signed binary numbers and identifying overflow.
记住,只有当计算结果超出固定位数允许的范围时,二进制补码才会溢出。多练习有符号二进制数的加法并识别溢出。
Finally, learn the definitions of key terms such as pixel, resolution, sampling, bit depth, lossless and lossy. Precise definitions earn full marks.
最后,要熟记关键术语的定义,如像素、分辨率、采样、位深度、无损和有损。精确定义能帮助你获得满分。
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课程辅导,国外大学本科硕士研究生博士课程论文辅导Cancel reply