📚 GCSE WJEC Computer Science: Typical Example Questions Explained in Detail | GCSE WJEC 计算机科学:典型例题详解
WJEC GCSE Computer Science challenges students with a mix of theoretical understanding and practical computational thinking. This article walks through typical exam-style questions, providing step-by-step solutions and explanations to help you master core concepts.
WJEC 的 GCSE 计算机科学考试要求学生兼顾理论理解与实际计算思维。本文逐一讲解典型考题,提供分步详解与解析,帮助你掌握核心知识。
1. Binary Arithmetic | 二进制算术
In Unit 1, you must be confident in binary addition and two's complement subtraction. A common exam task involves adding 8-bit binary numbers and detecting overflow.
在 Unit 1 中,你必须熟练掌握二进制加法与二进制补码减法。考试中常见的任务是对 8 位二进制数进行加法运算并判断是否溢出。
Example 1: Add the 8-bit numbers 01001101₂ and 00111010₂. Show carry bits and state whether an overflow occurs.
例题 1:将 8 位二进制数 01001101₂ 与 00111010₂ 相加。写出进位过程,并说明是否发生溢出。
he result is 10000111₂. There is no overflow because the sum of two positive numbers (01001101 is +77, 00111010 is +58) yields 135, which fits within -128 to 127 in 8-bit two's complement? Wait: these are unsigned or two's complement? arry into and out of the most significant bit: here carry into MSB is 0 and carry out is 0 – no overflow.
解答:从最低有效位(最右侧)开始。1+0 = 1(进位 0)。下一列:0+1 = 1(进位 0)。1+0 = 1(进位 0)。1+1 = 0 进位 1。0+1+进位 1 = 0 进位 1。0+1+进位 1 = 0 进位 1。1+0+进位 1 = 0 进位 1。最后 0+0+进位 1 = 1。结果为 10000111₂。判断溢出:若看作有符号数,最高位的进位输入为 0,进位输出为 0,两者相同,无溢出。若看作无符号整数,135 未超过 255,同样无溢出。
Example 2: Represent the decimal number -18 in 8-bit two's complement.
例题 2:用 8 位二进制补码表示十进制数 -18。
Solution: Write +18 in binary: 00010010₂. Invert bits: 11101101₂. Add 1: 11101110₂. This is the two's complement representation of -18.
解答:先写出 +18 的二进制形式:00010010₂。将所有位取反:11101101₂。再加 1,得到 11101110₂。这就是 -18 的 8 位二进制补码表示。
To subtract using two's complement, simply add the complement. For example, 45 - 18 becomes 45 + (-18). This method is regularly tested.
用补码做减法时,只需将减数转为补码后相加。例如 45 - 18 即为 45 + (-18)。这种方法在考试中时常出现。
2. Logic Gates and Truth Tables | 逻辑门与真值表
WJEC expects you to analyse combinational logic circuits. A typical question gives a diagram described in words and asks for the Boolean expression and truth table.
WJEC 要求考生能分析组合逻辑电路。典型题目会以文字描述电路,要求写出布尔表达式并填写真值表。
Example: A circuit has inputs A, B and C. Gate 1 is an AND gate receiving A and B. Gate 2 is an OR gate receiving the output of Gate 1 together with C. Write the expression for the overall output Q, and complete its truth table.
例题:某电路有输入 A、B、C。门 1 是与门,输入为 A 和 B;门 2 是或门,其输入为门 1 的输出以及 C。写出总输出 Q 的表达式,并完成真值表。
Expression: Q = (A AND B) OR C, often written as Q = (A.B) + C.
表达式:Q = (A AND B) OR C,常写作 Q = (A · B) + C。
Truth table:
| A | B | C | A AND B | Q |
|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 0 | 1 |
| 0 | 1 | 0 | 0 | 0 |
| 0 | 1 | 1 | 0 | 1 |
| 1 | 0 | 0 | 0 | 0 |
| 1 | 0 | 1 | 0 | 1 |
| 1 | 1 | 0 | 1 | 1 |
| 1 | 1 | 1 | 1 | 1 |
Always label intermediate columns to show working. This helps secure method marks even if the final column has an error.
务必为中间列加上标签,展示分析过程。即便最终列出现错误,这也有助于获得方法分。
3. Trace Tables in Pseudocode | 伪代码跟踪表
Tracking variable values through pseudocode is a key skill for Unit 2. You are often given a loop and asked to complete a trace table.
通过伪代码追踪变量值是 Unit 2 的关键技能。考试常给出一个循环,要求你完成跟踪表。
Example: Study the following pseudocode and complete the trace table for total and i.
例题:阅读以下伪代码,并完成变量 total 和 i 的跟踪表。
total ← 0
FOR i ← 1 TO 5
total ← total + i * 2
ENDFOR
OUTPUT total
Trace table – fill in the values after each iteration:
| Iteration | i | total |
|---|---|---|
| initial | – | 0 |
| 1 | 1 | 2 |
| 2 | 2 | 6 |
| 3 | 3 | 12 |
| 4 | 4 | 20 |
| 5 | 5 | 30 |
The final output is 30. Trace tables test careful sequencing and help diagnose logic errors in your own code.
最终输出为 30。跟踪表考查严谨的顺序思维,也有助于在你自己编写的代码中诊断逻辑错误。
When the loop uses condition-controlled logic (WHILE, REPEAT), be extra careful to note when the condition fails so that the loop exits correctly.
当循环采用条件控制(WHILE、REPEAT)时,要特别注意条件为假的那一刻,以便循环能正确退出。
4. Sorting Algorithms: Bubble Sort Example | 排序算法:冒泡排序例题
Bubble sort is a standard GCSE algorithm. You may be asked to show the state of the array after each pass or to identify how many passes are needed.
冒泡排序是 GCSE 的标准算法。你可能需要展示每趟排序后的数组状态,或判断总共需要多少趟排序。
Example: Apply the bubble sort algorithm to the array [5, 2, 8, 1, 3]. Show the array after each complete pass and indicate when no swaps occur.
例题:对数组 [5, 2, 8, 1, 3] 应用冒泡排序算法。展示每完整一趟之后的数组,并标明何时没有发生交换。
,8,1,3]; 5<8 → no swap; 8>1 → swap → [2,5,1,8,3]; 8>3 → swap → [2,5,1,3,8]. End of pass 1.
第 1 趟:比较并依需交换。5>2 → 交换 → [2,5,8,1,3];5<8 → 不交换;8>1 → 交换 → [2,5,1,8,3];8>3 → 交换 → [2,5,1,3,8]。第 1 趟结束。
5>1 swap → [2,1,5,3,8]; 5>3 swap → [2,1,3,5,8]; 5<8 no swap → [2,1,3,5,8]. Swaps occurred.
第 2 趟:[2,5,1,3,8] → 2<5 不交换;5>1 交换 → [2,1,5,3,8];5>3 交换 → [2,1,3,5,8];5<8 不交换 → [2,1,3,5,8]。发生了交换。
3,5,8]; rest in order, no swaps. Pass 4 would have no swaps, so algorithm terminates early. Sorted after 3 passes.
第 3 趟:[
Published by TutorHao | GCSE Computer Science Revision Series | aleveler.com
更多咨询请联系16621398022(同微信)

或截图后用「扫一扫 → 相册」选择本图