Control Structures MCQs

155 questionsC-ProgramPage 12 of 18

Practice free Control Structures multiple-choice questions with instant answer feedback and step-by-step solutions. Click an option to check yourself, reveal the full explanation, and work through all 155 questions — no login required.

Question 100easy
What will be the output of the following C code?
#include <stdio.h>
#define max(a) a
int main()
{
    int x = 1;
    switch (x)
    {
       case max(2):
          printf("yes\n");
       case max(1):
          printf("no\n");
          break;
    }
}
Question 101hard
What will be the output of the following C code?
#include <stdio.h>
void main()
{
    int i = 0;
    if (i == 0)
    {
        goto label;
    }
    label: printf("Hello");
}
Question 102hard
What will be the output of the following C code?
#include <stdio.h>
void main()
{
    int i = 0;
    if (i == 0)
    {
        printf("Hello");
        break;
    }
}
Advertisement
Question 103hard
What will be the output of the following C code?
#include <stdio.h>
void main()
{
    int x = 0;
    if (x == 0)
        printf("hi");
    else
        printf("how are u");
        printf("hello");
}
Question 104easy
Which keyword can be used for coming out of recursion?
Question 105hard
What will be the output of the following C code?
#include <stdio.h>
void main()
{
    int i = 0, k;
    if (i == 0)
        goto label;
        for (k = 0;k < 3; k++)
        {
            printf("hi ");
            label: k = printf("%03d", i);
        }
}
Advertisement
Question 106hard
What will be the output of the following C code?
#include <stdio.h>
int main()
{
    int i = 0, j = 0;
    while (i < 5, j < 10)
    {
        i++;
        j++;
    }
    printf("%d, %d\n", i, j);
}
Question 107medium
What will be the output of the following C code?
#include <stdio.h>
void main()
{
    int x = 5;
    if (true);
        printf("hello");
}
Question 108hard
What will be the output of the following C code?
#include <stdio.h>
int main()
{
    int i = 0, j = 0;
    while (l1: i < 2)
    {
        i++;
        while (j < 3)
        {
            printf("loop\n");
            goto l1;
        }
    }
}