Control Structures MCQ Questions and Answers

Home | C Language | Control Structures

Control Structures MCQ Questions and Answers: In this section we provide lots of objective question of Control Structures.

Page: 1/3

1) What is the output of given program if user enter value 99?

#include
void main()
{
int i;
printf("Enter a number:");
scanf("%d", &i); // 99 is given as input.
if(i%5 == 0)
{
printf("nNumber entered is divisible by 5");
}
}

2) What is the output of given program if user enter "xyz" ?

#include
void main()
{
float age, AgeInSeconds;
printf("Enter your age:");
scanf("%f", &age);
AgeInSeconds = 365 * 24 * 60 * 60 * age;
printf("You have lived for %f seconds", AgeInSeconds);
}

3) How many times will the following loop be executed?

 ch ='b';
while(ch>='a' && ch<='z')
ch++;

4) A labeled statement consists of an identifier followed by a

Free Online Test

5) Study the following 'C' program:

 #include<stdio.h>
void main()
{
static a,b;
while(a> b++)
}
What will be the value of a and b on the execution of above program?

6) If the following loop is implemented:

 {
int num=0;
do
{
--num;
printf("%d", num);
num++;
}
while(num>=0);
}

7) Consider the following code fragment:

 for(digit=0; digit<9; digit++)
{
digit = 2*digit;
digit--;
}
How many times the loop will be executed?

8) What will be the output of the following C code?

 #include <stdio.h>
void main()
{
int x = 5;
if (x < 1)
printf("hello");
if (x == 5)
printf("hi");
else
printf("no");
}

9) What will be the output of the following C code?

 #include <stdio.h>
int x;
void main()
{
if (x)
printf("hi");
else
printf("how are u");
}

10) What will be the output of the following C code?

 #include <stdio.h>
void main()
{
int x = 5;
if (true);
printf("hello");
}

Free Online Test