First exams 2027 · SL & HL 2027 年首次开考 · SL 与 HL

A1.2.3 · Computer fundamentals

A1.2.3 · 计算机基础

The Purpose and Use of Logic Gates

逻辑门的目的与用途

A logic gate is the smallest decision a computer can make in hardware: one or two binary inputs go in, a fixed rule is applied, one binary output comes out. Every calculation and every stored bit is built from these.

逻辑门是计算机在硬件层面能做的最小决定:一个或两个二进制输入进来,应用一条固定的规则,一个二进制输出出去。每一次计算和每一个被存储的位,都是由它们搭出来的。

A1's guiding question asks what principles underpin how a computer works, from low-level hardware upward. Logic gates are that lowest level: physical Boolean algebra, where 1 means true or on and 0 means false or off.

A1 的引导性问题问的是从底层硬件往上支撑计算机运行的原理。逻辑门就是那个最底层:物理化的布尔代数,其中 1 表示真或开,0 表示假或关。

Core for SL & HL SL 与 HL 核心内容 Typically 2–4 marks · AO2 通常 2–4 分 · AO2 Command term: describe 命令词:describe(描述)

Explainer

讲解

What a logic gate is

逻辑门是什么

Df

A logic gate is a small circuit, built from transistors acting as switches, that takes one or two binary inputs and produces one binary output by a fixed Boolean rule. In gate work, 1 means true or on and 0 means false or off.

逻辑门是一个小电路,由充当开关的晶体管搭成,它接收一个或两个二进制输入,并按一条固定的布尔规则产生一个二进制输出。在门电路里,1 表示真或开,0 表示假或关。

The word "gate" is the useful image: like a physical gate that lets people through or holds them back, a logic gate lets a 1 through or blocks it, depending on the other input and on the rule the gate follows.

"门"这个词是个有用的比喻:就像一扇实体的门,让人通过或把人挡住,逻辑门也让一个 1 通过或把它挡下,取决于另一个输入以及这个门所遵循的规则。

Explore

探索

The seven gates

七种门

Three are basic (AND, OR, NOT); the other four are built by adding a NOT to a basic gate. Click each to see its standard symbol, its rule, its truth table and one place it is used.

三种是基本门(AND、OR、NOT);另外四种是在基本门后面加一个 NOT 得到的。点击每一个,看它的标准符号、规则、真值表,以及一个使用它的地方。

Explainer

讲解

Their role in binary computing

它们在二进制计算中的作用

Job in a computerHow gates do it
ArithmeticInside the ALU, AND, OR and XOR gates are wired into adder circuits that add two binary numbers. Subtraction, multiplication and division are built on top of addition
Decision makingAn AND gate outputs 1 only when all inputs are 1, which is the hardware form of "if every condition is met". Combining gates builds the conditions behind if and switch statements
MemoryA few gates wired in a loop (a flip-flop) hold a stable 0 or 1 until told to change. Scaled up, this becomes registers and RAM
Control and signallingGates process inputs from sensors and buttons in alarm systems, automatic doors, lifts, traffic lights and communication hardware, turning input combinations into the right response
在计算机中的任务门如何完成它
算术在 ALU 内部,AND、OR 和 XOR 门被连成加法器电路,用来把两个二进制数相加。减法、乘法和除法都建立在加法之上
做决定只有当所有输入都为 1 时,AND 门才输出 1,这是"如果每个条件都满足"的硬件形式。组合各种门就搭出了 if 和 switch 语句背后的条件
存储几个门连成一个回路(触发器),会稳定地保持 0 或 1,直到被告知改变。放大后就成了寄存器和 RAM
控制与信号在报警系统、自动门、电梯、交通灯和通信硬件中,门处理来自传感器和按钮的输入,把输入的组合变成正确的响应
One real example 一个真实例子

A door on a train opens only when the train is stopped AND the button is pressed AND the doors are enabled by the driver. That is a three-input AND gate: the output (unlock) is 1 only when all three inputs are 1.

火车上的车门只有在列车已停稳、并且按钮被按下、并且司机已启用车门时才打开。这就是一个三输入的 AND 门:只有当三个输入都为 1 时,输出(解锁)才为 1。

Check your understanding

检验你的理解

Both inputs to a NAND gate are 1. What is the output?

一个 NAND 门的两个输入都是 1。输出是多少?

Common mistake

常见错误

Recurring confusion between OR and XOR OR 与 XOR 之间反复出现的混淆

RecurringTreating OR and XOR as the same because both give 1 when one input is 1. They differ on one row: when both inputs are 1, OR outputs 1 (at least one is on) but XOR outputs 0 (they are not different). "OR" means at least one; "XOR" means exactly one. The same trap sits between NOR and XNOR. Always check the both-inputs-1 row.

反复出现因为 OR 和 XOR 在一个输入为 1 时都给出 1,就当它们一样。它们只在一行不同:当两个输入都为 1 时,OR 输出 1(至少有一个开),但 XOR 输出 0(它们并不不同)。"OR"意思是至少一个;"XOR"意思是恰好一个。NOR 和 XNOR 之间也有同样的陷阱。永远检查"两个输入都为 1"这一行。

✕

Wrong: "An OR gate and an XOR gate both output 1 when an input is 1, so a circuit can use either one."

错误: "OR 门和 XOR 门在有输入为 1 时都输出 1,所以电路里用哪个都行。"

✓

Right: "OR gives 1 whenever one or both inputs are 1, so the both-1 row is also a 1. XOR gives 1 for exactly one input at 1, so the both-1 row is a 0. The two gates match on three rows and split on the fourth."

正确: "OR 在至少一个输入为 1 时输出 1,包括两个都为 1 时。XOR 只有在恰好一个输入为 1 时输出 1,两个都为 1 时输出 0。它们在三行上一致,在第四行上不同。"

Revision questions

复习题

Specimen-paper style. Write an answer, then reveal the marking points and mark yourself.

采用样卷风格。写下答案,然后展开评分要点给自己打分。

Question 1 · 2 marks 第 1 题 · 2 分

[2]State the output of an AND gate and of an OR gate when both inputs are 0.

[2]写出当两个输入都为 0 时,AND 门和 OR 门的输出。

Question 2 · 2 marks 第 2 题 · 2 分

[2]Describe the difference in output between a NAND gate and an AND gate.

[2]描述 NAND 门与 AND 门在输出上的区别。

Question 3 · 3 marks 第 3 题 · 3 分

[3]Describe two uses of logic gates within a computer system.

[3]描述逻辑门在计算机系统中的两种用途。

Question 4 · 3 marks 第 4 题 · 3 分

[3]Explain how logic gates allow a computer to carry out decision making in hardware.

[3]解释逻辑门如何让计算机在硬件层面进行决策。

Question 5 · 2 marks 第 5 题 · 2 分

[2]A student says an XNOR gate outputs 1 whenever an XOR gate outputs 0. State whether this is correct and justify your answer.

[2]一名学生说,只要 XOR 门输出 0,XNOR 门就输出 1。说明这是否正确并给出理由。

Flashcards

记忆卡片

Active recall for this statement’s key terms.

针对本条考纲陈述关键术语的主动回忆练习。

Prototype render · grounded in the IB CS 2027 subject guide and the Hodder and Oxford IB CS 2027 texts for A1.2.3 · not yet wired to live routes