Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to start the CASE statement with the variable 'command'.
PLC Programming
CASE [1] OF 1: Start; 2: Stop; ELSE Idle; END_CASE;
Attempts:
3 left
💡 Hint
Common Mistakes
Using a variable name that is not defined like 'status' or 'mode'.
Leaving the CASE statement without a controlling variable.
✗ Incorrect
The CASE statement must use the variable 'command' to decide which action to take.
2fill in blank
mediumComplete the code to handle the case when 'command' equals 3.
PLC Programming
CASE command OF 1: Start; 2: Stop; [1]: Pause; ELSE Idle; END_CASE;
Attempts:
3 left
💡 Hint
Common Mistakes
Using a number not matching the Pause command.
Confusing the ELSE case with a specific case.
✗ Incorrect
The case for 'Pause' corresponds to when 'command' equals 3.
3fill in blank
hardFix the error in the CASE statement by completing the missing keyword.
PLC Programming
CASE command [1] 1: Start; 2: Stop; ELSE Idle; END_CASE;
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'IS', 'THEN', or 'DO' instead of 'OF'.
Omitting the keyword entirely.
✗ Incorrect
The correct syntax requires the keyword 'OF' after the CASE variable.
4fill in blank
hardFill both blanks to complete the CASE statement that handles commands 1 and 2.
PLC Programming
CASE command [1] [2]: Start; 2: Stop; ELSE Idle; END_CASE;
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'IS' instead of 'OF'.
Using wrong case numbers like 3 for Start.
✗ Incorrect
The CASE statement needs 'OF' after the variable and '1' to handle the Start command.
5fill in blank
hardFill all three blanks to create a CASE statement that returns 'Running' for 1, 'Stopped' for 2, and 'Paused' for 3.
PLC Programming
CASE [1] [2] 1: [3]; 2: Stopped; 3: Paused; ELSE Idle; END_CASE;
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong variable names like 'status'.
Using wrong keywords instead of 'OF'.
Putting wrong action names for case 1.
✗ Incorrect
The CASE statement uses 'command' as variable, 'OF' as keyword, and 'Running' as the action for case 1.
