📚 Year 11 Cambridge Computer Science Practical Exam Tips | 剑桥计算机科学实践考核要点
Cambridge IGCSE Computer Science (0478) includes a practical programming paper where you must design, code, test and debug solutions to given problems. This exam tests your ability to apply computational thinking in a hands‑on way. A clear strategy for writing pseudocode, selecting data structures, handling files and validating input will help you achieve top marks. This guide summarises the essential techniques and common pitfalls, so you can walk into the exam room feeling confident and well‑prepared.
剑桥 IGCSE 计算机科学(0478)包含实践编程试卷,要求你针对给定问题设计、编写、测试和调试解决方案。这项考试以动手操作的方式考查你的计算思维应用能力。只要掌握清晰的策略来编写伪代码、选择数据结构、处理文件和验证输入,你就能获得高分。本指南总结了必备的技巧和常见陷阱,帮助你自信满满地走进考场。
1. Understanding the Practical Assessment | 理解实践评估形式
The practical paper usually presents two or three problem scenarios. You will be asked to write algorithms in pseudocode, draw flowcharts, write program code (often in a high‑level language like Python, Java or Visual Basic, but in the exam you mainly write pseudocode) and produce test plans. Marks are awarded for correct logic, appropriate use of control structures, efficient algorithms, complete documentation and thorough testing. Read each question carefully to identify exactly what is being asked: sometimes you need to write a function, sometimes a full program that reads from a file and writes to another.
实践试卷通常会给出两到三个问题情境。你需要用伪代码编写算法、绘制流程图、编写程序代码(虽然平时会用 Python、Java 或 Visual Basic 等高级语言,但考试中主要编写伪代码)并制定测试计划。评分标准涵盖正确的逻辑、控制结构的恰当使用、高效的算法、完整的文档以及周密的测试。仔细阅读每道题目,明确要求:有时需要编写一个函数,有时则需要编写一个从文件读取并写入另一个文件的完整程序。
- Check if the task requires a procedure, function or a whole program.
- Look for keywords such as 'validate', 'search', 'sort', 'calculate total', 'output to file'.
- 确认任务是要求编写过程、函数还是完整程序。
- 留意题目中的关键词,例如“验证”“搜索”“排序”“计算总和”“输出到文件”。
2. Mastering Pseudocode and Flowcharts | 掌握伪代码与流程图
The Cambridge syllabus provides a standard pseudocode syntax that you should use consistently. It includes INPUT, OUTPUT, IF … THEN … ELSE … ENDIF, CASE … OTHERWISE … ENDCASE, FOR … TO … NEXT, WHILE … DO … ENDWHILE, REPEAT … UNTIL. Use meaningful variable names and keep indentation clear. Flowcharts use standard symbols: oval for Start/End, parallelogram for Input/Output, rectangle for process, diamond for decision. Practice converting a problem description into a flowchart first, then into pseudocode; this helps you visualise the logic before writing detailed instructions.
剑桥大纲提供了一套标准的伪代码语法,你应该始终使用这套语法。其中包括 INPUT、OUTPUT、IF … THEN … ELSE … ENDIF、CASE … OTHERWISE … ENDCASE、FOR … TO … NEXT、WHILE … DO … ENDWHILE、REPEAT … UNTIL。使用有意义的变量名并保持清晰的缩进。流程图使用标准符号:椭圆形表示开始/结束,平行四边形表示输入/输出,长方形表示处理步骤,菱形表示判断。练习先将问题描述转换为流程图,再转换为伪代码;这有助于你在编写详细指令前直观地梳理逻辑。
- Always use the exact keywords specified in the syllabus.
- Comment your pseudocode to explain the purpose of each section.
- 务必使用大纲中指定的确切关键字。
- 为伪代码添加注释,解释每一部分的目的。
3. Algorithm Design Thinking | 算法设计思维
Before writing any code, break the problem into smaller, manageable parts using stepwise refinement. Identify the inputs, processes and outputs (IPO). Think about the obvious solution first, then ask yourself if it can be made more efficient. For searching, decide between linear search and binary search depending on whether the data is sorted. For sorting, bubble sort or insertion sort may be requested. Always state any assumptions you make, for example 'the list contains at least one element' or 'the file exists'.
在动手编写任何代码之前,使用逐步求精的方法将问题分解成更小、更容易管理的部分。明确输入、处理和输出(IPO)。先思考最简单的解决方案,然后问问自己能否让它更高效。对于搜索,根据数据是否有序决定使用线性搜索还是二分搜索。对于排序,可能会要求使用冒泡排序或插入排序。一定要说明你所作的任何假设,例如“列表中至少包含一个元素”或“文件存在”。
IPO model: Input → Process → Output
IPO 模型:输入 → 处理 → 输出
4. Variable Naming and Data Types | 变量命名与数据类型
Choose descriptive names like 'totalScore', 'customerName' or 'isValid'. Cambridge pseudocode recognises data types: INTEGER, REAL, CHAR, STRING, BOOLEAN. Declare variables at the start using DECLARE statements, e.g. DECLARE score : INTEGER. This shows the examiner you have thought about the kind of data each variable will hold. Avoid using single letters except for loop counters like i, j. If a variable needs to store a decimal number, make it REAL; if it is a flag, use BOOLEAN and assign TRUE or FALSE.
选择描述性名称,如 'totalScore'、'customerName' 或 'isValid'。剑桥伪代码可识别的数据类型有:INTEGER、REAL、CHAR、STRING、BOOLEAN。在开头使用 DECLARE 语句声明变量,例如 DECLARE score : INTEGER。这向考官表明你已经考虑过每个变量将要保存的数据种类。除非用于循环计数器如 i、j,否则避免使用单字母变量名。如果某个变量需要存储小数,就使用 REAL;如果是标志,则使用 BOOLEAN 并赋值为 TRUE 或 FALSE。
| Data Type | Example Declaration | Used For |
|---|---|---|
| INTEGER | DECLARE count : INTEGER | Whole numbers |
| REAL | DECLARE price : REAL | Numbers with decimal part |
| STRING | DECLARE name : STRING | Text |
| CHAR | DECLARE grade : CHAR | Single character |
| BOOLEAN | DECLARE found : BOOLEAN | True/False flags |
5. Control Structures: Sequence, Selection, Iteration | 控制结构:顺序、选择、迭代
Every algorithm is built from three basic structures. Sequence means executing statements one after another. Selection uses IF, CASE statements to branch. Iteration repeats a block of code. In Cambridge pseudocode, three looping constructs are available: FOR (count‑controlled), WHILE (pre‑condition) and REPEAT…UNTIL (post‑condition). Choose the most suitable loop for the task. A FOR loop is ideal when you know exactly how many iterations are needed, for example processing each element of an array. A WHILE loop is safer when the number of iterations depends on a condition, such as reading records until end of file. REPEAT…UNTIL guarantees the body runs at least once.
每一种算法都由三种基本结构构成。顺序指按顺序执行多条语句。选择使用 IF、CASE 语句进行分支。迭代则重复执行一段代码。在剑桥伪代码中,有三种循环结构可以使用:FOR(计数控制循环)、WHILE(前置条件循环)和 REPEAT…UNTIL(后置条件循环)。要根据任务选择最合适的循环。当确知需要多少次迭代时,用 FOR 循环最理想,比如处理数组中的每个元素。当迭代次数取决于某个条件时,用 WHILE 循环更安全,例如读取记录直到文件末尾。REPEAT…UNTIL 则保证循环体至少执行一次。
- Always indent the body of a loop or conditional block.
- Ensure a WHILE loop eventually makes the condition false to avoid infinite loops.
- 循环体或条件语句块一定要缩进。
- 确保 WHILE 循环最终能使条件变为假,以避免无限循环。
6. Working with Arrays and Lists | 数组和列表的使用
Arrays store multiple values under one name. Cambridge pseudocode uses DECLARE arrayName : ARRAY[1:10] OF INTEGER to declare a 10‑element integer array. You can also use 0‑based indexing if stated. Access elements using arrayName[index]. Common operations: initialising, reading values into an array, printing all elements, finding maximum/minimum, linear search, counting occurrences. When reading from a file, sometimes you need to count how many records exist before declaring an array, or you can use a dynamic data structure like a list if your pseudocode dialect supports it; otherwise, assume a maximum size.
数组用来在一个名称下存储多个值。剑桥伪代码使用 DECLARE arrayName : ARRAY[1:10] OF INTEGER 来声明一个含有 10 个元素的整数数组。如果题目说明,也可以使用从 0 开始的索引。通过 arrayName[index] 访问元素。常见操作包括:初始化、将数值读入数组、打印所有元素、查找最大值/最小值、线性搜索、统计出现次数。当从文件读取数据时,有时需要先统计有多少条记录再声明数组,或者如果你的伪代码方言支持动态数据结构(如列表),也可以使用;否则就假设一个最大容量。
Example: DECLARE studentMarks : ARRAY[1:30] OF INTEGER
示例:DECLARE studentMarks : ARRAY[1:30] OF INTEGER
7. String Manipulation Techniques | 字符串处理技巧
ch as LENGTH(str), SUBSTRING(str, start, length), LEFT(str, n), RIGHT(str, n), TO_UPPER(str), TO_LOWER(str) and concatenation using &. Learn how to use these to solve problems like checking if an email address contains '@' e and first two letters of a given name. Always store the result in a new STRING variable.
很多实践任务都要求截取字符串的某一部分、计算字符数量或转换大小写。剑桥伪代码提供了 LENGTH(str)、SUBSTRING(str, start, length)、LEFT(str, n)、RIGHT(str, n)、TO_UPPER(str)、TO_LOWER(str) 等函数,以及用 & 进行连接。学习如何使用这些函数来解决诸如检查电子邮箱地址是否包含“@”,或者用姓氏的前三个字母和名字的前两个字母创建用户名等问题。记得总是将结果存储在一个新的 STRING 变量中。
- SUBSTRING(identifier, 4, 2) extracts two characters starting at position 4.
- Remember: string indices often start at 1 in pseudocode examples.
- SUBSTRING(identifier, 4, 2) 从第 4 位开始提取两个字符。
- 记住:在伪代码示例中,字符串索引通常从 1 开始。
8. File Handling Operations | 文件操作
File handling appears in many Cambridge practical questions. You need to know READFILE, WRITEFILE and APPENDFILE. The typical pattern: OPENFILE "filename.txt" FOR READ, then use READFILE "filename.txt", variable until EOF. After processing, close the file. For writing, OPENFILE "output.txt" FOR WRITE, then WRITEFILE "output.txt", data and finally close. APPENDFILE adds data to the end of an existing file. Always check whether a file exists before reading, and handle cases where the file might not be available. In pseudocode, you can use structures like WHILE NOT EOF("filename.txt") DO.
文件处理出现在许多剑桥实践题目中。你需要掌握 READFILE、WRITEFILE 和 APPENDFILE。典型模式是:先用 OPENFILE "filename.txt" FOR READ 打开文件,然后用 READFILE "filename.txt", variable 读取数据直到文件末尾。处理完毕后关闭文件。对于写操作,使用 OPENFILE "output.txt" FOR WRITE,接着用 WRITEFILE "output.txt", data,最后关闭文件。APPENDFILE 用于在已有文件末尾添加数据。读取文件前务必检查文件是否存在,并处理文件可能不可用的情形。在伪代码中,你可以使用类似 WHILE NOT EOF("filename.txt") DO 的结构。
READFILE "students.txt", name, score
READFILE "students.txt", name, score
9. Error Handling and Validation | 错误处理与验证
Robust programs anticipate invalid input. Common validation checks: range check (e.g. score between 0 and 100), type check (is it an integer?), length check (password at least 8 characters), presence check (required field not empty), format check (date in DD/MM/YYYY). In pseudocode, use a WHILE loop to repeatedly prompt until valid data is entered. Also consider error codes or messages and make sure the program does not crash when a file is missing. A simple test for file existence can be written as IF FILEEXISTS("data.txt") THEN … ELSE OUTPUT "File not found".
健壮的程序需要对无效输入进行预判。常见的验证检查包括:范围检查(如分数在 0 到 100 之间)、类型检查(是否为整数?)、长度检查(密码至少 8 个字符)、存在性检查(必填字段不能为空)、格式检查(日期格式为 DD/MM/YYYY)。在伪代码中,可以用 WHILE 循环反复提示用户输入,直到得到有效数据。同时也要考虑错误代码或错误消息,确保程序在文件缺失时不会崩溃。简单的文件存在性检查可以写作 IF FILEEXISTS("data.txt") THEN … ELSE OUTPUT "File not found"。
- Use INPUT and OUTPUT statements clearly to interact with the user.
- Validate both the type and the range of numerical inputs.
- 清晰使用 INPUT 和 OUTPUT 语句与用户交互。
- 对数值输入的类型和范围都要进行验证。
10. Testing and Debugging Strategies | 测试与调试策略
Testing is a major part of the practical paper. You will be expected to design a test plan with normal, boundary and erroneous/exceptional data. Normal data: values you would typically expect. Boundary data: the extreme edges of acceptable values (e.g. minimum, maximum, just below minimum, just above maximum). Erroneous data: data that the program should reject, like letters where numbers are expected. Dry‑run your pseudocode with these test cases, tracing variable values step by step. This helps you spot logical errors before the final run. Always mention that you would test every path in the code including all IF/CASE branches.
测试是实践试卷的重要组成部分。你需要设计一个测试计划,其中包含正常数据、边界数据和错误/异常数据。正常数据:你通常期望的典型值。边界数据:可接受范围的极限边界(如最小值、最大值、刚好低于最小值、刚好高于最大值)。错误数据:程序应当拒绝的数据,比如在需要数字的地方输入了字母。用这些测试用例对你的伪代码进行干运行,逐步追踪变量的值。这有助于你在最终运行前发现逻辑错误。记得说明你会测试代码中的每一条路径,包括所有 IF/CASE 分支。
| Test Type | Example Input (Score 0‑100) | Expected Outcome |
|---|---|---|
| Normal | 75 | Valid, processed |
| Boundary | 0, 100, -1, 101 | 0 and 100 accepted; -1 and 101 rejected |
| Erroneous | "abc", 12.5, empty | Rejected, error message |
11. Documentation and Commenting | 文档与注释
Good documentation makes your code easier to understand and earns marks. In pseudocode, comments start with //. Use them to explain the purpose of a loop, the meaning of a complex condition, or any assumptions you made. At the top of your answer, write a brief header: what the program does, the author (you) and the version. If you are asked to write a function, document its parameters and return value. Comments should not simply repeat the code but explain why you are doing something.
良好的文档能够使你的代码更容易理解,也能为你赢得分数。在伪代码中,注释以 // 开头。使用注释来解释循环的作用、复杂条件的含义,或者你所作的任何假设。在答案开头写一个简短的标题信息:程序的功能、作者(你)和版本。如果题目要求编写一个函数,要注明它的参数和返回值。注释不应该是简单重复代码,而是要解释你为什么这样做。
// This loop searches for the highest score
// 此循环用于寻找最高分
12. Exam Day Tips and Time Management | 考试当天技巧与时间管理
Allocate time proportionally to the marks available. Read all problems first and start with the one you find easiest. Spend 5‑10 minutes planning your algorithm on scrap paper before writing pseudocode. Leave at least 15 minutes for testing and checking your work. When drawing flowcharts, use a pencil and ruler. In pseudocode, be consistent with indentation and capitalisation of keywords. If you get stuck, move on and return later. Finally, double‑check that your program handles all the required scenarios and that you have included a complete test plan with all three data categories.
根据题目分值合理分配时间。先通读所有问题,然后从你觉得最容易的题目开始。在动笔写伪代码之前,花 5 到 10 分钟在草稿纸上规划算法。至少留出 15 分钟用于测试和检查。画流程图时使用铅笔和直尺。写伪代码时,保持缩进和关键字大小写的一致。如果一时卡住,先往下做,稍后再回来。最后,再次确认你的程序处理了所有要求的场景,并且包含了完整测试计划,涵盖全部三种数据类别。
- Bring a watch to track time independently of the exam hall clock.
- Write clearly; illegible pseudocode may lose marks.
- 自备手表以便独立掌握时间,不要依赖考场时钟。
- 书写要清晰;难以辨认的伪代码可能会导致失分。
Published by TutorHao | Computer Science Revision Series | aleveler.com
更多咨询请联系16621398022(同微信)

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