📚 AS CAIE Computer Science: Interdisciplinary Integrated Question Training | AS CAIE 计算机:跨学科综合题型训练
In the Cambridge AS Computer Science course, theoretical knowledge becomes truly powerful when applied across subject boundaries. This article presents a series of integrated question scenarios that combine computing with mathematics, physics, biology, business, and other disciplines. Each problem is designed to test your algorithmic thinking, programming skills, and system design abilities in contexts that mirror real-world challenges.
在剑桥 AS 计算机科学课程中,当理论知识跨越学科边界应用时,才真正展现其力量。本文提供一系列综合题型情景,将计算与数学、物理、生物、商业等学科结合起来。每个问题旨在测试你在反映真实世界挑战的背景下,运用算法思维、编程技能和系统设计能力。
1. Mathematics & Algorithms: Fibonacci Sequence Analysis | 数学与算法:斐波那契数列分析
A common mathematical sequence appears in nature and computer science: the Fibonacci series, where each term is the sum of the two preceding ones. You are asked to design an algorithm that returns the n-th Fibonacci number and to compare two different approaches — recursion and iteration — in terms of time complexity and resource usage.
一个常见的数学序列出现在自然界和计算机科学中:斐波那契数列,其中每一项是前两项之和。你需要设计一个算法返回第 n 个斐波那契数,并比较两种不同方法——递归与迭代——在时间复杂度和资源使用方面的差异。
-
An iterative solution uses a loop and two variables to accumulate values; its time complexity is O(n) with O(1) auxiliary space.
迭代解法使用一个循环和两个变量来累加数值,时间复杂度为 O(n),辅助空间为 O(1)。
-
A naive recursive solution calls itself twice for each call, leading to an exponential time complexity O(2ⁿ), which quickly becomes infeasible for n > 40.
朴素递归解法每次调用自身两次,导致指数级时间复杂度 O(2ⁿ),当 n > 40 时很快变得不可行。
-
Pseudocode for iteration: IF n = 0 OR n = 1 THEN RETURN n; a ← 0; b ← 1; FOR i ← 2 TO n; c ← a + b; a ← b; b ← c; ENDFOR; RETURN b;
迭代伪代码:如果 n = 0 或 n = 1 则返回 n;a ← 0;b ← 1;对于 i 从 2 到 n;c ← a + b;a ← b;b ← c;循环结束;返回 b;
-
Recursive pseudocode: FUNCTION Fib(n) IF n <= 1 THEN RETURN n; RETURN Fib(n-1) + Fib(n-2); ENDFUNCTION; This illustrates call tree redundancy.
递归伪代码:函数 Fib(n) 如果 n <= 1 则返回 n;返回 Fib(n-1) + Fib(n-2);结束函数; 这展示了调用树的冗余。
-
The comparison highlights the importance of algorithm efficiency, a core topic in problem-solving and computational thinking for AS exams.
比较突出了算法效率的重要性,这是 AS 考试中问题解决与计算思维的核心主题。
2. Physics Simulation: Projectile Motion Calculator | 物理模拟:抛体运动计算器
Simulating a simple physics phenomenon helps illustrate programming with mathematical functions. Given initial velocity v₀ and launch angle θ, write a program that calculates the maximum height and horizontal range of a projectile, assuming negligible air resistance and g = 9.81 m/s².
模拟一个简单的物理现象有助于说明如何用数学函数编程。给定初速度 v₀ 和发射角 θ,编写一个程序计算抛体的最大高度和水平射程,假设空气阻力可忽略,重力加速度 g = 9.81 m/s²。
-
The vertical displacement formula is hₘₐₓ = (v₀² × sin²θ) / (2g). The range R = (v₀² × sin 2θ) / g.
垂直位移公式为 hₘₐₓ = (v₀² × sin²θ) / (2g)。射程 R = (v₀² × sin 2θ) / g。
-
Convert angle from degrees to radians before using trigonometric functions: thetaRad ← thetaDeg × π / 180.
使用三角函数前将角度从度转换为弧度:弧度 ← 角度 × π / 180。
-
Input validation must check that velocity > 0 and 0 < θ < 90; otherwise output an error message.
输入验证必须检查速度大于 0 且 0 < θ < 90;否则输出错误消息。
-
Key programming concepts: built-in math libraries (sin, cos), data type considerations (real/float), and structuring output with appropriate decimal places.
关键编程概念:内置数学库(sin、cos),数据类型考虑(实数/浮点),以及用适当小数位数构造输出。
-
This question integrates physics equations, testing your ability to translate scientific models into correct algorithmic steps.
此问题结合了物理方程,测试你将科学模型转化为正确算法步骤的能力。
3. Bioinformatics: DNA Sequence Pattern Matching | 生物信息学:DNA序列模式匹配
Biological data often comes in long strings over the alphabet {A, C, G, T}. Given a DNA sequence as a string, develop an algorithm that counts all occurrences of a given pattern, e.g., ‘ATG’, and returns the starting indices where the pattern is found.
生物数据通常由字母表 {A、C、G、T} 组成的长串表示。给定一个 DNA 序列作为一个字符串,设计一个算法,统计给定模式(如 ‘ATG’)的所有出现次数,并返回找到该模式的起始索引。
-
A linear search scans the sequence from position 0 to length(sequence)-length(pattern), checking substring equality at each step.
线性搜索从位置 0 扫描到 长度(序列)-长度(模式),在每一步检查子串是否相等。
-
Pseudocode: count ← 0; FOR i ← 0 TO LEN(sequence)-LEN(pattern); IF MID(sequence, i, LEN(pattern)) = pattern THEN count ← count + 1; OUTPUT i; ENDFOR;
伪代码:count ← 0;对于 i 从 0 到 长度(序列)-长度(模式);如果 取子串(序列, i, 长度(模式)) = 模式 则 count ← count + 1;输出 i;循环结束;
-
This reinforces string handling techniques: substrings, concatenation, and indexing — fundamental in high-level programming languages.
这强化了字符串处理技术:子串、连接和索引——这是高级编程语言中的基础。
-
Extend the problem: allow patterns that contain a wildcard character ‘?’ which can match any single base, introducing simple pattern matching logic.
扩展问题:允许模式包含通配符 ‘?’,它可以匹配任何单个碱基,引入简单的模式匹配逻辑。
-
The exercise shows how computational methods support genomic research, linking computer science with biology and medicine.
该练习展示了计算方法如何支持基因组研究,将计算机科学与生物学和医学联系起来。
4. Economics: Break-even Analysis with Programming | 经济学:用编程进行盈亏平衡分析
A business analyst needs a tool to calculate the break-even point — the number of units that must be sold so that total revenue equals total costs. You are to implement a program that takes fixed costs, variable cost per unit, and selling price per unit, then outputs the break-even quantity.
商业分析师需要一种工具来计算盈亏平衡点——即必须销售的单位数量,使总收入等于总成本。你需要实现一个程序,输入固定成本、单位可变成本和单位售价,然后输出盈亏平衡数量。
-
The break-even quantity Q is given by:
Q = Fixed Costs ÷ (Selling Price − Variable Cost)
, provided price > variable cost.
盈亏平衡数量 Q 由下式给出:
Q = 固定成本 ÷ (售价 − 可变成本)
,前提是价格大于可变成本。
-
If price ≤ variable cost, the program should report that break-even is impossible because there is no positive contribution margin.
如果价格 ≤ 可变成本,程序应报告盈亏平衡不可能,因为没有正的边际贡献。
-
Use meaningful variable names, cast inputs to appropriate numeric types, and round up the quantity since it must be an integer (you cannot sell a fraction of a product).
使用有意义的变量名,将输入转换为适当的数值类型,并向上取整数量,因为它必须是整数(不能销售分数产品)。
-
The problem introduces basic financial modelling and reinforces selection statements (IF…THEN…ELSE) and arithmetic operations.
该问题引入了基本的财务建模,并强化了选择语句(如果…那么…否则)和算术运算。
-
This cross-disciplinary scenario demonstrates how computing aids decision-making in business and economics.
这一跨学科情景展示了计算如何帮助商业和经济学中的决策。
5. Environmental Science: Weather Station Data Logging | 环境科学:气象站数据记录
An automated weather station uses a temperature sensor to collect readings every second. You must design a data-logging system that records these readings, stores them in an array, and computes the average temperature over a 10-second interval before transmitting a summary.
一个自动气象站使用温度传感器每秒采集一次读数。你必须设计一个数据记录系统,记录这些读数,将其存储在一个数组中,并在传输摘要之前计算 10 秒间隔内的平均温度。
-
The sensor produces an analogue voltage which is converted by an ADC (analogue-to-digital converter), illustrating the role of hardware and data representation.
传感器产生模拟电压,由 ADC(模数转换器)转换,说明了硬件与数据表示的作用。
-
Sampling frequency of 1 Hz means the system must handle data acquisition within a timed loop, possibly using polling or timer interrupts.
1 Hz 的采样频率意味着系统必须在定时循环内处理数据采集,可能使用轮询或定时器中断。
-
Pseudocode for averaging: FOR i ← 0 TO 9; READ sensor → readings[i]; sum ← sum + readings[i]; PAUSE 1 second; ENDFOR; average ← sum / 10;
求平均值的伪代码:对于 i 从 0 到 9;读取传感器 → readings[i];sum ← sum + readings[i];暂停 1 秒;循环结束;average ← sum / 10;
-
Data storage can involve writing to a file or transmitting to a central database, raising issues of data integrity and backup.
数据存储可涉及写入文件或传输到中央数据库,引发数据完整性和备份问题。
-
The scenario blends concepts from sensors, ADC, buffering, and simple statistical processing — ideal for integrated exam questions.
该情景融合了传感器、ADC、缓冲和简单统计处理的概念——非常适合综合性考题。
6. Statistics: Correlation Coefficient Calculation | 统计学:相关系数计算
Given two sets of paired data, such as hours of study and exam scores, write an algorithm to compute the Pearson correlation coefficient r, which measures the strength of linear relationship.
给定两组配对数据,例如学习小时数和考试成绩,编写一个算法计算皮尔逊相关系数 r,它衡量线性关系的强度。
-
Formula:
r = Σ((x − x̄)(y − ȳ)) / √(Σ(x − x̄)² × Σ(y − ȳ)²)
, where x̄ and ȳ are the means.
公式:
r = Σ((x − x̄)(y − ȳ)) / √(Σ(x − x̄)² × Σ(y − ȳ)²)
,其中 x̄ 和 ȳ 是平均值。
-
First pass computes sums and means; second pass computes deviations and the product sum. This is a classic two-pass algorithm.
第一遍计算总和与平均值;第二遍计算偏差与乘积和。这是一个经典的两遍算法。
-
Use arrays to store the data; ensure inputs are of equal length and handle division by zero when there is no variation.
使用数组存储数据;确保输入长度相等,并在没有变异时处理除以零的情况。
-
The algorithm can be optimised into a single pass using the formula r = (nΣxy − Σx Σy) / √([nΣx² − (Σx)²][nΣy² − (Σy)²]).
该算法可以优化为单遍形式,使用公式 r = (nΣxy − Σx Σy) / √([nΣx² − (Σx)²][nΣy² − (Σy)²])。
-
This problem tests iteration, array handling, accumulated totals, and awareness of floating-point precision — all within a statistical context.
此问题测试迭代、数组处理、累加总和和浮点精度意识——全部在统计学背景下。
7. Business: Inventory Database Design | 商业:库存数据库设计
A retail shop needs a relational database to manage its inventory. Design tables to store information about products, suppliers, and stock levels, ensuring the design is in third normal form (3NF).
一家零售店需要一个关系数据库来管理其库存。设计表格以存储产品、供应商和库存水平的信息,确保设计符合第三范式 (3NF)。
-
Identify three entities: Product (ProductID, Name, UnitPrice, SupplierID), Supplier (SupplierID, SupplierName, Contact), and Stock (StockID, ProductID, Quantity, ReorderLevel).
识别三个实体:Product(ProductID、Name、UnitPrice、SupplierID)、Supplier(SupplierID、SupplierName、Contact)和 Stock(StockID、ProductID、Quantity、ReorderLevel)。
-
Primary keys underlined; foreign keys (SupplierID in Product, ProductID in Stock) ensure referential integrity. No repeating groups, no partial dependencies, making it 3NF.
主键加下划线;外键(Product 中的 SupplierID,Stock 中的 ProductID)确保参照完整性。没有重复组,没有部分依赖,使其达到 3NF。
-
SQL query to find products with stock below reorder level: SELECT Product.Name FROM Product INNER JOIN Stock ON Product.ProductID = Stock.ProductID WHERE Stock.Quantity < Stock.ReorderLevel;
查找库存低于再订购水平的产品的 SQL 查询:SELECT Product.Name FROM Product INNER JOIN Stock ON Product.ProductID = Stock.ProductID WHERE Stock.Quantity < Stock.ReorderLevel;
-
Discuss data types: integer for IDs and quantities, decimal/currency for price, string for names, demonstrating data dictionary design.
讨论数据类型:ID 和数量用整数,价格用十进制/货币,名称用字符串,展示数据字典设计。
-
This scenario links business operations with database concepts, a common area in AS examination 9618.
此情景将商业运作与数据库概念联系起来,这是 AS 考试 9618 中常见的领域。
8. Psychology: Reaction Time Measurement | 心理学:反应时间测量
Design a computer-based experiment to measure a person’s reaction time. The program waits a random delay, then displays a stimulus; the user must press a key, and the elapsed time is recorded with millisecond accuracy.
设计一个基于计算机的实验来测量人的反应时间。程序等待一个随机延迟,然后显示刺激;用户必须按下一个键,记录经过的时间,精度为毫秒。
-
The system relies on a high-resolution timer; polling the keyboard in a loop can measure time, but event-driven input with interrupts yields more accurate readings.
该系统依赖高分辨率定时器;在循环中轮询键盘可以测量时间,但中断驱动的事件输入产生更准确的读数。
-
Generate a random interval between 2 and 5 seconds using a random number generator, to avoid anticipation.
使用随机数生成器产生 2 到 5 秒之间的随机间隔,以避免预期。
-
Pseudocode for reaction measurement: delay ← RANDOM(2000,5000); SLEEP(delay); startTime ← CURRENT_MILLISECONDS(); DISPLAY stimulus; WAIT for keypress; endTime ← CURRENT_MILLISECONDS(); reaction ← endTime − startTime;
反应测量的伪代码:delay ← RANDOM(2000,5000);SLEEP(delay);startTime ← CURRENT_MILLISECONDS();显示刺激;等待按键;endTime ← CURRENT_MILLISECONDS();reaction ← endTime − startTime;
-
Ethical considerations: informed consent, data anonymisation, and the right to withdraw, as psychological experiments require.
伦理考虑:知情同意、数据匿名化以及退出权利,正如心理学实验所要求的那样。
-
This integrates timing, interrupts, human-computer interaction hardware, and ethical issues — all relevant to the AS syllabus.
这融合了定时、中断、人机交互硬件和伦理问题——所有都与 AS 大纲相关。
9. Geography: GPS Coordinate Processing | 地理:GPS坐标处理
GPS devices provide location data as latitude and longitude. To compute the distance between two points on Earth’s surface, you need the Haversine formula. Write a program that inputs two coordinate pairs and outputs the great-circle distance.
GPS 设备提供纬度和经度作为位置数据。要计算地球表面两点之间的距离,需要使用 Haversine 公式。编写一个程序,输入两个坐标对并输出大圆距离。
-
Haversine formula components: a = sin²(Δlat/2) + cos(lat1) × cos(lat2) × sin²(Δlon/2); c = 2 × atan2(√a, √(1−a)); distance = R × c, where R is Earth’s mean radius (6371 km).
Haversine 公式组成部分:a = sin²(Δlat/2) + cos(lat1) × cos(lat2) × sin²(Δlon/2);c = 2 × atan2(√a, √(1−a));距离 = R × c,其中 R 是地球平均半径(6371 公里)。
-
All angular values must be in radians; conversion factor: rad = deg × π / 180.
所有角度值必须使用弧度;转换因子:弧度 = 度 × π / 180。
-
Data types: use double-precision floating-point to minimise rounding errors over large distances.
数据类型:使用双精度浮点数,以最小化远距离的舍入误差。
-
The program should validate latitude (−90 to 90) and longitude (−180 to 180). Invalid inputs must be rejected.
程序应验证纬度(−90 到 90)和经度(−180 到 180)。无效输入必须被拒绝。
-
This exercise reinforces the use of complex mathematical functions, testing the ability to implement geographic calculations — a perfect blend of geography and computer science.
此练习强化了复杂数学函数的使用,测试实现地理计算的能力——这是地理与计算机科学的完美结合。
Published by TutorHao | Computer Science Revision Series | aleveler.com
更多咨询请联系16621398022(同微信)
屏轩国际教育cambridge primary/secondary checkpoint, cat4, ukiset,ukcat,igcse,alevel,PAT,STEP,MAT, ibdp,ap,ssat,sat,sat2课程辅导,国外大学本科硕士研究生博士课程论文辅导Cancel reply