Question 22Asked in DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 2 (1:00 PM)

What happens if you try to use an uninitialised variable in C?

  1. AThe program will throw a runtime error.
  2. BThe variable contains garbage (indeterminate) value.
  3. CThe program will not compile.
  4. DThe variable is automatically initialised to 0.
Show answerHide answer

Correct answer: (B) The variable contains garbage (indeterminate) value.

Explanation

A local (automatic) variable that is not initialised holds an indeterminate (garbage) value. The program still compiles and runs, but results are unpredictable.

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

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