A-Level WJEC Computer Science: Data Representation Key Points | A-Level WJEC 计算机:数据表示 考点精讲

📚 A-Level WJEC Computer Science: Data Representation Key Points | A-Level WJEC 计算机:数据表示 考点精讲

Data representation is a foundational topic in WJEC A-Level Computer Science, exploring how computers encode numbers, text, images, and sound using binary. Mastering this area means understanding number bases, binary arithmetic, negative numbers, character sets, multimedia storage, and compression methods. This revision guide distills the essential concepts, typical exam questions, and the precise notation expected by WJEC examiners.

数据表示是 WJEC A-Level 计算机科学的基础主题,探讨计算机如何用二进制编码数字、文本、图像和声音。掌握该领域需要理解数制、二进制算术、负数、字符集、多媒体存储以及压缩方法。本文提炼了核心概念、典型考题以及 WJEC 考官期望的精确记法。

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

Computers use binary (base 2) while humans often work in denary (base 10) and hexadecimal (base 16). A binary digit (bit) is a 1 or 0; a nibble is 4 bits, a byte is 8 bits. Conversions between bases are routine in WJEC exams.

计算机使用二进制(基数为 2),而人类常用十进制(基数为 10)和十六进制(基数为 16)。一个二进制位(bit)取 1 或 0;半字节为 4 位,一字节为 8 位。基数之间的转换在 WJEC 考试中是常规题型。

To convert binary to hexadecimal, group bits in fours from the right, then replace each group with a hex digit (0–9, A–F). For denary to binary, repeatedly divide by 2 and record remainders; for binary to denary, sum the column weights (powers of 2) where 1 appears.

将二进制转换为十六进制时,从右侧开始每四位一组,然后用十六进制数字(0–9, A–F)替换每组。十进制转二进制采用除 2 取余法;二进制转十进制则对出现 1 的位赋予相应的权值(2 的幂)并求和。

Example: binary 1011 1100 becomes hex BC. Denary 200 = binary 1100 1000.

示例:二进制 1011 1100 对应十六进制 BC。十进制 200 = 二进制 1100 1000

Binary Hex Denary
1111 F 15

2. Binary Addition and Overflow | 二进制加法与溢出

Binary addition follows simple rules: 0+0=0, 0+1=1, 1+0=1, and 1+1=0 with a carry of 1 into the next column. Carry propagation often leads to overflow errors when the result exceeds the allocated bits.

二进制加法遵循简单规则:0+0=0,0+1=1,1+0=1,1+1=0 并产生向下一列的进位 1。进位传播常导致结果超出分配位数而产生溢出错误。

Overflow occurs when a sum cannot be stored in the given number of bits. For example, adding two 8-bit signed integers might produce a 9-bit result. In unsigned addition, a carry out of the most significant bit signals overflow.

当和无法用给定位数存储时发生溢出。例如,两个 8 位有符号整数相加可能产生 9 位结果。在无符号加法中,最高位有进位即表示溢出。

WJEC may ask you to add binary numbers and detect overflow or to explain why overflow occurs in two’s complement arithmetic.

WJEC 可能会要求你进行二进制加法并检测溢出,或者解释补码算术中为何会发生溢出。


3. Representing Negative Numbers | 负数表示

WJEC expects knowledge of two methods: sign‐and‐magnitude and two’s complement. In sign‐and‐magnitude, the leftmost bit indicates sign (0 for positive, 1 for negative) and the remaining bits give the magnitude. This method has two zeros and complicates arithmetic.

WJEC 要求掌握两种表示方法:原码(符号-数值形式)和补码。在原码中,最左位为符号位(0 表示正,1 表示负),其余位表示真值。该方法存在 +0 和 -0 两个零,且使算术复杂化。

Two’s complement is the standard because subtraction becomes addition of a negative number. To obtain the two’s complement of a positive number, invert all bits (one’s complement) and then add 1. For an 8-bit system, the range is –128 to +127.

补码是标准表示法,因为减法可转化为加一个负数。为获得一个正数的补码,将所有位取反(反码)然后加 1。在 8 位系统中,表示范围为 –128 到 +127。

Two’s complement = (Invert all bits) + 1

补码 = (按位取反) + 1


4. Two’s Complement in Depth | 补码深入

A key exam skill is converting a two’s complement negative binary number to denary. Reverse the process: subtract 1, then invert all bits, and compute the positive denary value, then apply a negative sign. Alternatively, assign the most significant bit a negative weight (–2ⁿ⁻¹) and add the positive weights of other bits.

关键考试技能是将补码负二进制数转换为十进制。逆向过程:先减 1,再按位取反,得到正值后加负号。或者,赋予最高位负权值 (–2ⁿ⁻¹),并将其他位的正权值相加。

WJEC markers expect clear working. For instance, 8-bit 11110110 represents denary –10. Show the steps: invert to 00001001, add 1 => 00001010 (10), so negative 10.

WJEC 评分官期望清晰的步骤。例如,8 位 11110110 表示十进制 –10。展示步骤:取反为 00001001,加 1 得 00001010(10),所以是 –10。

Arithmetic in two’s complement: add normally, ignoring any carry out of the MSB. Overflow detection uses the sign bits: if the operands have the same sign but the result’s sign is different, overflow has occurred.

补码算术:正常相加,忽略最高位的进位。溢出检测利用符号位:若操作数符号相同而结果的符号不同,则发生溢出。


5. Floating Point Representation | 浮点数表示

Real numbers are stored in floating-point format, comprising a mantissa and an exponent. WJEC typically uses a standard format such as 8-bit mantissa and 4-bit exponent with both in two’s complement. The number = mantissa × 2exponent.

实数以浮点格式存储,包含尾数和阶码。WJEC 通常使用标准格式,例如 8 位尾数和 4 位阶码,两者均采用补码。数值 = 尾数 × 2阶码

Normalisation ensures maximum precision: a positive normalised mantissa starts 0.1, negative starts 1.0. You must be able to normalise a binary floating-point number by shifting the mantissa left and decreasing the exponent, or shifting right and increasing the exponent.

规格化可确保最大精度:正规格化尾数以 0.1 开头,负数以 1.0 开头。你必须能够通过左移尾数并减小阶码,或右移尾数并增大阶码来规格化一个二进制浮点数。

Value = mantissa × 2exponent

值 = 尾数 × 2阶码

Range and precision trade-off: a larger mantissa gives more precision; a larger exponent gives wider range. WJEC exam questions may ask you to represent a denary fraction in binary floating-point and normalise it.

范围与精度权衡:尾数越大精度越高;阶码越大表示范围越广。WJEC 考题可能要求你将十进制小数表示为二进制浮点数并规格化。


6. Character Encoding: ASCII and Unicode | 字符编码:ASCII 与 Unicode

ASCII uses 7 bits to encode 128 characters (0–127), including English letters, digits, and control codes. Extended ASCII uses 8 bits for 256 characters, covering some European accented letters. ASCII is simple and compact but limited to a small character set.

ASCII 用 7 位编码 128 个字符(0–127),包括英文字母、数字和控制码。扩展 ASCII 用 8 位表示 256 个字符,涵盖一些欧洲重音字母。ASCII 简单紧凑,但字符集有限。

Unicode provides a unique number for every character across all languages and symbols. Common Unicode Transformation Formats (UTF) include UTF-8, UTF-16, and UTF-32. UTF-8 uses 1–4 bytes per character and is backward compatible with ASCII. Unicode requires more storage but enables global text exchange.

Unicode 为所有语言的每个字符和符号分配唯一编号。常见的 Unicode 转换格式(UTF)包括 UTF-8、UTF-16 和 UTF-32。UTF-8 每字符使用 1–4 字节并与 ASCII 向后兼容。Unicode 需要更多存储空间,但实现了全球文本交换。

For WJEC, you should know the advantages and disadvantages of each and be able to discuss the need for international character sets.

对于 WJEC,你应该了解每种编码的优缺点,并能讨论国际化字符集的必要性。


7. Bitmap Images | 位图图像

A bitmap image is a grid of pixels, each assigned a binary value according to its colour. Resolution is the number of pixels per unit (often dpi). Colour depth (bit depth) is the number of bits used to store the colour of each pixel. A higher colour depth gives more colours but larger file size.

位图图像是一个像素网格,每个像素根据其颜色赋予一个二进制值。分辨率指每单位像素数(通常为 dpi)。色彩深度(位深度)是存储每个像素颜色所用的位数。色彩深度越高,颜色越丰富,但文件大小越大。

File size in bytes = image width (px) × image height (px) × colour depth (bpp) / 8. Metadata (e.g., width, height, palette) adds extra bytes.

文件大小(字节)= 图像宽度(px)× 图像高度(px)× 色彩深度(bpp)/ 8。元数据(如宽度、高度、调色板)会增加额外字节。

Bitmap file size = (pixels wide × pixels high × bits per pixel) / 8

位图文件大小 = (像素宽度 × 像素高度 × 每像素位数)/ 8

When resampling, increasing resolution without adding data creates pixelation. WJEC tasks often involve calculating file sizes, identifying the effect of colour depth on quality, and explaining why bitmap images become blurred when enlarged.

重新采样时,若增加分辨率而不增加数据,会产生锯齿现象。WJEC 的任务通常包括计算文件大小、识别色彩深度对质量的影响,并解释为何位图图像放大后会模糊。


8. Vector Graphics | 矢量图形

Vector graphics store images as mathematical descriptions of objects and properties such as lines, curves (Bezier), circles, and fill colours. They are resolution-independent and scale without loss of quality, making them ideal for logos, fonts, and technical drawings.

矢量图形以数学描述存储图像对象及其属性,如线段、曲线(贝塞尔曲线)、圆形和填充颜色。它们与分辨率无关,缩放时不损失质量,因此适合于标志、字体和技术绘图。

File sizes are generally smaller than equivalent bitmaps for geometric shapes, but become large when objects are numerous or highly complex. Editing involves changing object parameters rather than altering individual pixels.

对于几何形状,矢量文件通常比等效的位图小,但当对象数量巨大或高度复杂时,文件可能变大。编辑矢量图形是修改对象参数,而非改变单个像素。

For WJEC, you must compare bitmap and vector representations, discuss when each is appropriate, and interpret simple SVG-style descriptors.

对于 WJEC,你必须比较位图和矢量表示,讨论各自适用场景,并解读简单的 SVG 风格描述符。


9. Sound Representation | 声音表示

Sound is analogue; to store it digitally, the sound wave is sampled at regular intervals. Sampling rate (Hz) is the number of samples taken per second. Bit depth is the number of bits per sample. Higher sampling rates and bit depths capture sound more accurately but increase file size.

声音是模拟信号;数字化存储时,需以固定间隔对声波采样。采样率(Hz)是每秒采集的样本数。位深度是每个样本的位数。较高的采样率和位深度能更精确地捕获声音,但会增大文件大小。

According to the Nyquist theorem, the sampling rate must be at least twice the highest frequency in the signal to avoid aliasing. CD-quality audio uses 44.1 kHz sampling and 16-bit depth per channel (stereo).

根据奈奎斯特定理,采样率必须至少为信号最高频率的两倍以避免失真。CD 音质使用 44.1 kHz 采样率,每声道 16 位深度(立体声)。

Sound file size = sampling rate × bit depth × duration (s) × channels / 8 (bytes)

声音文件大小 = 采样率 × 位深度 × 时长(秒) × 声道数 / 8(字节)

WJEC questions may ask you to calculate sound file size or explain the effect of reducing sampling rate and bit depth on quality and storage.

WJEC 考试可能会要求你计算声音文件大小,或解释降低采样率和位深度对音质和存储的影响。


10. Data Compression Basics | 数据压缩基础

Compression reduces the number of bits needed to represent data. Lossless compression preserves all original data (e.g., run-length encoding, Huffman coding, dictionary methods). Lossy compression discards non-critical information (e.g., JPEG, MP3) to achieve much smaller files at the cost of some quality.

压缩可减少表示数据所需的位数。无损压缩保留所有原始数据(如游程编码、霍夫曼编码、字典方法)。有损压缩丢弃非关键信息(如 JPEG、MP3),以牺牲部分质量为代价获得更小的文件。

Run-length encoding (RLE) replaces repeated symbols with a count-and-symbol pair, effective for simple graphic files with large areas of identical colour. Huffman coding uses variable-length codes where frequently occurring symbols get shorter bit patterns.

游程编码(RLE)用计数-符号对替换重复符号,适用于有大面积相同颜色的简单图像文件。霍夫曼编码采用变长编码,出现频率高的符号使用较短的位模式。

WJEC expects you to apply RLE to a simple data sequence, calculate compression ratios, and discuss whether lossy or lossless is suitable for a given scenario (e.g., text vs. photographs).

WJEC 期望你能将 RLE 应用于简单数据序列,计算压缩比,并讨论对于给定场景(如文本与照片)适合有损还是无损压缩。


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