Data Structures & AlgorithmsVery hardGATE CS · TCS NQT

How many ordered pairs (a, b) with 1 <= a, b <= 10 satisfy (a + b) mod 5 = 0?

  1. A. 21
  2. B. 20
  3. C. 22
  4. D. 24

Correct answer: B. 20

Each residue class mod 5 has exactly two numbers in 1 to 10. The residue pairs (0,0), (1,4), (2,3), (3,2), (4,1) each give 2 * 2 = 4 ordered pairs, a total of 20.

More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions

Exams that ask this topic