How many rows are there in a truth table having n variables?

2021

How many rows are there in a truth table having n variables?

  1. A.

    2n

  2. B.

    n2

  3. C.

    log2n

  4. D.

    2n

Attempted by 781 students.

Show answer & explanation

Correct answer: D

Concept: A truth table lists every possible combination of input values. Each variable is binary, so it can take exactly two values (0 or 1). Because the variables are independent, the product rule applies: the total number of combinations is the product of the choices per variable, i.e. 2 × 2 × … × 2 (n times) = 2n. So a table with n variables always has 2n rows.

Application — count the rows step by step:

  1. With 1 variable there are 21 = 2 rows: 0 and 1.

  2. With 2 variables each row of the previous table splits into two, giving 22 = 4 rows: 00, 01, 10, 11.

  3. With 3 variables every combination again doubles, giving 23 = 8 rows: 000 through 111.

Cross-check: Adding one more variable doubles the row count (each existing row appears once with the new variable = 0 and once with it = 1). Doubling from a base of 1 combination, n times, gives the row count — confirming the formula. The other choices fail this doubling test: 2n adds only a fixed amount each time, n2 pairs variables with one another, and log2n shrinks instead of growing, so none of them enumerate all input patterns.

Explore the full course: Up Lt Grade Assistant Teacher 2025