Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to check if the input is ON and set the output accordingly.
PLC Programming
IF input [1] TRUE THEN
output := TRUE;
ELSE
output := FALSE;
END_IF;Attempts:
3 left
💡 Hint
Common Mistakes
Using '==' instead of '=' for comparison.
Using ':=' which is for assignment, not comparison.
✗ Incorrect
In PLC programming, the IF statement uses '=' to compare values, not '==' or ':='.
2fill in blank
mediumComplete the code to check if temperature is above 100 and activate alarm.
PLC Programming
IF temperature [1] 100 THEN alarm := TRUE; ELSE alarm := FALSE; END_IF;
Attempts:
3 left
💡 Hint
Common Mistakes
Using '<' which checks if temperature is less than 100.
Using '>=' which includes 100, but the task wants strictly above.
✗ Incorrect
We want to activate the alarm when temperature is greater than 100, so use '>'.
3fill in blank
hardFix the error in the IF statement to correctly check if pressure equals 50.
PLC Programming
IF pressure [1] 50 THEN valve := OPEN; ELSE valve := CLOSED; END_IF;
Attempts:
3 left
💡 Hint
Common Mistakes
Using ':=' which causes syntax errors in IF conditions.
Using '==' which is not standard in PLC languages.
✗ Incorrect
In PLC languages, '=' is used for comparison, not ':=' or '=='.
4fill in blank
hardFill both blanks to check if speed is less than 60 and set status accordingly.
PLC Programming
IF speed [1] 60 THEN status := [2]; ELSE status := STOPPED; END_IF;
Attempts:
3 left
💡 Hint
Common Mistakes
Using '>' instead of '<' for the speed check.
Setting status to IDLE instead of RUNNING when speed is less than 60.
✗ Incorrect
We check if speed is less than 60 using '<'. If true, status is set to RUNNING.
5fill in blank
hardFill all three blanks to create a nested IF that checks temperature and pressure.
PLC Programming
IF temperature [1] 80 THEN IF pressure [2] 30 THEN alarm := [3]; ELSE alarm := FALSE; END_IF; ELSE alarm := FALSE; END_IF;
Attempts:
3 left
💡 Hint
Common Mistakes
Using '<' for temperature check instead of '>'.
Setting alarm to FALSE inside nested IF when conditions are met.
✗ Incorrect
The code checks if temperature is greater than 80 and pressure less than 30, then sets alarm to TRUE.
