Control Structures MCQs

155 questionsC-ProgramPage 4 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 28easy
What is the purpose of the 'return' statement in C?
Question 29easy
In C, which control structure allows you to define a block of code to be executed in response to a specific event or condition?
Question 30easy
What is the result of the expression 1 && 1 in C?
Advertisement
Question 31easy
What is the output of given program if user enter value 99?
#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");
        }
}
Question 32easy
What is the output of given program if user enter "xyz" ?
#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);
}
Question 33easy
What is the output of given program if user enter "xyz" ?
#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);
}
Advertisement
Question 34hard
What will be the output of the given program?
#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);
}
Question 35hard
What will be the value of i and j after execution of following program?
#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);
       }
}
Question 36hard
What will be the output given program?
#include<stdio.h>
void main()
{
	int i = -10;
	for(;i;printf("%d ", i++));
}
Control Structures MCQs with Answers & Solutions — C-Program | GrabStudy