GATE CS 2024 (Forenoon) — Question 18

Programming in CData Types, Syntax, Control Structures, LoopsMCQ1 mark · −1/3 if wrongMedium

Consider the following C program:
c
1# include <stdio.h>
2int main( ) {
3    int a = 6;
4    int b = 0;
5    while (a < 10) {
6        a = a/12 + 1;
7        a += b;
8    }
9    printf("%d", a);
10    return 0;
11}
12
Which one of the following statements is CORRECT?
  1. A
    The program prints 9 as output
  2. B
    The program prints 10 as output
  3. C
    The program gets stuck in an infinite loop
  4. D
    The program prints 6 as output
Practise the full 2024-FN paper
Challenge a friend: WhatsApp Telegram
From RENYXERAThis week's 10-question challengeSame 10 past-GATE questions for everyone this week — see where you stand.
Practise more on Data Types, Syntax, Control Structures, LoopsTimed, in the real exam interface · free to start

A GATE question every morning

One real past-paper question every morning for your branch, answer hidden until you tap. Free on Telegram.

Join
Stuck? Ask in the student group