IGCSE计算机科学伪代码与流程图:5步攻克Paper 2算法题|Pseudocode & Flowcharts

📘 中文引言

在IGCSE计算机科学Paper 2《计算机科学概念与原理》中,伪代码(Pseudocode)流程图(Flowcharts)是必考的核心技能。考生不仅要能读懂给定的伪代码/流程图,还需补全缺失部分、找出逻辑错误并改写出等价算法。本文基于2021年11月真题(9210/2),带你系统拆解这类题型的解题思路。

🇬🇧 English Introduction

In the IGCSE Computer Science Paper 2 (Concepts and Principles of Computer Science), pseudocode and flowcharts are essential skills. You’ll be asked to read given pseudocode/flowcharts, fill in missing parts, identify logic errors, and derive equivalent representations. This article uses the November 2021 past paper (9210/2) to walk you through the key techniques.


📌 5个关键知识点 | 5 Key Concepts

1️⃣ 变量初始化 — Variable Initialization

中文:伪代码中 lowest ← 1000 是一个初始化技巧——用一个已知的极大值确保第一个输入值必定被替换。但在实际考试中,如果题目输入范围未知,这种硬编码可能导致bug(所有输入都>1000则结果错误)。更好的做法是用第一个输入值初始化。

EN: lowest ← 1000 is an initialization trick — setting a known large value so the first input always replaces it. But beware: if all inputs exceed 1000, the result is wrong. A better approach is to initialize with the first input value itself.

2️⃣ 条件判断结构 — Conditional Selection

中文:流程图中的菱形框代表条件判断。在补全流程图时,必须确保条件分支与伪代码中的 IF...THEN...ENDIF 完全对应。本题中 IF num < lowest THEN lowest ← num 对应菱形判断框加一条赋值箭头。

EN: The diamond in a flowchart represents a conditional check. When completing a flowchart, ensure the branches exactly mirror the IF...THEN...ENDIF in pseudocode. Here, IF num < lowest THEN lowest ← num maps to a diamond + assignment arrow.

3️⃣ 循环控制 — REPEAT…UNTIL Loops

中文:伪代码中 REPEAT...UNTIL count = 5 是一种后测试循环——循环体至少执行一次。这与 WHILE...ENDWHILE(前测试循环)有本质区别。流程图补全时,箭头必须正确回指到循环起始点。

EN: REPEAT...UNTIL count = 5 is a post-test loop — the body runs at least once. This differs fundamentally from WHILE...ENDWHILE (pre-test loop). When completing the flowchart, the arrow must loop back to the correct entry point.

4️⃣ 计数器的使用 — Counter Variables

中文:计数器 count ← count + 1 跟踪循环迭代次数。Paper 2 常见错误:忘记更新计数器导致死循环;或者计数器放错位置(如放在条件判断内部导致计数不准)。

EN: The counter count ← count + 1 tracks loop iterations. Common Paper 2 errors: forgetting to update the counter (infinite loop), or placing the increment inside a conditional (inconsistent counting).

5️⃣ 输入输出操作 — Input/Output Operations

中文:USERINPUT 在流程图中对应平行四边形(输入框),OUTPUT 对应输出框。真题中常要求画缺失箭头连接输入→处理→输出——确保数据流方向正确,单向且不交叉。

EN: USERINPUT maps to a parallelogram (input symbol) in flowcharts; OUTPUT maps to the output symbol. Past papers often ask you to draw missing arrows connecting input → process → output — ensure unidirectional, non-crossing data flow.


💡 学习建议 | Study Tips

  • 中文:每天手写2道流程图补全题,熟练菱形、矩形、平行四边形的使用场景。
  • EN: Practice 2 flowchart-completion questions daily; master when to use diamonds, rectangles, and parallelograms.
  • 中文:把伪代码翻译成流程图(反之亦然),这是Paper 2最高频的题目类型。
  • EN: Translate pseudocode to flowcharts (and vice versa) — the most common question type in Paper 2.
  • 中文:特别注意循环终止条件的边界情况——循环执行5次 vs 判断5次是不同概念。
  • EN: Pay extra attention to loop boundary conditions — “execute 5 times” vs “check 5 times” are distinct.

📞 联系方式:16621398022(同微信) | Contact: 16621398022 (WeChat)

需要IGCSE/ALEVEL计算机科学辅导?欢迎咨询。


Discover more from TutorHao

Subscribe to get the latest posts sent to your email.

Comments

屏轩国际教育cambridge primary/secondary checkpoint, cat4, ukiset,ukcat,igcse,alevel,PAT,STEP,MAT, ibdp,ap,ssat,sat,sat2课程辅导,国外大学本科硕士研究生博士课程论文辅导

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from TutorHao

Subscribe now to keep reading and get access to the full archive.

Continue reading