📚 IGCSE WJEC Computer Science: Worked Examples Explained | IGCSE WJEC 计算机:典型例题详解
This article provides a carefully curated set of typical exam-style questions for the WJEC IGCSE Computer Science specification, complete with detailed step-by-step solutions. Each problem targets a core topic, helping students reinforce their understanding of data representation, hardware, logic, networking, algorithms, and programming. Use these worked examples to practise your skills and build confidence before the examination.
本文为 WJEC IGCSE 计算机科学课程精选了一系列典型考题,并配有详细的逐步解答。每道题都指向一个核心知识点,帮助同学们巩固数据表示、硬件、逻辑、网络、算法和编程等内容。利用这些例题进行练习,在考前提升技能、树立信心。
1. Binary to Decimal Conversion | 二进制转十进制
Question: Convert the 8-bit binary number 10110110₂ into denary. Show your working.
题目:将 8 位二进制数 10110110₂ 转换为十进制数。写出计算过程。
Solution: Write the place values for an 8-bit binary number: 128, 64, 32, 16, 8, 4, 2, 1. Under each bit, write the corresponding value and sum where the bit is 1.
解答:写出 8 位二进制数的位值:128、64、32、16、8、4、2、1。在每一位下方写出对应的值,将位为 1 的数值相加。
-
1 × 128 = 128
1 × 128 = 128
-
0 × 64 = 0
0 × 64 = 0
-
1 × 32 = 32
1 × 32 = 32
-
1 × 16 = 16
1 × 16 = 16
-
0 × 8 = 0
0 × 8 = 0
-
1 × 4 = 4
1 × 4 = 4
-
1 × 2 = 2
1 × 2 = 2
-
0 × 1 = 0
0 × 1 = 0
Total = 128 + 32 + 16 + 4 + 2 = 182. Therefore, 10110110₂ = 182 in denary.
总和 = 128 + 32 + 16 + 4 + 2 = 182。因此,10110110₂ = 182(十进制)。
2. Hexadecimal to Denary | 十六进制转十进制
Question: The hexadecimal number 2F₃ is stored in a register. Calculate its equivalent denary value.
题目:寄存器中存储了十六进制数 2F₃。计算它对应的十进制值。
Solution: In hexadecimal, F = 15. The place values from left are 16¹ and 16⁰. So 2F₃ = (2 × 16) + (15 × 1) = 32 + 15 = 47.
解答:在十六进制中,F 表示 15。从左边起的位值分别为 16¹ 和 16⁰。因此 2F₃ = (2 × 16) + (15 × 1) = 32 + 15 = 47。
Thus, 2F₃ is equal to 47 in denary.
因此,2F₃ 等于十进制数 47。
3. Binary Addition | 二进制加法
Question: Perform the binary addition of 1101₂ and 1011₂. Show all carries and verify your answer by converting to denary.
题目:计算 1101₂ 与 1011₂ 的二进制加法。列出所有进位步骤,并通过转换为十进制进行验证。
Solution: Write the numbers aligned to the right:
解答:将两个数右对齐写下:
1101
+ 1011
——-
11000
Working from rightmost bit: 1+1 = 0 carry 1; 0+1+carry1 = 0 carry 1; 1+0+carry1 = 0 carry 1; 1+1+carry1 = 1 carry 1; final carry gives a new leftmost bit. Result: 11000₂.
从最右位开始:1+1=0 进位1;0+1+进位1=0 进位1;1+0+进位1=0 进位1;1+1+进位1=1 进位1;最后的进位产生新的最左位。结果:11000₂。
Verification: 1101₂ = 13, 1011₂ = 11, 13+11=24; 11000₂ = 16+8=24. Correct.
验证:1101₂ = 13,1011₂ = 11,13+11=24;11000₂ = 16+8=24。正确。
4. Logic Gate Truth Table | 逻辑门真值表
Question: Draw the truth table for the logic circuit: Q = (A AND B) OR (NOT C). Assume three inputs A, B, C.
题目:绘制逻辑电路 Q = (A AND B) OR (NOT C) 的真值表。假设有三个输入 A、B、C。
Solution: The truth table must list all 8 combinations of inputs. Intermediates: D = A AND B, E = NOT C, then Q = D OR E.
解答:真值表需列出全部 8 种输入组合。中间值:D = A AND B,E = NOT C,然后 Q = D OR E。
| A | B | C | A AND B | NOT C | Q |
|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 1 | 1 |
| 0 | 0 | 1 | 0 | 0 | 0 |
| 0 | 1 | 0 | 0 | 1 | 1 |
| 0 | 1 | 1 | 0 | 0 | 0 |
| 1 | 0 | 0 | 0 | 1 | 1 |
| 1 | 0 | 1 | 0 | 0 | 0 |
| 1 | 1 | 0 | 1 | 1 | 1 |
| 1 | 1 | 1 | 1 | 0 | 1 |
This table shows Q is high for input combinations where either C is low or both A and B are high.
该真值表显示,当 C 为低电平或 A 和 B 同时为高电平时,Q 输出高电平。
5. CPU Components and Fetch-Decode-Execute | CPU 组件与取指-译码-执行周期
Question: Describe the role of the Program Counter (PC) and Memory Address Register (MAR) during the fetch stage of the instruction cycle.
题目:描述程序计数器 (PC) 和内存地址寄存器 (MAR) 在指令周期取指阶段的作用。
Answer: At the start of the fetch stage, the Program Counter holds the address of the next instruction to be fetched. This address is copied into the Memory Address Register (MAR). The MAR then sends this address to memory via the address bus. After the instruction is fetched, the PC is incremented to point to the next instruction.
解答:取指阶段开始时,程序计数器 (PC) 存放下一条待取指令的地址。该地址被复制到内存地址寄存器 (MAR) 中。MAR 随后通过地址总线将该地址发送至内存。指令取出后,PC 增加以指向下一条指令。
Together, the PC ensures the correct sequence of instructions, and the MAR provides the physical address for memory access.
两者协同工作,PC 确保指令的正确顺序,而 MAR 为内存访问提供物理地址。
6. Network Protocols – TCP/IP and HTTP | 网络协议 – TCP/IP 与 HTTP
Question: Explain the difference between HTTP and TCP in the context of accessing a web page.
题目:在访问网页的背景下,解释 HTTP 和 TCP 之间的区别。
Solution: HTTP (HyperText Transfer Protocol) is an application-layer protocol that defines how web browsers and servers exchange requests and responses (e.g., GET, POST). TCP (Transmission Control Protocol) operates at the transport layer, ensuring reliable delivery of data packets between devices, handling error checking, flow control, and correct sequencing.
解答:HTTP(超文本传输协议)是一种应用层协议,定义了网页浏览器与服务器之间如何交换请求与响应(如 GET、POST)。TCP(传输控制协议)工作在传输层,确保设备之间数据包可靠传输,负责错误检测、流量控制和正确排序。
In short, HTTP handles the ‘what’ of the communication, while TCP handles the ‘how’ – making sure bits arrive without corruption and in order.
简而言之,HTTP 处理通信的“内容”,而 TCP 处理通信的“方式”——确保比特无差错、按序到达。
7. Network Security – Denial of Service | 网络安全 – 拒绝服务攻击
Question: Describe how a Distributed Denial of Service (DDoS) attack works and suggest one mitigation technique.
题目:描述分布式拒绝服务 (DDoS) 攻击的工作原理,并给出一种防御措施。
Solution: In a DDoS attack, an attacker uses a botnet – a network of compromised devices – to flood a target server with an overwhelming volume of requests. This exhausts the server’s resources (bandwidth, CPU, memory), so legitimate users cannot access the service.
解答:在 DDoS 攻击中,攻击者利用僵尸网络——即由被入侵设备组成的网络——向目标服务器发送数量巨大的请求。这会耗尽服务器的资源(带宽、CPU、内存),导致合法用户无法访问服务。
Mitigation technique: Use a firewall to filter traffic or employ a cloud-based traffic scrubbing service that absorbs and filters malicious traffic before it reaches the server.
防御措施:使用防火墙过滤流量,或采用基于云的流量清洗服务,在恶意流量到达服务器之前将其吸收并过滤。
8. Linear Search Algorithm | 线性搜索算法
Question: Write an algorithm, using pseudocode, to perform a linear search on an array names[5] for a target value searchItem. The algorithm should output the index if found or ‘Not found’ otherwise.
题目:用伪代码编写一个算法,在数组 names[5] 中对目标值 searchItem 进行线性搜索。如果找到,则输出索引;否则输出“Not found”。
Solution:
解答:
INPUT searchItem
SET index ← 0
SET found ← FALSE
WHILE index < 5 AND found = FALSE
IF names[index] = searchItem THEN
SET found ← TRUE
ELSE
SET index ← index + 1
ENDIF
ENDWHILE
IF found = TRUE THEN
OUTPUT index
ELSE
OUTPUT ‘Not found’
ENDIF
This iterates through each element sequentially, updating the index until either a match is found or the array ends.
该算法依次检查每个元素,更新索引,直到找到匹配或遍历完整个数组。
9. Data Storage – File Size Calculation | 数据存储 – 文件大小计算
Question: A colour image has a resolution of 1024 × 768 pixels and uses 24 bits per pixel. Calculate the uncompressed file size in megabytes (MB). State your answer to two decimal places. (1 MB = 1024 × 1024 bytes)
题目:一幅彩色图像的分辨率为 1024×768 像素,每个像素使用 24 位。计算未压缩文件的大小,结果以兆字节(MB)为单位,保留两位小数。(1 MB = 1024×1024 字节)
Solution: Total bits = 1024 × 768 × 24 = 18,874,368 bits. Convert bits to bytes: divide by 8 → 2,359,296 bytes. Convert bytes to MB: divide by (1024 × 1024) = 1,048,576 → 2,359,296 / 1,048,576 ≈ 2.25 MB.
解答:总位数 = 1024 × 768 × 24 = 18,874,368 位。将位转换为字节:除以 8 → 2,359,296 字节。字节转换为 MB:除以 (1024 × 1024) = 1,048,576 → 2,359,296 / 1,048,576 ≈ 2.25 MB。
Uncompressed file size is approximately 2.25 MB.
未压缩文件大小约为 2.25 MB。
10. Pseudocode – Looping and Counting | 伪代码 – 循环与计数
Question: The following pseudocode is intended to count how many numbers in an array values of length 10 are greater than 50. Complete the missing parts.
题目:以下伪代码旨在统计长度为 10 的数组 values 中有多少个数字大于 50。请补全缺失的部分。
count ← 0
FOR i ← 0 TO 9
IF values[i] > 50 THEN
__________
ENDIF
NEXT i
OUTPUT count
Answer: The missing line should increment the counter: count ← count + 1.
答案:缺失的一行代码应为计数器递增:count ← count + 1。
This loop iterates through indices 0 to 9, checks each element, and increases the count whenever the condition is true. Finally, it outputs the total number of values exceeding 50.
该循环遍历索引 0 到 9,检查每个元素,每当条件为真时增加计数值。最后,输出大于 50 的值的总数。
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课程辅导,国外大学本科硕士研究生博士课程论文辅导