Question bank › IB Computer Science › A1 Computer fundamentals

Control systems and translation (HL)

Answer on paper first, then reveal the mark scheme one mark at a time.

1CoreHL only3 marks

A home security system has a passive infrared (PIR) motion detector in the hallway. When the system is armed and movement is detected, a siren sounds.

(a) Identify the sensor and the actuator in this system. [2]

(b) State what is meant by a transducer. [1]

2CoreHL only4 marks

A washing machine controls each wash cycle using a microcontroller.

(a) In one model, the rinse stage simply runs the drum motor for 12 minutes and then stops. Outline why this stage is an example of open-loop control. [2]

(b) While filling, the machine keeps the water inlet valve open until a pressure sensor shows that the drum contains the required water level. Outline why this stage is an example of closed-loop control. [2]

3StandardHL only5 marks

The diagram shows the lane-keeping system of an autonomous vehicle. A camera measures the vehicle's position in the lane, a steering motor turns the wheels and a control algorithm runs on an onboard computer.

(a) Identify the components labelled A, B and C. [3]

(b) Describe the role of the feedback path in keeping the vehicle in the centre of the lane. [2]

Target laneposition+−errorABVehicleActualpositionCfeedback
Stuck on Control systems and translation (HL)?

Get it sorted in a free 30-minute session

We work through your weakest questions on this topic on Zoom. I reply the same day.

4StandardHL only5 marks

A thermostat uses the following control algorithm, run once every minute. The variable temp holds the latest sensor reading in °C.

setpoint = 20
heater_on = False

# repeated every minute
temp = read_sensor()
if temp < setpoint - 1:
    heater_on = True
elif temp > setpoint + 1:
    heater_on = False
set_heater(heater_on)

(a) The sensor returns these readings, in order: 18.5, 19.4, 20.6, 21.2, 20.8, 19.1, 18.9. The heater starts off. Trace the algorithm to give the state of the heater (ON or OFF) after each reading. [3]

(b) Explain why the algorithm uses a band of 1 °C either side of the set point instead of simply switching the heater on whenever temp < setpoint and off otherwise. [2]

5StandardHL only4 marks

A lift in a four-storey office building is run by a control system.

Explain how sensors and feedback are used to ensure that:

(a) the lift stops level with the floor that a passenger has requested; [2]

(b) the doors do not close on a passenger who is standing in the doorway. [2]

6HardHL only6 marks

A greenhouse irrigation system measures soil moisture continuously. The controller switches a water pump on when the moisture reading falls to 30% or below, and switches it off when the reading reaches 45% or above. The graph shows the sensor readings over 16 hours.

(a) Using the graph, state:

  (i) the two times at which the pump was switched on; [1]

  (ii) the time at which the pump was switched off. [1]

(b) The moisture reading continued to fall for about an hour after the pump was first switched on. Explain why. [2]

(c) Explain why this irrigation system is an example of closed-loop control. [2]

202530354045500246810121416Time / hoursSoil moisture / %ON threshold (30%)OFF threshold (45%)
7CoreHL only3 marks

A programmer writes an application in Java. The compiler translates it into bytecode, which is distributed to users running Windows, macOS and Linux.

(a) State what is meant by bytecode. [1]

(b) Outline why distributing the program as bytecode makes it portable. [2]

8StandardHL only5 marks

A small studio is building a mobile game.

(a) While designing new levels, the developers change the level-scripting code many times an hour and test each change immediately. Explain why an interpreter is suitable for this work. [2]

(b) The physics engine must perform millions of calculations per second on a phone processor. Explain why a compiler is more suitable for this part of the game. [2]

(c) Outline one difference between how a compiler and an interpreter report errors in a program. [1]

9StretchHL only6 marks

A bytecode virtual machine can either interpret every instruction or use just-in-time (JIT) compilation. For a particular loop, measurements show:

ModeBehaviour
Interpreter onlyEach iteration takes 50 µs.
With JITThe first 1000 iterations are interpreted (50 µs each) while the VM detects that the loop is ‘hot’. It then spends 20 ms compiling the loop to native code. Every later iteration takes 2 µs.

(a) Calculate the total time taken for 10 000 iterations in each mode. Give your answers in ms. [2]

(b) Calculate the smallest number of iterations for which the JIT mode is faster overall. [2]

(c) Explain why the VM interprets the loop first instead of compiling all of the program to native code before it starts running. [2]

10StretchHL only6 marks

A company is developing a photo-editing application that must run on Windows laptops, Apple computers and Linux workstations. It is considering two approaches:

  • Approach 1: compile the source code separately into native machine code for each platform.
  • Approach 2: compile the source code once into bytecode, which users run on a virtual machine that uses JIT compilation.

Evaluate the two approaches for this application. [6]

Stuck on this topic?

Book a free 30-minute session on WhatsApp and we'll find exactly which step is costing you the marks. Or build a timed paper on it.

Free 30-minute session