📚 Year 12 OCR Computer Science: Core Knowledge Essentials | Year 12 OCR 计算机:核心知识点梳理
This comprehensive guide distills the core knowledge required for the OCR AS Level (Year 12) Computer Science specification. It covers essential theory from components of a computer system to computational thinking and algorithm design, presented in a dual‑language format to support both English and Chinese learners. Each section is structured around key concepts you will be assessed on in H046/01 (Computer Systems) and H046/02 (Algorithms and Problem Solving).
这篇全面的指南浓缩了 OCR AS Level(Year 12)计算机科学所需的全部核心知识点。内容涵盖计算机系统组件、计算思维和算法设计等关键理论,采用中英双语呈现,旨在同时帮助英语和中文学习者。每一节都围绕你在 H046/01(计算机系统)和 H046/02(算法与问题解决)中将要被考查的关键概念展开。
1. Processor Fundamentals & Von Neumann Architecture | 处理器基础与冯·诺依曼体系结构
The Central Processing Unit (CPU) is the brain of the computer, designed around the stored‑program concept. In the Von Neumann architecture, both instructions and data share the same memory and bus system. Key components include the Control Unit (CU), which decodes instructions and coordinates activities, and the Arithmetic Logic Unit (ALU), which performs calculations and logical operations. Registers are small, high‑speed storage locations inside the CPU: the Program Counter (PC) holds the address of the next instruction; the Memory Address Register (MAR) stores the address to be accessed in main memory; the Memory Data Register (MDR) temporarily holds data read from or written to memory; the Current Instruction Register (CIR) contains the instruction currently being executed; and the Accumulator (ACC) temporarily stores ALU results.
中央处理器(CPU)是计算机的大脑,基于存储程序概念设计。在冯·诺依曼体系结构中,指令和数据共享同一内存和总线系统。关键组件包括控制单元(CU),负责译码指令并协调活动;以及算术逻辑单元(ALU),执行计算和逻辑运算。寄存器是CPU内部小而高速的存储位置:程序计数器(PC)存放下一条指令的地址;存储器地址寄存器(MAR)存放要访问的主存地址;存储器数据寄存器(MDR)暂存从内存读取或写入的数据;当前指令寄存器(CIR)保存正在执行的指令;累加器(ACC)暂存ALU的运算结果。
The fetch‑decode‑execute cycle describes how a CPU processes instructions. Fetch: the PC value is copied to the MAR, a read signal is sent, and the instruction travels via the data bus into the MDR, then into the CIR; the PC is incremented. Decode: the CU interprets the opcode in the CIR. Execute: the CU sends signals to relevant components (e.g. ALU performed, data moved). This cycle repeats billions of times per second. The Harvard architecture, by contrast, uses separate memory and buses for instructions and data, allowing parallel access and improving speed in embedded systems, but it is more complex and costly.
取指-译码-执行周期描述了CPU处理指令的过程。取指:PC的值复制到MAR,发送读信号,指令通过数据总线进入MDR,再进入CIR;PC递增。译码:CU解释CIR中的操作码。执行:CU向相关组件发送信号(例如让ALU运算或移动数据)。此周期每秒重复数十亿次。相比之下,哈佛体系结构对指令和数据使用独立的内存和总线,可并行访问,在嵌入式系统中提升速度,但更复杂、成本更高。
2. Types of Processor & Performance | 处理器类型与性能
Modern CPUs can be categorised as CISC (Complex Instruction Set Computer) or RISC (Reduced Instruction Set Computer). CISC processors have a large set of complex instructions, often requiring multiple clock cycles, but they reduce the number of instructions per program. RISC processors use a smaller, highly optimised instruction set, with most instructions executing in a single clock cycle, relying on software to combine simple operations. Graphics Processing Units (GPUs) are specialised for parallel data processing, using hundreds of cores to handle vector and matrix operations efficiently for rendering, machine learning and scientific simulations.
现代CPU可分为CISC(复杂指令集计算机)和RISC(精简指令集计算机)。CISC处理器拥有大量复杂指令,通常需要多个时钟周期,但能减少每条程序指令的数量。RISC处理器使用更小且高度优化的指令集,大多数指令能在一个时钟周期内执行,依靠软件来组合简单操作。图形处理器(GPU)专为并行数据处理而设计,使用数百核心高效处理向量和矩阵运算,用于渲染、机器学习和科学模拟。
Performance is influenced by clock speed (frequency in GHz), number of cores and cache memory. A higher clock speed means more cycles per second, but physical limits cause heat. Multiple cores allow true parallel execution of threads, boosting multitasking and parallelisable workloads. Cache, located closer to the CPU than RAM, uses SRAM for fast temporary storage; levels L1 (fastest, small), L2, and L3 (larger, shared) reduce the time the processor waits for data. Pipelining further improves throughput by overlapping the execution stages of multiple instructions, though hazards like data dependencies can cause stalls.
性能受时钟速度(以GHz为单位的频率)、核心数量和高速缓存等因素影响。时钟速度越高,每秒能执行的周期数就越多,但物理限制会产生热量。多核心能真正实现线程并行执行,提升多任务和可并行工作负载的处理能力。高速缓存位于比RAM更靠近CPU的位置,使用SRAM提供快速临时存储;分为L1(最快、较小)、L2和L3(更大、共享),可减少处理器等待数据的时间。流水线技术通过重叠多条指令的执行阶段进一步提升吞吐量,但数据依赖等冲突可能导致停顿。
3. Input, Output & Storage Devices | 输入、输出与存储设备
Input devices (keyboard, mouse, scanners, sensors, microphones) convert real‑world data into digital signals. Output devices (monitors, printers, speakers, actuators) present processed information to the user. Multi‑function devices like touchscreens combine both. Primary memory (main memory) is directly accessible by the CPU and includes volatile RAM (e.g. DRAM, SRAM), which loses content when power is off, and non‑volatile ROM, which holds firmware and boot instructions. Virtual memory uses a section of secondary storage (e.g. an SSD) as an extension of RAM when physical memory is exhausted; however, excessive paging leads to disk thrashing, which severely degrades performance.
输入设备(键盘、鼠标、扫描仪、传感器、麦克风)将真实世界的数据转换为数字信号。输出设备(显示器、打印机、扬声器、执行器)将处理后的信息呈现给用户。触摸屏等多功能设备同时兼具二者。主存储器(内存)可由CPU直接访问,包括易失性RAM(如DRAM、SRAM),断电后数据丢失;以及非易失性ROM,存放固件和引导指令。虚拟内存将一部分辅助存储(如SSD)当作RAM的扩展,当物理内存不足时使用;然而,过度分页会导致磁盘颠簸,严重降低性能。
Secondary storage is non‑volatile, holding data permanently. Magnetic hard disk drives (HDD) use spinning platters and read/write heads; they offer large capacity at low cost but are susceptible to shock and slower. Solid‑state drives (SSD) use NAND flash memory with no moving parts, giving faster access times, lower power consumption and greater durability, albeit at a higher cost per gigabyte. Optical discs (CD, DVD, Blu‑ray) use lasers to read/write pits and lands, suitable for distribution and archival storage. Cloud storage stores data remotely on servers accessed via the internet, enabling scalability and ubiquitous access but dependent on bandwidth and raising security concerns.
辅助存储是非易失性的,能永久保存数据。磁性硬盘驱动器(HDD)使用旋转碟片和读写磁头,提供大容量且成本低,但易受冲击且速度较慢。固态硬盘(SSD)使用NAND闪存,无活动部件,具有更快的访问时间、更低的功耗和更好的耐久性,但每GB成本更高。光盘(CD、DVD、蓝光)利用激光读写凹坑和平面,适合分发和归档存储。云存储将数据远程存放在通过互联网访问的服务器上,能够弹性扩展且随处可访,但依赖于带宽并带来安全顾虑。
4. System Software & Application Generation | 系统软件与应用程序生成
System software manages hardware and provides a platform for application software. The operating system (OS) performs memory management (allocation, paging, segmentation), processor scheduling (round‑robin, priority, multilevel feedback queues), file management, and managing interrupts. Interrupts are signals that cause the CPU to suspend its current task, store the state, execute an Interrupt Service Routine (ISR), and then resume. They allow I/O operations, timers and hardware faults to be handled efficiently. Without interrupts, the CPU would waste cycles polling devices.
系统软件管理硬件并为应用软件提供平台。操作系统执行内存管理(分配、分页、分段)、处理器调度(轮转、优先级、多级反馈队列)、文件管理以及中断管理。中断是令CPU暂停当前任务、保存状态、执行中断服务例程(ISR)然后恢复的信号。中断使I/O操作、时钟和硬件故障能够被高效处理。若没有中断,CPU将浪费周期在轮询设备上。
Translators convert source code into machine code. A compiler translates the entire high‑level source code into an executable binary in one go, producing an independent .exe file; it reports all errors after compilation. An interpreter translates and executes line by line, making debugging easier but execution slower because translation happens every time the program is run. An assembler converts assembly language mnemonics into machine code on a one‑to‑one basis. Intermediate approaches like just‑in‑time (JIT) compilation combine both to optimise performance. The stages of compilation include lexical analysis, syntax analysis (parsing into a parse tree), semantic analysis, code generation and optimisation. A linker combines separately compiled modules and libraries into a single executable.
翻译器将源代码转换为机器码。编译器一次性将整个高级源代码译为目标平台的可执行文件,产生独立的.exe文件,并在编译结束后报告所有错误。解释器逐行翻译并执行,使调试更容易,但每次运行程序时都要翻译,导致执行较慢。汇编器将汇编助记符一对一地转换为机器码。即时编译(JIT)等中间方法结合两者以优化性能。编译的各阶段包括词法分析、语法分析(构建解析树)、语义分析、代码生成和优化。链接器将分别编译的模块与库合并为一个可执行文件。
5. Data Representation & Types | 数据表示与类型
Integers are represented using signed two's complement in most processors. For an n‑ verting bits and adding 1. This removes the problem of two zeros (+0 and −0) found in sign‑and‑magnitude and simplifies ALU subtraction to addition. Floating‑point numbers follow the general form mantissa × 2exponent−bias, allowing trade‑off between range and precision. Normalisation ensures a unique representation by eliminating leading zeros in the mantissa.
大多数处理器使用带符号的二进制补码表示整数。对于n位模式,范围是−2ⁿ⁻¹ 到 2ⁿ⁻¹−1。负数通过将所有位取反后加1生成,这消除了原码表示中±0共存的问题,并使ALU能用加法实现减法。浮点数遵循一般形式 尾数 × 2阶码−偏移,在范围与精度之间做出权衡。规范化通过消除尾数的前导零来确保唯一表示。
Characters are encoded using standards: ASCII uses 7 bits for 128 characters; Extended ASCII uses 8 bits for 256; Unicode (UTF‑8, UTF‑16) can encode over a million code points covering virtually all scripts. Images are stored as bitmaps (a grid of pixels with colour depth determining bits per pixel) or as vectors (mathematical descriptions of shapes, scalable without loss). Sound is digitised by sampling an analogue signal at a rate (e.g. 44.1 kHz) and quantising each amplitude value; the Nyquist theorem states that the sampling rate must be at least twice the highest frequency to avoid aliasing.
字符采用多种标准编码:ASCII使用7位表示128个字符;扩展ASCII使用8位表示256个;Unicode(UTF‑8、UTF‑16)可对超过百万的码点进行编码,几乎覆盖所有书写系统。图像以位图(由像素网格构成,颜色深度决定每像素位数)或矢量(形状的数学描述,可无失真缩放)形式存储。声音通过以一定采样率(如44.1 kHz)对模拟信号采样并对每个幅值量化来数字化;奈奎斯特定理指出采样率必须至少为最高频率的两倍,以免混叠。
6. Data Structures | 数据结构
An array is a static contiguous collection of elements of the same data type, accessed via an index in O(1) time. Records (structs) group fields of different types under one name. A list is an abstract data type that can be implemented via an array (allowing direct access) or a linked list (dynamic, elements stored in nodes with pointers, enabling O(1) insertion/deletion at head but O(n) search). Stacks follow Last‑In‑First‑Out (LIFO) with push and pop; used in recursion, undo operations, and expression evaluation. Queues use First‑In‑First‑Out (FIFO) with enqueue and dequeue; applied in buffers, print spooling and breadth‑first search.
数组是相同数据类型元素的静态连续集合,通过索引以O(1)时间访问。记录(结构体)将不同类型的字段组合在一个名称下。列表是一种抽象数据类型,可用数组(支持直接访问)或链表(动态,元素存储在带有指针的节点中,能在头部实现O(1)插入/删除,但搜索为O(n))实现。栈遵循后进先出(LIFO),支持压栈和弹栈,用于递归、撤销操作和表达式求值。队列是先进先出(FIFO),支持入队和出队,应用于缓冲区、打印缓冲队列和广度优先搜索。
Trees are hierarchical, consisting of nodes and edges. A binary tree has at most two children per node; a binary search tree (BST) keeps left < root < right. BST operations average O(log n) if balanced. Graphs consist of vertices connected by edges, which can be directed or undirected, weighted or unweighted. They model networks, maps and social connections, often traversed using depth‑first or breadth‑first algorithms.
树是层次结构,由节点和边组成。二叉树每个节点最多有两个子节点;二叉搜索树(BST)保持左 < 根 < 右的次序。如果树平衡,BST操作平均为O(log n)。图由通过边连接的顶点组成,边可以是有向或无向、加权或非加权的。图用于对网络、地图和社交连接建模,通常使用深度优先或广度优先算法遍历。
7. Boolean Algebra & Logic Circuits | 布尔代数与逻辑电路
riables that have only two values: true (1) and false (0). Fundamental operators are NOT (¬A), AND (A ∧ B), OR (A ∨ B), and XOR (A ⊕ B). Their behaviour is defined by truth tables. De Morgan's laws state ¬(A ∧ B) = ¬A ∨ ¬B and ¬(A ∨ B) = ¬A ∧ ¬ omplement, associative, distributive, absorption) or Karnaugh maps to minimise gate count in digital circuits.
布尔代数操作的变量只有两个值:真(1)和假(0)。基本运算符为 非(¬A)、与(A ∧ B)、或(A ∨ B)、异或(A ⊕ B)。其行为由真值表定义。德摩根定律表明 ¬(A ∧ B) = ¬A ∨ ¬B 和 ¬(A ∨ B) = ¬A ∧ ¬B,可实现与门和或门间的转换。布尔表达式可借助代数法则(同一律、零律、幂等律、互补律、结合律、分配律、吸收律)或卡诺图进行化简,以最小化数字电路的门数量。
| A | B | A ∧ B | A ∨ B | A ⊕ B |
|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 |
| 0 | 1 | 0 | 1 | 1 |
| 1 | 0 | 0 | 1 | 1 |
| 1 | 1 | 1 | 1 | 0 |
Table: Truth table for basic logic operations | 表:基本逻辑运算的真值表
ombinational circuits (adders, multiplexers) output depends only on current inputs. A half‑adder adds two bits, producing Sum = A ⊕ B and Carry = A ∧ B. A full‑adder incorporates a carry‑in. Sequential circuits, such as a D‑type flip‑ ate output only on a clock edge, forming the building blocks of registers and memory. Flip‑flops also enable edge‑triggered operations essential for synchronous logic design.
组合电路(加法器、多路复用器)的输出仅取决于当前输入。半加器对两个比特相加,产生 Sum = A ⊕ B 和 Carry = A ∧ B。全加器则加入进位输入。时序电路(如D型触发器)可存储一位状态,仅在时钟边沿更新输出,构成寄存器和内存的基本构建块。触发器还支持边沿触发操作,这对同步逻辑设计至关重要。
8. Database Concepts & SQL | 数据库概念与 SQL
A relational database organises data into tables (relations) with rows (tuples) and columns (attributes). Each table should have a primary key that uniquely identifies each record. Foreign keys link tables to enforce referential integrity. Entity‑relationship (E‑R) diagrams model entities, attributes and relationships (one‑to‑one, one‑to‑many, many‑to‑many). Normalisation reduces data redundancy by eliminating partial and transitive dependencies, progressing through 1NF (atomic values, no repeating groups), 2NF (1NF + no partial key dependencies) and 3NF (2NF + no transitive dependencies).
关系数据库将数据组织为表(关系),由行(元组)和列(属性)构成。每个表应拥有一个主键,以唯一标识每条记录。外键则连接表并强制参照完整性。实体-关系(E-R)图对实体、属性和联系(一对一、一对多、多对多)建模。规范化通过消除部分依赖和传递依赖减少数据冗余,依次达到1NF(原子值、无重复组)、2NF(1NF + 无部分键依赖)和3NF(2NF + 无传递依赖)。
Structured Query Language (SQL) is used to define and manipulate databases. Key commands: SELECT column FROM table WHERE condition; retrieves data; INSERT INTO table VALUES (val1, val2); adds records; UPDATE table SET column = value WHERE condition; modifies; DELETE FROM table WHERE condition; removes. Aggregate functions (COUNT, SUM, AVG, MAX, MIN) and GROUP BY enable summarised queries. JOINS (INNER, LEFT, RIGHT) combine related tables.
结构化查询语言(SQL)用于定义和操作数据库。关键命令:SELECT 列名 FROM 表名 WHERE 条件;检索数据;INSERT INTO 表名 VALUES (值1, 值2);添加记录;UPDATE 表名 SET 列 = 值 WHERE 条件;修改;DELETE FROM 表名 WHERE 条件;删除。聚合函数(COUNT, SUM, AVG, MAX, MIN)与GROUP BY实现汇总查询。连接(INNER, LEFT, RIGHT)用于组合相关表。
9. Computational Thinking | 计算思维
Computational thinking is a problem‑solving approach that uses concepts fundamental to computer science. Abstraction involves focusing on the essential features while ignoring irrelevant details; for instance, modelling a map as a graph ignores terrain but retains connectivity. Decomposition breaks a large problem into smaller, more manageable sub‑problems, each of which can be solved independently. Algorithmic thinking expresses solutions as step‑by‑step sequences that can be implemented computationally. Pattern recognition identifies similarities to reuse existing solutions.
计算思维是一种运用计算机科学基础概念来解决问题的方法。抽象指聚焦于本质特征而忽略无关细节,例如将地图建模为图时忽略地形但保留连接关系。分解将大型问题拆分为更小、更易管理的子问题,各子问题可独立求解。算法思维将解决方案表达为可分步执行的序列,并能够在计算机上实现。模式识别则识别相似性以复用已有解决方案。
These pillars underpin the design of efficient algorithms and programs. Thinking ahead considers inputs, outputs and preconditions, often through caching or pre‑computation. Thinking procedurally involves structuring programs into procedures and functions, enhancing modularity and reusability. Thinking logically identifies the conditions, loops and control flow needed to arrive at a correct solution. Thinking concurrently recognises tasks that can be performed simultaneously, a vital skill for modern multicore and networked systems.
这些支柱支撑着高效算法和程序的设计。预判思维通过缓存或预计算来考虑输入、输出和前置条件。过程式思维将程序结构化为过程和函数,提升模块化和可重用性。逻辑思维识别达成正确解所需的条件、循环和控制流。并行思维识别可以同时执行的任务,这对现代多核和网络系统至关重要。
10. Algorithm Design & Efficiency | 算法设计与效率
Searching algorithms locate a target value in a dataset. Linear search checks every element sequentially until a match is found; worst‑case time complexity O(n). Binary search repeatedly divides a sorted array in half, comparing the target to the middle element and discarding the other half; O(log n). Sorting algorithms organise data: bubble sort compares adjacent items and swaps them if needed, O(n²); insertion sort builds a sorted sublist, O(n²); merge sort uses divide‑and‑conquer with recursion, O(n log n); quick sort selects a pivot and partitions, O(n log n) average but O(n²) worst case.
搜索算法在数据集中定位目标值。线性搜索逐个检查每个元素直至匹配,最坏时间复杂度为O(n)。二分查找反复将有序数组对半分,将目标与中间元素比较并丢弃另一半,时间复杂度为O(log n)。排序算法组织数据:冒泡排序比较相邻项并依需交换,O(n²);插入排序逐步构建有序子表,O(n²);归并排序采用递归分治策略,O(n log n);快速排序选取基准并分区,平均O(n log n),最坏O(n²)。
Computational complexity is measured using Big‑O notation, which describes the upper bound on time or space relative to input size n. O(1) is constant time (array index); O(log n) grows slowly (binary search); O(n) is linear (linear search); O(n log n) is typical for efficient sorts; O(n²) is quadratic, common in nested loops. Space complexity accounts for additional memory required beyond the input. Understanding complexity helps choose appropriate algorithms for large data sets, enabling scalability and performance optimisation.
计算复杂度用大O符号衡量,描述与输入规模n相关的时间或空间上界。O(1)为常数时间(数组索引);O(log n)增长缓慢(二分查找);O(n)是线性(线性搜索);O(n log n)是高效排序的典型复杂度;O(n²)为平方级,常见于嵌套循环。空间复杂度指除输入外所需的额外内存。理解复杂度有助于为大数据集选择合适的算法,从而实现可扩展性和性能优化。
11. Programming Languages & Translators | 编程语言与翻译器
Programming languages range from low‑level (machine code and assembly) to high‑level (Python, Java, C#). Machine code consists of binary instructions executed directly by the CPU, while assembly uses mnemonics like MOV, ADD. High‑level languages are closer to natural language and are portable across platforms. They provide abstractions such as variables, control structures and libraries. Language paradigms include procedural (step‑by‑step sequences), object‑oriented (objects with attributes and methods, encapsulation, inheritance, polymorphism), functional (pure functions, immutability, higher‑order functions) and declarative (describing what the result should be, e.g. SQL).
编程语言涵盖从低级(机器码和汇编)到高级(Python、Java、C#)的层次。机器码是由CPU直接执行的二进制指令,汇编语言则使用助记符如MOV、ADD。高级语言更接近自然语言,且跨平台可移植。它们提供变量、控制结构和库等抽象。语言范式包括过程式(分步序列)、面向对象(包含属性和方法的对象,封装、继承、多态)、函数式(纯函数、不可变性、高阶函数)和声明式(描述结果应是什么,如SQL)。
Object‑oriented programming (OOP) is a key focus in OCR. A class is a blueprint for objects; an object is an instance of a class. Encapsulation hides the internal state and exposes a public interface. Inheritance allows a subclass to derive properties and behaviours from a superclass, promoting code reuse. Polymorphism enables objects of different classes to respond to the same method call in their own way. UML class diagrams visually represent classes, attributes, methods and relationships.
面向对象编程(OOP)是OCR的重点内容。类是对象的蓝图;对象是类的实例。
Published by TutorHao | Year 12 Computer Science Revision Series | aleveler.com
更多咨询请联系16621398022(同微信)

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