C Language MCQ - English
Control Structures MCQ Questions and Answers
Home | C Language | Control StructuresControl Structures MCQ Questions and Answers: In this section we provide lots of objective question of Control Structures.
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");
}
}
Answer : A Discuss
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);
}
Answer : B Discuss
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>
What will be the value of a and b on the execution of above program?
void main()
{
static a,b;
while(a> b++)
}
6) If the following loop is implemented: {
int num=0;
do
{
--num;
printf("%d", num);
num++;
}
while(num>=0);
}
Answer : A Discuss
7) Consider the following code fragment: for(digit=0; digit<9; digit++)
How many times the loop will be executed?
{
digit = 2*digit;
digit--;
}
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");
}
Answer : B Discuss
Free Online Test