C Language MCQ’S | Loops

Question: 1.

How many loops are there in C

A. 2
B. 3
C. 4
D. 1

 

Question: 2.

What is the output of below program?

int main()
{
for( ;  ; )
for( ;  ; )
printf(“Hello..”);

return 0;
}


A. Compilation Error
B. Runtime Error
C. Hello is printed one time
D. Hello is printed infinite times

 

Question: 3.

What is output of below program?

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


A. Compilation Error
B. Runtime Error
C. Nothing is printed
D. Hello is printed infinite times

 

Question: 4.

What is the output of below program?

int main()
{
int i;

for(i = 0,i<5,i++)
{
printf(“Hello”);
}

return 0;
}

A. Hello is printed 5 times
B. Compilation Error
C. Runtime Error
D. Hello is printed 4 times

 

Question: 5

What is output of below program?

int main()
{
int i;
for(i=0; i<5; ++i++)
{
printf(“Hello”);
}
return 0;
}

A. Hello is printed 5 times
B. Compilation Error
C. Hello is printed 2 times
D. Hello is printed 3 times

Visitor Counter

0142303