Question 33Asked in DSSSB TGT Computer Science (Technical), 13 Sep 2025, Shift 3 (5:00 PM)

Which declaration is valid for a 2D array in C?

  1. Aint arr[2][2] = {1,2,3,4};
  2. Bint arr[2,2] = {{1,2}, {3,4}};
  3. Cint arr[][] = {{1,2}, {3,4}};
  4. Dint arr[][] = {1,2,3,4};
Show answerHide answer

Correct answer: (A) int arr[2][2] = {1,2,3,4};

Explanation

A 2D array can be initialised with a flat list when both sizes are given: {1,2,3,4} fills row by row. [2,2] is not C syntax, and only the first dimension may be left empty.

From DSSSB TGT Computer Science PYQ (Technical), 13 Sep 2025, Shift 3 (5:00 PM)

This is question 33 of DSSSB TGT Computer Science PYQ (Technical), 13 Sep 2025, Shift 3 (5:00 PM). 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.