Gas sensor

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

Gas sensor

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. What does a gas sensor measure?
A The presence or concentration of a particular gas in the air
B The amount of light falling on it
2. Which device would use a gas sensor to protect people at home?
A A barcode scanner
B A carbon monoxide alarm
3. A gas sensor is an input device. True or false?
A True: it captures data from the environment and sends it to the processor
B False: it displays results to the user
4. Which is the best use of a gas sensor?
A Detecting a gas leak in a kitchen or factory
B Detecting when a door is opened by a magnet
5. What data does a gas sensor capture?
A Water level
B Gas concentration

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
1gas sensor AA gas sensor measures gas concentration, not temperature. A temperature sensor measures temperature.
2gas concentration BThe data a gas sensor captures: how much of a particular gas is in the air
3A gas sensor in a carbon monoxide alarm detects a dangerous gas and triggers a warning CA gas sensor is an input device. It detects gas in the air and does not release it.
4A breathalyser uses a gas sensor to measure the alcohol concentration in a person's breath Dreading = gas_sensor.read("alcohol")
5A gas sensor is an output device that releases gas into the air EAn input device that detects the presence or concentration of a particular gas in the air
6A gas sensor in a gas leak detector measures the temperature of the room Fif gas_sensor >= safe_limit: sound_alarm()

Definitions

gas sensor

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
IF coLevel _ 50 THEN OUTPUT "Sound alarm" ENDIF
2.
gasLevel ← _________.READ()
3.
IF gasLevel > 30 THEN ______ "Gas leak!" ENDIF
4.
IF alcoholLevel > limit ____ OUTPUT "Over the limit" ENDIF
5.
REPEAT airLevel ← gasSensor.READ() UNTIL ________ > 50

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A INPUT co FROM gas_sensor
B IF co < 50 THEN
C OUTPUT "Alarm on"
D ENDIF
Question 2
A leak ← gas_sensor_value
B IF leak > 20 THEN
C valve ← OPEN
D ENDIF
Question 3
A alcohol ← gas_sensor_value
B limit ← 35
C IF alcohol > limit
D OUTPUT "Over the limit"
E ENDIF
Question 4
A WHILE TRUE
B level ← gas_sensor_value
C IF level > 100 THEN
D OUTPUT Poor air
E ENDIF
F ENDWHILE
Question 5
A DECLARE co : STRING
B co ← gas_sensor_value
C OUTPUT co

Answer Key

Gas sensor
Section A: Quick Questions
Q1
A — The presence or concentration of a particular gas in the air
Q2
B — A carbon monoxide alarm
Q3
A — True: it captures data from the environment and sends it to the processor
Q4
A — Detecting a gas leak in a kitchen or factory
Q5
B — Gas concentration
Section B: Match the Pairs
Q1
gas sensor → An input device that detects the presence or concentration of a particular gas in the air
Q2
gas concentration → The data a gas sensor captures: how much of a particular gas is in the air
Q3
A gas sensor in a carbon monoxide alarm detects a dangerous gas and triggers a warning → if gas_sensor >= safe_limit: sound_alarm()
Q4
A breathalyser uses a gas sensor to measure the alcohol concentration in a person's breath → reading = gas_sensor.read("alcohol")
Q5
A gas sensor is an output device that releases gas into the air → A gas sensor is an input device. It detects gas in the air and does not release it.
Q6
A gas sensor in a gas leak detector measures the temperature of the room → A gas sensor measures gas concentration, not temperature. A temperature sensor measures temperature.
Section C: Definitions
Q1
gas sensor — An input device that detects the presence or concentration of a particular gas in the air, e.g. in carbon monoxide alarms, gas leak detection, air quality checks and breathalysers.
Section D: Fill in the Blanks
Q1
IF coLevel > 50 THEN OUTPUT "Sound alarm" ENDIF
Q2
gasLevel ← gasSensor.READ()
Q3
IF gasLevel > 30 THEN OUTPUT "Gas leak!" ENDIF
Q4
IF alcoholLevel > limit THEN OUTPUT "Over the limit" ENDIF
Q5
REPEAT airLevel ← gasSensor.READ() UNTIL airLevel > 50
Section E: Spot the Error
Q1
B — The carbon monoxide alarm must sound when the gas level is too HIGH. The condition should be IF co > 50 THEN, not less than.
Q2
C — When the gas sensor detects a leak, the valve must be closed to stop the gas. It should be valve ← CLOSED.
Q3
C — An IF statement needs the keyword THEN after the condition. The line should be IF alcohol > limit THEN.
Q4
D — Text to be displayed must be written inside quotation marks. It should be OUTPUT "Poor air".
Q5
A — A gas sensor captures a number, the gas concentration, so the variable should be a numeric type such as INTEGER, not STRING.