← IGCSE Computer Science Paper 1

Proximity sensor

A sensor that detects whether an object is nearby, or how far away it is, without touching it. Used in parking sensors, phones turning off the screen during calls and automatic doors.

Understanding Proximity sensor in IGCSE Computer Science Paper 1

What it does: The sensor captures whether an object (a person) is near, and the microprocessor responds by opening the door with no contact needed. Proximity sensors can capture how far away an object is, which is stored as a distance value that the system can then use. Parking sensors detect how close an object is. Measuring soil water needs a moisture sensor. The proximity sensor notices your face is near the screen. The phone turns the screen off to save power and stop accidental touches. The proximity sensor detects the nearby car. An acoustic sensor detects sound, which is not reliable for this job.

Common mistakes: An IF statement must end with THEN. The line should be: IF distance < 50 THEN. When the proximity sensor detects someone nearby, the automatic door should open. The line should be: door ← "open".

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 283–292) and word search (Modules 283–303).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
What does a proximity sensor detect?
Whether an object is nearby, or how far away it isThe temperature of the air around it
Matches
if touched: screen_off()
↓
A proximity sensor detects an object nearby WITHOUT touching it, so the condition should check for a nearby object (for example object_near), not a touch.
Applying
Meanings
Term
proximity sensor
Meaning
A sensor that detects whether an object is nearby, or how far away it is, without touching it. Used in parking sensors, phones turning off the screen during calls and automatic doors.
Practice
INPUT distance
Testing
Gaps
distance ← ()
Check Answer
Spots
2 distance ← PROXIMITY_SENSOR()
3 IF distance < 50

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Angelfish' badge — Reef Perfectionist, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. What does a proximity sensor detect?
A. Whether an object is nearby, or how far away it is ✓
B. The temperature of the air around it
A proximity sensor captures data about a nearby object or its distance, not temperature.
2. Does a proximity sensor need to touch an object to detect it?
A. No, it detects the object without touching it ✓
B. Yes, it must press against the object
Proximity sensors work without contact. That is what makes them useful for things like parking.
3. Which device is a use of a proximity sensor?
A. Parking sensors that beep as a car gets close to a wall ✓
B. A greenhouse system that measures soil water
Parking sensors detect how close an object is. Measuring soil water needs a moisture sensor.
4. Why does a phone screen turn off during a call?
A. A pH sensor detects that you are talking
B. A proximity sensor detects the phone is held next to your face ✓
The proximity sensor notices your face is near the screen. The phone turns the screen off to save power and stop accidental touches.
5. Which sensor helps an automatic door open when someone walks up to it?
A. Gas sensor
B. Proximity sensor ✓
The proximity sensor detects a person nearby, and the microprocessor then tells an actuator to open the door.

Match the Pairs

if distance < 30: beep() → Reads the proximity sensor's distance value and sounds a warning when an object is closer than 30 cm, like a parking sensor
if object_near: screen_off() → Turns the phone screen off when the proximity sensor detects the phone is held against the face during a call
A proximity sensor on an automatic door detects a person nearby without touching them, so the door opens → if person_near: open_door()
A parking sensor captures the distance to an object, so the data can be a number, not just near or not near → distance = proximity_sensor.read()
if touched: screen_off() → A proximity sensor detects an object nearby WITHOUT touching it, so the condition should check for a nearby object (for example object_near), not a touch.
if temperature > 30: open_door() → An automatic door uses a proximity sensor, so the condition should test whether a person is near (person_near), not read a temperature value.

Key Term

proximity sensor
A sensor that detects whether an object is nearby, or how far away it is, without touching it. Used in parking sensors, phones turning off the screen during calls and automatic doors.

Fill in the Blanks

1. distance ← ProximitySensor()
Hint: Type the name of the function that reads the value from the proximity sensor.
2. IF distance < 50 THEN OUTPUT "Beep" ENDIF
Hint: Type the comparison operator that means the object is closer than the limit.
3. IF onCall = TRUE AND near = TRUE THEN ScreenOff() ENDIF
Hint: Type the logical operator that needs both conditions to be true.
4. IF objectNear = TRUE THEN OpenDoor() ENDIF
Hint: Type the keyword that starts the code to run when the condition is true.
5. distance ← ProximitySensor() IF distance <= 30 THEN OUTPUT "Stop" ENDIF
Hint: Type the variable that stores the reading from the proximity sensor.

Spot the Error

Question 1
A REPEAT
B distance ← PROXIMITY_SENSOR()
C IF distance < 50
D SOUND_BUZZER()
E ENDIF
F UNTIL gear = "park"
Line C — An IF statement must end with THEN. The line should be: IF distance < 50 THEN.
Question 2
A door ← "closed"
B nearby ← PROXIMITY_SENSOR()
C IF nearby = TRUE THEN
D door ← "closed"
E ENDIF
Line D — When the proximity sensor detects someone nearby, the automatic door should open. The line should be: door ← "open".
Question 3
A ON call_start
B near ← PROXIMITY_SENSOR()
C IF near = FALSE THEN
D screen ← "off"
E ENDIF
Line C — The screen should turn off when the phone is near the ear, so the test must be near = TRUE, not FALSE.
Question 4
A distance ← PROXIMITY_SENSOR()
B IF distance < 100 THEN
C OUTPUT "Path is clear"
D ELSE
E OUTPUT "Path is clear"
F ENDIF
Line C — This branch runs when the distance is small, so an object is close. The message should be: OUTPUT "Object is close".
Question 5
A WHILE TRUE
B d ← PROXIMITY_SENSOR()
C IF d < 80 THEN
D MOTOR_OFF()
E ENDIF
F ENDWHILE
Line D — When the sensor detects a person close to the door, the microprocessor must switch the motor on to open it. It should be MOTOR_ON().

Student with a class code? Join your class →