Challenge - 5 Problems
PLC Arithmetic Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediateOutput of arithmetic assignment in PLC structured text
What is the value of variable
Result after executing this PLC structured text code?VAR
A : INT := 5;
B : INT := 3;
Result : INT;
END_VAR
Result := A + B * 2;PLC Programming
VAR A : INT := 5; B : INT := 3; Result : INT; END_VAR Result := A + B * 2;
Attempts:
2 left
💡 Hint
Remember the order of operations: multiplication happens before addition.
✗ Incorrect
The expression is evaluated as 5 + (3 * 2) = 5 + 6 = 11.
💻 Command Output
intermediateResult of combined assignment and subtraction
What will be the value of
Counter after this code runs?VAR
Counter : INT := 10;
END_VAR
Counter := Counter - 4 + 2;PLC Programming
VAR Counter : INT := 10; END_VAR Counter := Counter - 4 + 2;
Attempts:
2 left
💡 Hint
Calculate subtraction and addition from left to right.
✗ Incorrect
Counter = 10 - 4 + 2 = 6 + 2 = 8.
📝 Syntax
advancedIdentify the syntax error in arithmetic assignment
Which option contains a syntax error in the assignment statement in PLC structured text?
Attempts:
2 left
💡 Hint
Look for invalid operator placement.
✗ Incorrect
Option D has an invalid operator sequence '+ *' which is not allowed.
💻 Command Output
advancedValue of variable after mixed arithmetic and assignment
Given the code below, what is the final value of
Output?VAR
X : INT := 4;
Y : INT := 3;
Output : INT;
END_VAR
Output := X * Y - X / Y;PLC Programming
VAR X : INT := 4; Y : INT := 3; Output : INT; END_VAR Output := X * Y - X / Y;
Attempts:
2 left
💡 Hint
Remember integer division truncates decimals.
✗ Incorrect
X * Y = 4 * 3 = 12; X / Y = 4 / 3 = 1 (integer division); Output = 12 - 1 = 11.
💻 Command Output
expertFinal value after sequential arithmetic assignments
What is the final value of
Value after running this code?VAR
Value : INT := 2;
END_VAR
Value := Value + 3;
Value := Value * 2;
Value := Value - 4;PLC Programming
VAR Value : INT := 2; END_VAR Value := Value + 3; Value := Value * 2; Value := Value - 4;
Attempts:
2 left
💡 Hint
Calculate each assignment step by step.
✗ Incorrect
Step 1: Value = 2 + 3 = 5; Step 2: Value = 5 * 2 = 10; Step 3: Value = 10 - 4 = 6.
