Select an option to see the answer and solution.
Control Structures
practice.
Practice every MCQ with options. Use Show answers when you want the correct option and solution.
155
Questions
2/8
Page
Pick an option on a question to see the right answer and solution.
Select an option to see the answer and solution.
Select an option to see the answer and solution.
Select an option to see the answer and solution.
Select an option to see the answer and solution.
Select an option to see the answer and solution.
Select an option to see the answer and solution.
Select an option to see the answer and solution.
Select an option to see the answer and solution.
Select an option to see the answer and solution.
#include<stdio.h>
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");
}
}Select an option to see the answer and solution.
#include<stdio.h>
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);
}Select an option to see the answer and solution.
#include<stdio.h>
void main()
{
float age, AgeInSeconds;
int value;
printf("Enter your age:");
value=scanf("%f", &age);
if(value==0){
printf("\\nYour age is not valid");
}
AgeInSeconds = 365 * 24 * 60 * 60 * age;
printf("\\n You have lived for %f seconds", AgeInSeconds);
}Select an option to see the answer and solution.
#include<stdio.h>
void main()
{
int i=10;
printf("i=%d", i);
{
int i=20;
printf("i=%d", i);
i++;
printf("i=%d", i);
}
printf("i=%d", i);
}Select an option to see the answer and solution.
#include<stdio.h>
void main()
{
int i, j;
for(i=0,j=0;i<10,j<20;i++,j++){
printf("i=%d %t j=%d", i, j);
}
}Select an option to see the answer and solution.
#include<stdio.h>
void main()
{
int i = -10;
for(;i;printf("%d ", i++));
}Select an option to see the answer and solution.
#include<stdio.h>
void main()
{
int a=11,b=5;
if(a=5) b++;
printf("%d %d", ++a, b++);
}Select an option to see the answer and solution.
#include<stdio.h>
void main()
{
int value=0;
if(value)
printf("well done ");
printf("examveda");
}Select an option to see the answer and solution.
#include<stdio.h>
void main()
{
int value1, value2=100, num=100;
if(value1=value2%5) num=5;
printf("%d %d %d", num, value1, value2);
}Select an option to see the answer and solution.
#include<stdio.h>
void main()
{
float num=5.6;
switch(num){
case 5:printf("5");
case 6:printf("6");
default : printf("0");
break;
}
printf("%d", num);
}Select an option to see the answer and solution.