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

What will be the output of the following code? int main() {

What will be the output of the following code? #include <stdio.h> int main() { int arr[] = {1, 2, 3, 4, 5}; printf("%d %d \n", arr[2], *(arr + 2)); return 0; }
  1. A3 3
  2. B2 2
  3. CCompilation Error
  4. DUndefined Behavior
Show answerHide answer

Correct answer: (A) 3 3

Explanation

arr[2] and *(arr + 2) both mean the third element, 3, so "3 3" is printed.

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

This is question 23 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.