Data Structures & AlgorithmsHardTCS NQT · Infosys

A list holds 1 to 10 in order. All nodes whose value is prime are deleted. What is the sum of the remaining values?

  1. A. 39
  2. B. 40
  3. C. 42
  4. D. 38

Correct answer: D. 38

The primes up to 10 are 2, 3, 5 and 7, summing to 17. The total of 1 to 10 is 55, leaving 38.

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

Exams that ask this topic