ISRO Computer Science (CSE) 2015 - Question 73

All ISRO Computer Science (CSE) papers | ISRO Computer Science (CSE) 2015

The output of the following program is main() { static int x[] = {1, 2, 3, 4, 5, 6, 7, 8}; ... x[x[i]] = x[i]; ... }

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

Answer: A. 1 2 3 3 5 5 7 8

Explanation: Loop modifies array elements based on values.

| | All questions of ISRO Computer Science (CSE) 2015