Question 131

What is the output? int arr[5] = {1, 2};

What is the output? int arr[5] = {1, 2}; printf("%d", arr[3]);
  1. A0
  2. BGarbage value
  3. C2
  4. DCompile error
Show answerHide answer

Correct answer: (A) 0

Explanation

Remaining elements of a partially initialised array are 0.

From DSSSB TGT Computer Science Full Mock Test 3

This is question 131 of DSSSB TGT Computer Science Full Mock Test 3. See all questions of this paper with answers, or attempt the paper as a timed online test to get your score and all-India rank.