Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to start the pump when the level is low.
PLC Programming
IF level_sensor = [1] THEN
pump := TRUE;
END_IF;Attempts:
3 left
💡 Hint
Common Mistakes
Using HIGH instead of LOW to start the pump.
Confusing pump ON/OFF with sensor states.
✗ Incorrect
The pump should start when the level sensor reads LOW, indicating the tank is empty or below the threshold.
2fill in blank
mediumComplete the code to stop the pump when the level is high.
PLC Programming
IF level_sensor = [1] THEN
pump := FALSE;
END_IF;Attempts:
3 left
💡 Hint
Common Mistakes
Stopping the pump when the level is LOW instead of HIGH.
Mixing sensor states with pump states.
✗ Incorrect
The pump should stop when the level sensor reads HIGH, meaning the tank is full.
3fill in blank
hardFix the error in the code to correctly check the level sensor and control the pump.
PLC Programming
IF level_sensor [1] HIGH THEN
pump := FALSE;
ELSE
pump := TRUE;
END_IF;Attempts:
3 left
💡 Hint
Common Mistakes
Using '=' instead of '==' for comparison.
Using '!=' or '<>' which may not be supported in this context.
✗ Incorrect
In PLC programming, '=' is used for assignment, '==' is used to compare values for equality.
4fill in blank
hardFill both blanks to create a condition that starts the pump only when the level is low and the emergency stop is not active.
PLC Programming
IF level_sensor = [1] AND emergency_stop = [2] THEN pump := TRUE; END_IF;
Attempts:
3 left
💡 Hint
Common Mistakes
Using HIGH instead of LOW for level_sensor.
Using TRUE for emergency_stop which means the stop is active.
✗ Incorrect
The pump starts when the level is LOW and emergency_stop is FALSE (not active).
5fill in blank
hardFill all three blanks to create a dictionary mapping sensor names to their states, filtering only sensors that are active (TRUE).
PLC Programming
active_sensors = { [1]: [2] for [1] in sensors if sensors[[1]] == TRUE }Attempts:
3 left
💡 Hint
Common Mistakes
Using different variable names inconsistently.
Not filtering sensors that are TRUE.
✗ Incorrect
We use 'sensor' as the loop variable and key, 'sensors[sensor]' as the value, and filter where sensors[sensor] is TRUE.
