12.
What will be the output of the following C code?
#include <stdio.h>
int main()
{
    int i = 0;
    for (foo(); i == 1; i = 2)
        printf("In for loop\n");
        printf("After loop\n");
}
int foo()
{
    return 1;
}

13.
What will be the output of the following C code?
#include <stdio.h>
int main()
{
    float f = 1;
    switch (f)
    {
       case 1.0:
          printf("yes\n");
          break;
       default:
          printf("default\n");
    }
}

14.
What will be the output of the following C code?
#include <stdio.h>
int main()
{
    int i = 0;
    char c = 'a';
    while (i < 2)
    {
        i++;
        switch (c) 
        {
           case 'a':
               printf("%c ", c);
               break;
               break;
        }
    }
    printf("after loop\n");
}

16.
What will be the output of the following C code?
#include <stdio.h>
int main()
{
    printf("%d ", 1);
    goto l1;
    printf("%d ", 2);
}
void foo()
{
    l1: printf("3 ", 3);
}

17.
What will be the output of the following C code?
#include <stdio.h>
void main()
{
    char *str = "";
    do
    {
        printf("hello");
    } while (str);
}

18.
What will be the output of the following C code?
#include <stdio.h>
void main()
{
    int i = 0;
    for (i = 0;i < 5; i++)
        if (i < 4)
        {
            printf("Hello");
            break;
        }
}

20.
What will be the output of the following C code?
#include <stdio.h>
int main()
{
    short i;
    for (i = 1; i >= 0; i++)
        printf("%d\n", i);

}

Read More Section(Control Structures)

Each Section contains maximum 100 MCQs question on Control Structures. To get more questions visit other sections.