Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to assign the value 10 to the variable.
PLC Programming
VAR myValue : INT := [1]; END_VARAttempts:
3 left
💡 Hint
Common Mistakes
Using the variable name instead of a value.
Using the assignment operator ':=' as a value.
✗ Incorrect
The variable is assigned the value 10 using ':=' operator.
2fill in blank
mediumComplete the code to compare if inputValue is greater than 5.
PLC Programming
IF inputValue [1] 5 THEN output := TRUE; END_IF
Attempts:
3 left
💡 Hint
Common Mistakes
Using assignment operator ':=' instead of comparison.
Using '<' which checks less than.
✗ Incorrect
The '>' operator checks if inputValue is greater than 5.
3fill in blank
hardFix the error in the math operation to add 3 to count.
PLC Programming
count := count [1] 3;
Attempts:
3 left
💡 Hint
Common Mistakes
Using '-' which subtracts.
Using '*' or '/' which multiply or divide.
✗ Incorrect
The '+' operator adds 3 to count.
4fill in blank
hardFill both blanks to assign the word length if the word is longer than 3.
PLC Programming
IF LEN(word) [2] 3 THEN wordLengths := [1]; END_IF
Attempts:
3 left
💡 Hint
Common Mistakes
Using word instead of LEN(word) for length.
Using '<=' which selects shorter words.
✗ Incorrect
We use LEN(word) to get length and '>' to filter words longer than 3.
5fill in blank
hardFill all three blanks to assign uppercase key and value if value greater than 0.
PLC Programming
IF [2] [3] 0 THEN filteredKey := [1].UPPER(); filteredValue := [2]; END_IF
Attempts:
3 left
💡 Hint
Common Mistakes
Using k.UPPER() as variable name instead of key.
Using '<' instead of '>' for filtering.
✗ Incorrect
Keys are 'k', values 'v', and filter uses '>' to select values greater than 0. Use UPPER() for uppercase.
