Sail E0 Webinar

MCQs

Total Questions : 28 | Page 2 of 3 pages
Question 11. What will be the output of given program?
#include
void main()
{
int a=1;
if("%d=hello", a);
}
  1.    complier error
  2.    no error no output
  3.    0
  4.    1
 Discuss Question
Answer: Option B. -> no error no output
Question 12. What will be the output of given program?
#include
void main()
{
int a=3;
for(;a;printf("%d ", a--);
}
  1.    no output
  2.    3 2 1 0
  3.    3 2 1
  4.    infinity loop
 Discuss Question
Answer: Option C. -> 3 2 1
Question 13. What will be the output of given program?
#include
void main()
{
int i=1, j=-1;
if((printf("%d", i)) < (printf("%d", j)))
printf("%d", i);
else
printf("%d", j);
}
  1.    1 -1 1
  2.    1 -1 -1
  3.    1
  4.    -1
  5.    complier error
 Discuss Question
Answer: Option A. -> 1 -1 1
Question 14. What will be the output of the following code?
#include
void main()
{
int s=0;
while(s++
  1.    1 2 3 4 5 6 7 8 9
  2.    1 2 3 10
  3.    4 5 6 7 8 9 10
  4.    4 5 6 7 8 9
  5.    None of these
 Discuss Question
Answer: Option C. -> 4 5 6 7 8 9 10
Question 15. What will be the output of the following piece of code?
for(i = 0; i
  1.    10
  2.    0123456789
  3.    Syntax error
  4.    0
  5.    Infinite loop
 Discuss Question
Answer: Option A. -> 10
Question 16. Which command is used to skip the rest of a loop and carry on from the top of the loop again?
  1.    break
  2.    resume
  3.    continue
  4.    skip
  5.    None of these
 Discuss Question
Answer: Option C. -> continue
Question 17. What is the output of the following program?
#include
int c[10] = {1,2,3,4,5,6,7,8,9,10};
main()
{
int a, b=0;
for(a=0;a
  1.    20
  2.    24
  3.    25
  4.    30
  5.    None of these
 Discuss Question
Answer: Option C. -> 25
Question 18. What is the output of the following statements?
for(i=10; i++; i
  1.    10 11 12 13 14
  2.    10 11 12 13 14 15
  3.    9 10 11 12 13
  4.    Infinite loop
  5.    None of these
 Discuss Question
Answer: Option D. -> Infinite loop
Question 19. The type of the controlling expression of a switch statement cannot be of the type ........
  1.    int
  2.    char
  3.    short
  4.    float
  5.    long
 Discuss Question
Answer: Option D. -> float
Question 20. What's wrong in the following statement, provided k is a variable of type int?
for(k = 2, k
  1.    The increment should always be ++k .
  2.    The variable must always be the letter i when using a for loop.
  3.    There should be a semicolon at the end of the statement.
  4.    The variable k can’t be initialized.
  5.    The commas should be semicolons.
 Discuss Question
Answer: Option E. -> The commas should be semicolons.

Latest Videos

Latest Test Papers