GATE Assistant

Past questions › Computer Science and Information Technology › GATE 2024 set1

GATE 2024 set1 · CS · MCQ · 1 mark · Programming and Data Structures › C Programming Fundamentals

GATE 2024 set1 Computer Science and Information Technology question: Consider the following C program: code Which one of the following statements is CORRECT?

Consider the following C program:

#include <stdio.h>
int main(){
   int a = 6;
   int b = 0;
   while(a < 10) {
      a = a / 12 + 1;
      a += b;}
   printf("%d", a);
   return 0;}

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

Show answer

Official answer: C

Practise this question with exam-style marking

Discussion

No discussion yet.

Join the discussion