Data Structures & AlgorithmsModerateSSC CGL Tier 2 · TCS NQT

Problem: For the sequence 2, 3, 5, 7, 11, …, the first 10 prime numbers are listed. What is the sum of the 10th and 7th primes in the list?

  1. A. 50
  2. B. 36
  3. C. 46
  4. D. 17

Correct answer: C. 46

The 10th prime is 29 and the 7th is 17, so 46. Using 0-based indexes 10 and 7 gives 31 + 19 = 50, shifting both down gives 23 + 13 = 36, and 17 adds the positions.

More Coding Interview Problems questions

Exams that ask this topic