Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to assign the value 10 to the variable 'counter'.
PLC Programming
counter [1] 10;
Attempts:
3 left
💡 Hint
Common Mistakes
Using '==' which is a comparison operator, not assignment.
Using '=' which is common in other languages but not in PLC.
✗ Incorrect
In PLC programming, ':=' is used for assignment to set the value of a variable.
2fill in blank
mediumComplete the code to add 5 to the variable 'total'.
PLC Programming
total [1] total + 5;
Attempts:
3 left
💡 Hint
Common Mistakes
Using '+=' which is not standard in PLC languages.
Using '==' which is for comparison, not assignment.
✗ Incorrect
Use ':=' to assign the new value of total after adding 5.
3fill in blank
hardFix the error in the code to multiply 'speed' by 2 and assign it back.
PLC Programming
speed [1] speed * 2;
Attempts:
3 left
💡 Hint
Common Mistakes
Using '=' or '==' which are not valid assignment operators in PLC.
Using '+=' which is not supported.
✗ Incorrect
Use ':=' to assign the result of the multiplication back to 'speed'.
4fill in blank
hardFill both blanks to subtract 3 from 'count' and assign it back.
PLC Programming
count [1] count [2] 3;
Attempts:
3 left
💡 Hint
Common Mistakes
Using '=' instead of ':=' for assignment.
Using '+' instead of '-' for subtraction.
✗ Incorrect
Use ':=' for assignment and '-' for subtraction.
5fill in blank
hardFill all three blanks to create a new variable 'result' that stores the sum of 'a' and 'b'.
PLC Programming
result [1] [2] [3];
Attempts:
3 left
💡 Hint
Common Mistakes
Using '=' instead of ':=' for assignment.
Separating '+' and 'b' incorrectly.
✗ Incorrect
Assign 'result' using ':=' to the sum of 'a' and 'b'.
