Data Structures & AlgorithmsVery hardGATE CS · TCS NQT

A list holds 1 to 9 in order. The first 4 nodes are reversed, then the node with value 6 is deleted. What is the value at position 5 of the resulting list (1-based)?

  1. A. 6
  2. B. 7
  3. C. 9
  4. D. 5

Correct answer: D. 5

After reversing the first four nodes the list is 4, 3, 2, 1, 5, 6, 7, 8, 9; deleting 6 leaves 4, 3, 2, 1, 5, 7, 8, 9, so position 5 holds 5.

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

Exams that ask this topic