← 返回资讯屏轩教育 · 行业资讯

A-Level Edexcel Programming: Operators and Programming Structures | A-Level Edexcel 编程:运算符与程序结构

2026-08-29 14:52 · 本文部分内容由AI辅助创作

📚 A-Level Edexcel Programming: Operators and Programming Structures | A-Level Edexcel 编程:运算符与程序结构

Understanding operators and programming structures is essential for success in the Edexcel A-Level Computer Science Paper 2 and the non-exam assessment. This article covers arithmetic, comparison and Boolean operators, precedence rules, and the three core control structures: sequence, selection and iteration.

理解运算符和程序结构对于在 Edexcel A-Level 计算机科学 Paper 2 及课程作业中取得成功至关重要。本文涵盖算术、比较和布尔运算符、优先级规则,以及三种核心控制结构:顺序、选择和迭代。


1. Arithmetic Operators and Precedence | 算术运算符与优先级

In Edexcel pseudocode, arithmetic operators include + addition, - subtraction, * multiplication, / division, DIV integer division, MOD remainder and ^ exponentiation. The result of DIV and MOD depends on whole-number operands.

在 Edexcel 伪代码中,算术运算符包括 + 加法、- 减法、* 乘法、/ 除法、DIV 整除、MOD 取余和 ^ 幂运算。DIV 和 MOD 的结果取决于整数操作数。

Operators are evaluated in a strict order: brackets first, then ^, then * / DIV MOD, and finally + -. For example, 3 + 4 * 2 equals 11 because multiplication happens before addition.

运算符按严格顺序求值:先括号,然后 ^,接着 * / DIV MOD,最后 + -。例如,3 + 4 * 2 的结果是 11,因为乘法先于加法进行。

When operators have the same precedence, evaluation is left to right. So 20 / 5 * 2 (20 / 5) * 2 = 8, not 20 / (5 * 2) = 2. DIV and MOD share the same precedence as * and /.

当运算符优先级相同时,从左到右求值。因此 20 / 5 * 2 是 (20 / 5) * 2 = 8,而不是 20 / (5 * 2) = 2。DIV 和 MOD 与 * 和 / 优先级相同。

3 + 4 * 2 = 11   |   (2 + 3) * 4 = 20   |   2 ^ 3 = 8

ExpressionResult
7 DIV 23
7 MOD 21
2 ^ 38
(2 + 3) * 420
17 DIV 53
17 MOD 52
2 ^ 101024
(10 - 4) / 23

2. Comparison Operators | 比较运算符

Comparison operators compare two values and return a Boolean result. Edexcel pseudocode uses = for equality, <> for not equal, > for greater than, < for less than, &gt;= for greater than or equal to, and &lt;= for less than or equal to.

比较运算符用于比较两个值并返回布尔结果。Edexcel 伪代码使用 = 表示等于,<> 表示不等于,> 表示大于,< 表示小于,&gt;= 表示大于或等于,&lt;= 表示小于或等于。

In Python the equivalents are ==, !=, >, <, &gt;= and &lt;=. Do not confuse the assignment operator <- in pseudocode with the equality sign =. Assignment stores a value; comparison tests a condition.

广告 / Sponsored

在 Python 中等价运算符是 ==、!=、>、<、&gt;= 和 &lt;=。不要将伪代码中的赋值运算符 <- 与等号 = 混淆。赋值存储值;比较测试条件。

A common exam trap is using = where == is required in Python, or using <- inside an IF condition. Always use the correct operator for the context.

一个常见的考试陷阱是在 Python 中需要 == 的地方使用了 =,或者在 IF 条件中使用了 <-。始终根据上下文使用正确的运算符。

5 > 3 → TRUE   |   4 = 4 → TRUE   |   2 <> 2 → FALSE


3. Boolean Operators and Truth Tables | 布尔运算符与真值表

Boolean operators combine or invert Boolean values. Edexcel pseudocode uses AND, OR and NOT. AND is true only when both operands are true. OR is true when at least one operand is true. NOT reverses the value.

布尔运算符用于组合或反转布尔值。Edexcel 伪代码使用 AND、OR 和 NOT。AND 仅在两个操作数都为真时为真。OR 在至少一个操作数为真时为真。NOT 反转值。

Truth tables are often examined. For AND, the only TRUE row is TRUE AND TRUE. For OR, the only FALSE row is FALSE OR FALSE. For NOT, TRUE becomes FALSE and vice versa.

真值表经常被考查。对于 AND,唯一为 TRUE 的行是 TRUE AND TRUE。对于 OR,唯一为 FALSE 的行是 FALSE OR FALSE。对于 NOT,TRUE 变为 FALSE,反之亦然。

ABA AND BA OR B
TRUETRUETRUETRUE
TRUEFALSEFALSETRUE
FALSETRUEFALSETRUE
FALSEFALSEFALSEFALSE

NOT TRUE = FALSE   |   NOT FALSE = TRUE

Operator precedence for Boolean operators is NOT first, then AND, then OR. Brackets should be used to make complex conditions clear.

布尔运算符的优先级是 NOT 最先,然后 AND,最后 OR。应使用括号使复杂条件清晰。


4. String Operators and Concatenation | 字符串运算符与连接

Edexcel pseudocode uses + or & for string concatenation. For example, "Hello" + " " + "World" produces <

广告 / Sponsored
阅读探索者 Reading Explorer引进版F1 2 3 4 5级美国国家地理青少年小学英语综合阅读教材学生书 …
地理、英语 备考教辅 · 正版现货 · 学习备考通用
查看详情 / View on Taobao参考价 ¥148.0
广告 / Sponsored
官方现货 正保会计网校注会cpa2026教材注册会计师官方教材会计审计税法经济法财管战略正版图书可搭指南基础模拟试卷题…
经济、会计 备考教辅 · 正版现货 · 学习备考通用
查看详情 / View on Taobao参考价 ¥46.2

更多咨询请联系16621398022(同微信)

备考资讯每日更新,关注不错过
考纲变化 · 科目分析 · 学习方法
扫码关注公众号 tutorhao
在微信里长按二维码识别关注
或截图后用「扫一扫 → 相册」选择本图
公众号:tutorhao