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

How many times will the innermost loop execute in the below code?

How many times will the innermost loop execute in the below code? #include <stdio.h> int main() { for(int i=0; i<3; i++) { for(int j=0; j<2; j++) { printf("%d ",i); } } return 0; }
  1. A6 times
  2. B3 times
  3. C5 times
  4. D2 times
Show answerHide answer

Correct answer: (A) 6 times

Explanation

The outer loop runs 3 times (i = 0,1,2) and the inner loop runs 2 times for each, so the inner body executes 3 x 2 = 6 times.

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

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