Question 54Asked in DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 1 (9:00 AM)

Which of the following is NOT a correct way of declaring and initializing array in C?

  1. Achar arr[6] ={2};
  2. Bchar arr[ ] = “consultancy”;
  3. Cchar arr[6];              arr = “consultancy”;
  4. Dchar arr[6] ={ };
Show answerHide answer

Correct answer: (C) char arr[6];              arr = “consultancy”;

Explanation

An array name is not a modifiable lvalue, so a string cannot be assigned with arr = "..." after declaration (and "consultancy" needs 12 chars, more than 6). Strings must be given at initialisation or copied with strcpy.

From DSSSB TGT Computer Science PYQ (Technical), 12 Sep 2025, Shift 1 (9:00 AM)

This is question 54 of DSSSB TGT Computer Science PYQ (Technical), 12 Sep 2025, Shift 1 (9:00 AM). 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.