Loop in C MCQs Exercise II

Ques 1 Loop


What is the output of the following code ?

int main()
{
    int k;
    for(k=0;k<=4;)
    {
        printf("%d",k++);
    }
    return 0;
 }

A 0 1 2 3
B 1 2 3 4
C 0 1 2 3 4
D 1 2 3 4 5

Ques 2 Loop


What is the output of the following code ?

int main()
{
    double k=4.444;
    do{
        printf("SC ");
    }while(!k);
    return 0;
}

A SC SC
B SC
C Error
D None of these

Ques 3 Loop


What is the output of the following code?

#include<sdtio.h>
int main()
{
       int a=6,b=2;
       while(!printf("SmallCode"))
       {
             return 0;
       }  
}

A SmallCode
B Infinite Loop
C 0
D compilation error