Bird
Raised Fist0
PLC Programmingscripting~20 mins

Comparison instructions (EQ, NE, GT, LT) in PLC Programming - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
PLC Comparison Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
1:30remaining
Output of EQ instruction in PLC ladder logic
Given the following PLC ladder logic snippet using the EQ (equal) instruction, what will be the value of the output coil EQ_Output after execution?

Inputs:
- Input1 = 10
- Input2 = 10

Logic:
EQ_Output = EQ(Input1, Input2)
PLC Programming
Input1 = 10
Input2 = 10
EQ_Output = (Input1 == Input2)
AEQ_Output is FALSE
BEQ_Output causes a runtime error
CEQ_Output is undefined
DEQ_Output is TRUE
Attempts:
2 left
💡 Hint
EQ checks if two values are exactly the same.
💻 Command Output
intermediate
1:30remaining
Result of NE (not equal) instruction
What will be the output of the NE instruction when comparing these two values?

InputA = 5
InputB = 8

NE_Output = NE(InputA, InputB)
PLC Programming
InputA = 5
InputB = 8
NE_Output = (InputA != InputB)
ANE_Output is TRUE
BNE_Output is FALSE
CNE_Output is NULL
DNE_Output causes a syntax error
Attempts:
2 left
💡 Hint
NE returns TRUE if values are different.
💻 Command Output
advanced
2:00remaining
Output of GT (greater than) instruction with negative numbers
Consider the GT instruction comparing two signed integers:

Value1 = -3
Value2 = -7

GT_Output = GT(Value1, Value2)

What is the value of GT_Output?
PLC Programming
Value1 = -3
Value2 = -7
GT_Output = (Value1 > Value2)
AGT_Output causes a type error
BGT_Output is FALSE
CGT_Output is TRUE
DGT_Output is NULL
Attempts:
2 left
💡 Hint
Remember that -3 is greater than -7 on the number line.
💻 Command Output
advanced
1:30remaining
LT (less than) instruction with equal values
What will the LT instruction output be when comparing two equal values?

Var1 = 12
Var2 = 12

LT_Output = LT(Var1, Var2)
PLC Programming
Var1 = 12
Var2 = 12
LT_Output = (Var1 < Var2)
ALT_Output is FALSE
BLT_Output causes a runtime error
CLT_Output is TRUE
DLT_Output is TRUE if Var1 is less or equal
Attempts:
2 left
💡 Hint
LT only returns TRUE if the first value is strictly less than the second.
🧠 Conceptual
expert
2:30remaining
Understanding combined comparison instructions in PLC
In a PLC program, you want to check if a temperature value is between 20 and 30 degrees inclusive using comparison instructions EQ, NE, GT, and LT.

Which combination of instructions correctly implements this check?

Options:
ACheck if (GE(Temp, 20) AND LE(Temp, 30))
BCheck if (GT(Temp, 19) AND LT(Temp, 31))
CCheck if (EQ(Temp, 20) OR EQ(Temp, 30))
DCheck if (NE(Temp, 20) AND NE(Temp, 30))
Attempts:
2 left
💡 Hint
Use GT and LT with values just outside the range to include boundaries.

Practice

(1/5)
1. Which comparison instruction checks if two values are exactly the same in PLC programming?
easy
A. EQ
B. NE
C. GT
D. LT

Solution

  1. Step 1: Understand the meaning of EQ

    EQ stands for 'equal' and checks if two values are exactly the same.
  2. Step 2: Compare with other instructions

    NE means not equal, GT means greater than, and LT means less than, so they do not check equality.
  3. Final Answer:

    EQ -> Option A
  4. Quick Check:

    EQ means equal [OK]
Hint: EQ means equal, so it checks if values match exactly [OK]
Common Mistakes:
  • Confusing EQ with NE
  • Thinking GT checks equality
  • Mixing LT with EQ
2. Which of the following is the correct syntax to check if variable A is greater than variable B in a PLC program?
easy
A. IF A LT B THEN
B. IF A NE B THEN
C. IF A EQ B THEN
D. IF A GT B THEN

Solution

  1. Step 1: Identify the comparison for 'greater than'

    GT means 'greater than', so to check if A is greater than B, use 'A GT B'.
  2. Step 2: Check other options

    LT means less than, EQ means equal, NE means not equal, so they are incorrect for this check.
  3. Final Answer:

    IF A GT B THEN -> Option D
  4. Quick Check:

    GT means greater than [OK]
Hint: GT means greater than, so use it to compare if A > B [OK]
Common Mistakes:
  • Using LT instead of GT
  • Confusing EQ with GT
  • Using NE for greater than check
3. Given the following PLC code snippet:
VAR
  X: INT := 5;
  Y: INT := 10;
  Result: BOOL;
END_VAR

Result := X LT Y;

What will be the value of Result after execution?
medium
A. Syntax Error
B. FALSE
C. TRUE
D. Undefined

Solution

  1. Step 1: Understand the comparison LT

    LT means 'less than'. The code checks if X (5) is less than Y (10).
  2. Step 2: Evaluate the condition

    Since 5 is less than 10, the condition is true, so Result will be TRUE.
  3. Final Answer:

    TRUE -> Option C
  4. Quick Check:

    5 LT 10 = TRUE [OK]
Hint: LT means less than; 5 < 10 is true [OK]
Common Mistakes:
  • Thinking LT means greater than
  • Assuming Result is FALSE
  • Confusing syntax with error
4. Identify the error in this PLC comparison instruction:
IF A NEQ B THEN
  // do something
END_IF
medium
A. Missing THEN keyword
B. NEQ is not a valid comparison instruction
C. Comparison should be EQ instead of NEQ
D. IF statement missing parentheses

Solution

  1. Step 1: Check the comparison instruction used

    The code uses 'NEQ' which is not a standard PLC comparison instruction.
  2. Step 2: Identify correct instruction

    The correct instruction for 'not equal' is 'NE', not 'NEQ'.
  3. Final Answer:

    NEQ is not a valid comparison instruction -> Option B
  4. Quick Check:

    Use NE for not equal, not NEQ [OK]
Hint: Use NE for not equal, not NEQ [OK]
Common Mistakes:
  • Using NEQ instead of NE
  • Forgetting THEN keyword
  • Adding unnecessary parentheses
5. You want to write a PLC program that turns on a motor only if the temperature is greater than 50 and the pressure is less than 100. Which combination of comparison instructions correctly checks this condition?
hard
A. IF Temperature GT 50 AND Pressure LT 100 THEN Motor := TRUE;
B. IF Temperature LT 50 OR Pressure GT 100 THEN Motor := TRUE;
C. IF Temperature EQ 50 AND Pressure EQ 100 THEN Motor := TRUE;
D. IF Temperature NE 50 AND Pressure NE 100 THEN Motor := TRUE;

Solution

  1. Step 1: Translate the condition into comparisons

    The motor should turn on if temperature is greater than 50 (GT 50) and pressure is less than 100 (LT 100).
  2. Step 2: Check each option

    IF Temperature GT 50 AND Pressure LT 100 THEN Motor := TRUE; uses GT and LT with AND, matching the condition exactly. Other options use wrong comparisons or OR instead of AND.
  3. Final Answer:

    IF Temperature GT 50 AND Pressure LT 100 THEN Motor := TRUE; -> Option A
  4. Quick Check:

    GT and LT with AND matches condition [OK]
Hint: Use GT for greater, LT for less, combine with AND for both conditions [OK]
Common Mistakes:
  • Using OR instead of AND
  • Using EQ instead of GT or LT
  • Mixing NE with equality checks
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard