Lakshya Education MCQs

Question: 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");
}
}
Options:
A.Enter a number:99
B.Enter a number:99 Number is divisible by 5
C.complier error
D.Run time error
Answer: Option A

Submit Answer & Explaination

Earn Reward Points by submitting Detailed Explaination for this Question

More Questions on This Topic :

Question 1. What is the output of given program if user enter "xyz" ?
#include
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);
}
  1.    Enter your age : xyz Your age is not valid
  2.    Enter your age: xyz You have lived for 0 seconds
  3.    Enter your age: xyz Your age is not valid
  4.    Complier error
Answer: Option C
Question 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);
}
  1.    Enter your age: xyz You have lived for 0 seconds
  2.    Enter your age: xyz You have lived for 0.00000 seconds
  3.    Enter your age: xyz "after that program will stop"
  4.    Run time error
Answer: Option B
Question 3. What will be the output of the given program?
#include
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);
}
  1.    10 10 11 11
  2.    10 20 21 21
  3.    10 20 21 10
  4.    10 20 21 20
Answer: Option C

Check all Questions in this Topic : Click HERE