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

Edexcel A Level Programming Operators | Edexcel A Level 编程运算符

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

📚 Edexcel A Level Programming Operators | Edexcel A Level 编程运算符

Operators are the building blocks of expressions in programming. They act on one or more values called operands to produce a new value or a Boolean result. In the Edexcel A Level Computer Science specification, you need to understand arithmetic, comparison, Boolean and bitwise operators, and to use them correctly in pseudocode, Python, Java or any other taught language.

运算符是程序中表达式的基本构件。它们作用于一个或多个称为操作数的值,以产生新值或布尔结果。在 Edexcel A Level 计算机科学考试大纲中,你需要理解算术、比较、布尔和位运算符,并在伪代码、Python、Java 或任何其他教学语言中正确使用它们。

1. Operator Categories | 运算符分类

An operator is classified by the number of operands it takes. A unary operator acts on one operand, a binary operator acts on two, and a ternary operator acts on three. Most operators in Edexcel programming are binary; examples include +, -, *, /, AND and OR. Unary examples include NOT and the negative sign.

运算符按其操作数数量分类。一元运算符作用于一个操作数,二元运算符作用于两个操作数,三元运算符作用于三个操作数。Edexcel 编程中的大多数运算符是二元的,例如 +、-、*、/、AND 和 OR。一元示例包括 NOT 和负号。

You should be able to identify the operator and operands in an expression such as x + y, where + is the operator and x and y are operands. The result depends on the data types: arithmetic operators usually return numeric values, while comparison and Boolean operators return TRUE or FALSE.

你应该能够在表达式(如 x + y)中识别运算符和操作数,其中 + 是运算符,x 和 y 是操作数。结果取决于数据类型:算术运算符通常返回数值,而比较和布尔运算符返回 TRUE 或 FALSE。

CategoryExample operatorsTypical result
Arithmetic | 算术+ - * / DIV MOD ^Numeric value
Comparison | 比较= ≠ < > ≤ ≥TRUE or FALSE
Boolean | 布尔AND OR NOTTRUE or FALSE
Bitwise | 位AND OR XOR NOT << >>Binary integer

2. Arithmetic Operators | 算术运算符

The distinction between / and DIV is important: DIV discards the fractional part and returns an integer, while / keeps the decimal result.

算术运算符用于计算。Edexcel 伪代码使用 + 表示加法、- 表示减法、* 表示乘法、/ 表示实数除法、DIV 表示整数除法、MOD 表示余数、^ 表示乘方。/ 与 DIV 的区别很重要:DIV 丢弃小数部分并返回整数,而 / 保留小数结果。

OperatorMeaningExampleResult
+Addition | 加法7 + 29
-Subtraction | 减法7 - 25
*Multiplication | 乘法7 * 214
/Real division | 实数除法7 / 23.5
DIVInteger division | 整数除法7 DIV 23
MODRemainder | 余数7 MOD 21
^Exponentiation | 乘方2 ^ 38

In many programming languages, integer division is written as // in Python or / in Java when both operands are integers, while remainder is % in Python and Java. Always check the exact notation required by the question, but in Edexcel pseudocode use DIV and MOD.

在许多编程语言中,整数除法在 Python 中写作 //,在 Java 中当两个操作数都是整数时写作 /,而求余在 Python 和 Java 中写作 %。一定要根据题目要求检查具体写法,但在 Edexcel 伪代码中使用 DIV 和 MOD。


广告 / Sponsored

3. Assignment and Compound Assignment | 赋值与复合赋值运算符

tores a value in a variable. Edexcel pseudocode often uses =, but in this article we write ← so that assignment is not confused with equality. For example, x ← x + 1 means 'take the current value of x, add 1, and store the result back in x'.

赋值将值存储在变量中。Edexcel 伪代码通常使用 =,但本文中使用 ←,以免赋值与相等比较混淆。例如,x ← x + 1 的意思是 '取 x 的当前值,加 1,并将结果存回 x'。

assignment shortcuts such as x += 1, x -= 1, x *= 2 and x /= 2. These are equivalent to x ← . They are not a separate mathematical operation, just a shorter way of writing an update.

许多高级语言提供复合赋值简写,例如 x += 1、x -= 1、x *= 2 和 x /= 2。它们分别等价于 x ← x + 1 等。它们并不是独立的数学运算,只是更新变量的一种更简短写法。

在 Python 中:count += 1 与 count = count + 1 相同。

Published by TutorHao | A-Level 编程 Revision Series | aleveler.com

广告 / Sponsored
英文原版 Oxford IB Diploma Programme IB Prepared Mathematics An…
数学 备考教辅 · 正版现货 · 学习备考通用
查看详情 / View on Taobao参考价 ¥343.0
广告 / Sponsored
英文原版 Oxford IB Diploma Programme Mathematics Analysis And A…
数学 备考教辅 · 正版现货 · 学习备考通用
查看详情 / View on Taobao参考价 ¥753.0

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

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