Control Structures MCQs

155 questionsC-ProgramPage 10 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 82hard
What will be the output of the following C code? (Assuming that we have entered the value 1 in the standard input)
#include <stdio.h>
void main()
{
    double ch;
    printf("enter a value between 1 to 2:");
    scanf("%lf", &ch);
    switch (ch)
    {
       case 1:
          printf("1");
          break;
       case 2:
          printf("2");
          break;
    }
}
Question 83hard
What will be the output of the following C code?
#include <stdio.h>
int main()
{
    printf("%d ", 1);
    goto l1;
    printf("%d ", 2);
    l1:goto l2;
    printf("%d ", 3);
    l2:printf("%d ", 4);
}
Question 84hard
What will be the output of the following C code?
#include <stdio.h>
int main()
{
    if (printf("%d", printf(")))
        printf("We are Happy");
    else if (printf("1"))
        printf("We are Sad");
}
Advertisement
Question 85hard
What will be the output of the following C code?
#include <stdio.h>
void main()
{
    int k = 0;
    for (k < 3; k++)
    printf("Hello");
}
Question 86hard
What will be the output of the following C code?
#include <stdio.h>
const int a = 1,  b = 2;
int main()
{
    int x = 1;
    switch (x)
    {
       case a:
          printf("yes ");
       case b:
          printf("no\n");
          break;
    }
}
Question 87medium
What will be the output of the following C code?
#include <stdio.h>
void main()
{
    int x = 5;
    if (x < 1);
        printf("Hello");

}
Advertisement
Question 88hard
What will be the output of the following C code?
#include <stdio.h>
int main()
{
    int a = 0, i = 0, b;
    for (i = 0;i < 5; i++)
    {
        a++;
        continue;
    }
}
Question 89hard
What will be the output of the following C code?
#include <stdio.h>
int main()
{
    printf("%d ", 1);
    l1:l2:
    printf("%d ", 2);
    printf("%d\n", 3);
}
Question 90hard
What will be the output of the following C code?
#include <stdio.h>
int main()
{
    int i = 0;
    while (i = 0)
        printf("True\n");
    printf("False\n");
}
Control Structures MCQs with Answers & Solutions — C-Program | GrabStudy