Level sensor

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

Level sensor

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. What does a level sensor measure?
A The height of a liquid or solid in a container
B The temperature of the liquid in a container
2. Which use suits a level sensor better?
A Checking how much water is in a water tank
B Checking how bright a room is
3. A car's fuel gauge uses a level sensor. What data does it capture?
A How high the fuel is in the tank
B How fast the fuel flows through the engine
4. True or false: a level sensor can only be used with liquids.
A True - it can only measure liquids
B False - it can also measure solids such as grain or powder
5. A chemical vat must never overflow. Which sensor helps to prevent this?
A Humidity sensor
B Level sensor

Match the Pairs

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

Left columnRight column
1level sensor Adata captured = height of contents
2fuel gauge BIF level >= vatFullHeight THEN stop filling
3A level sensor captures the height of the contents of a container, such as the water in a tank CA level sensor can detect the height of both liquids and solids. Water tanks, fuel tanks and chemical vats are all common liquid uses.
4A level sensor can monitor how full a chemical vat is so that the vat is not overfilled DA use of a level sensor that tells the driver how much fuel is left in the tank
5A level sensor measures the temperature of the liquid in a tank EA level sensor does not measure temperature. It measures the height of the contents, which shows how full the container is. A temperature sensor measures temperature.
6A level sensor is only used for solids, never for liquids in a water tank FA sensor that measures how full a container is by detecting the height of a liquid or solid

Definitions

level sensor

Fill in the Blanks

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

1.
height ← ____(LevelSensor)
2.
tank ← READ(___________)
3.
level ← READ(LevelSensor) IF level _ 20 THEN OUTPUT "Fuel low"
4.
IF level >= 90 THEN OUTPUT "Tank full" _____
5.
_____ ← READ(LevelSensor) OUTPUT level

Spot the Error

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

Question 1
A level ← GET_LEVEL()
B IF level < 20 THEN
C OUTPUT "Stop the pump"
D ENDIF
Question 2
A fuel ← GET_LEVEL()
B IF fuel <= 10
C OUTPUT "Low fuel warning"
D ENDIF
Question 3
A tank ← GET_LEVEL()
B WHILE tank > 100
C OUTPUT "Filling"
D tank ← GET_LEVEL()
E ENDWHILE
Question 4
A vat ← GET_LEVEL()
B IF vat <= 90 THEN
C valve ← CLOSED
D ENDIF
Question 5
A level ← GET_LEVEL()
B percent ← level / 200 * 100
C OUTPUT percent & % full

Answer Key

Level sensor
Section A: Quick Questions
Q1
A — The height of a liquid or solid in a container
Q2
A — Checking how much water is in a water tank
Q3
A — How high the fuel is in the tank
Q4
B — False - it can also measure solids such as grain or powder
Q5
B — Level sensor
Section B: Match the Pairs
Q1
level sensor → A sensor that measures how full a container is by detecting the height of a liquid or solid
Q2
fuel gauge → A use of a level sensor that tells the driver how much fuel is left in the tank
Q3
A level sensor captures the height of the contents of a container, such as the water in a tank → data captured = height of contents
Q4
A level sensor can monitor how full a chemical vat is so that the vat is not overfilled → IF level >= vatFullHeight THEN stop filling
Q5
A level sensor measures the temperature of the liquid in a tank → A level sensor does not measure temperature. It measures the height of the contents, which shows how full the container is. A temperature sensor measures temperature.
Q6
A level sensor is only used for solids, never for liquids in a water tank → A level sensor can detect the height of both liquids and solids. Water tanks, fuel tanks and chemical vats are all common liquid uses.
Section C: Definitions
Q1
level sensor — A sensor that measures how full a container is by detecting the height of a liquid or solid, e.g. in a water tank, fuel gauge or chemical vat.
Section D: Fill in the Blanks
Q1
height ← READ(LevelSensor)
Q2
tank ← READ(LevelSensor)
Q3
level ← READ(LevelSensor) IF level < 20 THEN OUTPUT "Fuel low"
Q4
IF level >= 90 THEN OUTPUT "Tank full" ENDIF
Q5
level ← READ(LevelSensor) OUTPUT level
Section E: Spot the Error
Q1
C — A low level means the water tank is nearly empty, so the pump should be started, not stopped. The line should be OUTPUT "Start the pump".
Q2
B — An IF statement must end with THEN. The line should be IF fuel <= 10 THEN.
Q3
B — The tank should keep filling while the level is below full. With > 100 the loop would not run when the tank is not yet full. It should be WHILE tank < 100.
Q4
B — The inlet valve must close when the chemical vat is nearly full, which means a high level. It should be IF vat >= 90 THEN.
Q5
C — The text "% full" is a string, so it must be in quotation marks. It should be OUTPUT percent & "% full".