Skip to content

IQ Challenges

Four Rows, One Rule: Solving a Boolean Puzzle with XOR

Four input-output pairs fit exactly one common operator. Scoring AND and OR against each row shows why exclusive OR is the answer.

Two glowing switches, one amber and one blue, feed into a central gate that lights up only when their states differ, illustrating the exclusive OR logic rule.
Exclusive OR fires only when exactly one input is true, which is why it fits every row of the puzzle's truth table.

Four rows. Two inputs each. One output. The rule that links them is hidden, and you have to name it.

Boolean algebra makes this possible because it works with only two truth values, False and True. In computer science they are usually written as 0 and 1 [1]. That small alphabet means a puzzle like this can be solved by checking every case.

Two Values, Four Rows

A truth table lists every possible input combination next to the output that goes with it [6]. With two inputs there are exactly four combinations: 0,0, then 0,1, then 1,0, then 1,1. With n inputs you get 2^n rows [6]. Four rows is small enough to hold in your head.

The symbols are flexible. You can write T and F, or 0 and 1. What matters is that the meaning stays fixed from the first row to the last. Swap them halfway through and every conclusion after that point is worthless.

The Logical Operators Challenge

Here is the puzzle. Each row gives input A, input B and the output. Name the single two-input operator that produces all four outputs. One note on sourcing: none of our sources contain this exact puzzle, so the answer below comes from working through the rows, not from a published key.

Find the operator that fits every row:

  1. A: 0, B: 0, Output: 0
  2. A: 0, B: 1, Output: 1
  3. A: 1, B: 0, Output: 1
  4. A: 1, B: 1, Output: 0
Overhead view of a scorecard grid beside two small indicator lamps and toggle switches, illustrating four input-output pairs in a logic puzzle.
Scorecard for the Logical Operators Test

Scoring the Wrong Guesses

The fastest way to a right answer is to knock out the wrong ones. Treat each candidate as a scorecard. Run it down the four rows and mark a miss the moment its output differs from the table.

Start with AND. It gives a true output only when all of its inputs are true [6]. Row 1 passes, since 0 AND 0 is 0. Row 2 fails. AND of 0 and 1 is 0, but the table says 1. One miss is enough, so AND is out.

Now try OR. It is true when at least one input is true. Rows 1, 2 and 3 all pass. Then row 4 breaks it. OR of 1 and 1 is 1, and the table says 0. That single row is the turn in this puzzle. A rule that looks right for three rows is still wrong.

Here is the scorecard in short:

  • AND: passes row 1, fails row 2.
  • OR: passes rows 1 to 3, fails row 4.
  • NOT: takes one input, so it cannot describe a table with two.

The lesson is plain. Never stop at the first match. Each row is a separate test, and the operator has to survive all of them.

The Solution

The operator is XOR, short for exclusive OR. It outputs 1 when the two inputs differ, and 0 when they are the same. Put another way, it is true when exactly one input is true.

Now check it against each row.

  1. For 0 and 0, the inputs match, so the output is 0.
  2. For 0 and 1, only B is 1, so the output is 1.
  3. For 1 and 0, only A is 1, so the output is 1.
  4. For 1 and 1, both inputs are 1. That is not exclusively one, so the output is 0.

All four rows pass. The last row is the one that separates XOR from OR. The two operators agree everywhere except when both inputs are true.

Close Cousins: XNOR and NAND

Two other operators are worth ruling out by name. XNOR outputs true when the inputs are equal [6]. That is XOR flipped. It would give 1 on row 1 and 0 on row 2, so it fails the very first row of this table.

NAND is the negation of AND [6]. It outputs 0 only when both inputs are 1, so it gives 1 on row 1. The table says 0. NAND is out on the first row too.

Both are easy to confuse with XOR because negating an operator flips every row at once. If your guess is wrong on every row, the fix may be one negation away. If it is wrong on only some rows, you need a different operator.

Last, a habit worth keeping. Before you match a function to a table, list all the combinations first [7]. Then ask which symbol means False and which means True, and hold that choice steady. Four rows, one pass, no guessing.

Four Rows, One Rule: Solving a Boolean Puzzle with XOR | ExpertUnderstanding