Sail E0 Webinar

MCQs

Total Questions : 28 | Page 1 of 3 pages
Question 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");
}
}
  1.    Enter a number:99
  2.    Enter a number:99 Number is divisible by 5
  3.    complier error
  4.    Run time error
 Discuss Question
Answer: Option A. -> Enter a number:99
Question 2. 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
 Discuss Question
Answer: Option C. -> Enter your age: xyz Your age is not valid
Question 3. 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
 Discuss Question
Answer: Option B. -> Enter your age: xyz You have lived for 0.00000 seconds
Question 4. 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
 Discuss Question
Answer: Option C. -> 10 20 21 10
Question 5. What will be the value of i and j after execution of following program?
#include
void main()
{
int i, j;
for(i=0,j=0;i
  1.    10 10
  2.    10 20
  3.    20 20
  4.    Run time error
 Discuss Question
Answer: Option C. -> 20 20
Question 6. What will be the output given program?
#include
void main()
{
int i = -10;
for(;i;printf("%d ", i++));
}
  1.    -10 to -1
  2.    -10 to infinite
  3.    -10 to 0
  4.    Complier error
 Discuss Question
Answer: Option A. -> -10 to -1
Question 7. What will be the output of the given program?
#include
void main()
{
int value=0;
if(value)
printf("well done ");
printf("examveda");
}
  1.    well done examveda
  2.    examveda
  3.    complier error
  4.    None of these
 Discuss Question
Answer: Option B. -> examveda
Question 8. What will be the output of the given program?
#include
void main()
{
int a=11,b=5;
if(a=5) b++;
printf("%d %d", ++a, b++);
}
  1.    12 7
  2.    5 6
  3.    6 6
  4.    6 7
  5.    11 6
 Discuss Question
Answer: Option C. -> 6 6
Question 9. What will be the output of the given program?
#include
void main()
{
int value1, value2=100, num=100;
if(value1=value2%5) num=5;
printf("%d %d %d", num, value1, value2);
}
  1.    100 100 100
  2.    5 0 20
  3.    5 0 100
  4.    100 0 100
  5.    100 5 100
 Discuss Question
Answer: Option D. -> 100 0 100
Question 10. What will be the output of the given program?
#include
void main()
{
float num=5.6;
switch(num){
case 5:printf("5");
case 6:printf("6");
default : printf("0");
break;
}
printf("%d", num);
}
  1.    5 5.600000
  2.    6 5.600000
  3.    0 5.600000
  4.    Complier error
 Discuss Question
Answer: Option D. -> Complier error

Latest Videos

Latest Test Papers