Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to declare a program organization unit named 'MainProgram'.
PLC Programming
PROGRAM [1]
END_PROGRAMAttempts:
3 left
💡 Hint
Common Mistakes
Using a keyword like 'Start' or 'Init' instead of the intended program name.
Leaving the program name blank.
✗ Incorrect
The keyword PROGRAM is followed by the name of the program organization unit. 'MainProgram' is the correct name here.
2fill in blank
mediumComplete the code to declare a function block named 'Counter'.
PLC Programming
FUNCTION_BLOCK [1]
VAR
count : INT;
END_VAR
END_FUNCTION_BLOCKAttempts:
3 left
💡 Hint
Common Mistakes
Using a name that does not match the intended function block.
Confusing function block names with program names.
✗ Incorrect
The FUNCTION_BLOCK keyword is followed by the name of the function block. 'Counter' is the correct name here.
3fill in blank
hardFix the error in the program declaration by completing the missing keyword.
PLC Programming
[1] MainProgram
VAR
speed : INT;
END_VAR
END_PROGRAMAttempts:
3 left
💡 Hint
Common Mistakes
Using FUNCTION_BLOCK or FUNCTION instead of PROGRAM.
Omitting the keyword entirely.
✗ Incorrect
The correct keyword to start a program organization unit is PROGRAM.
4fill in blank
hardFill both blanks to declare a function named 'Calculate' that returns an INT.
PLC Programming
FUNCTION [1] : [2] VAR_INPUT value1 : INT; value2 : INT; END_VAR_INPUT END_FUNCTION
Attempts:
3 left
💡 Hint
Common Mistakes
Using a wrong return type like BOOL when INT is expected.
Mixing up the function name and return type positions.
✗ Incorrect
The function name is 'Calculate' and the return type is 'INT'.
5fill in blank
hardFill both blanks to create a method named 'StartMotor' inside a function block 'MotorControl' with no return value.
PLC Programming
FUNCTION_BLOCK MotorControl METHOD [1] : [2] VAR_INPUT speed : INT; END_VAR_INPUT END_METHOD END_FUNCTION_BLOCK
Attempts:
3 left
💡 Hint
Common Mistakes
Using a return type like BOOL or INT when the method should have no return.
Confusing method names with function block names.
✗ Incorrect
The method name is 'StartMotor' and since it has no return value, the return type is 'VOID'.
