C Language MCQ’S | Loops 5

Question: 21

How many times Hello is printed?

int main()
{
int a = 0;
while(a++ < 5-++a)
printf(“Hello”);
return 0;
}

A. 5 times
B. 4 times
C. 2 times
D. 1 time

 

Question: 22

What will be the output?

int main()
{
int x = 10;
{
int x = 0;
printf(“%d”,x);
}
return 0;
}

A. 10
B. Compilation Error
C. 0
D. Undefined

 

Question: 23

The ASCII code of ‘0’ (zero) is?

A. 48
B. 32H
C. 0011 1000
D. 42H

 

Question: 24

Does this program get compiled successfully?

#include stdio.h

int main()
{
printf(“Hello”);
return 0;

}


A. Yes
B. No
C. Depends on Compiler

 

Question: 25

What will be the output?

#include “stdio.h”
int main()
{
int a = 0;
if(a = printf(“How old are you?”))
{
printf(“%d – too young”, a);
}

return 0;
}

A. 0 – too young
B. Compilation Error
C. Nothing is printed
D. How old are you? 16 – too young