Sail E0 Webinar

MCQs

Total Questions : 73 | Page 2 of 8 pages
Question 11. What is the output of this C code?    void main()    {        int a = 5, b = -7, c = 0, d;        d = ++a && ++b || ++c;        printf("\n%d%d%d%d", a,  b, c, d);    }
  1.    6  -6  0  0
  2.    6  -5  0  1
  3.    -6  -6  0  1
  4.    6  -6  0  1
 Discuss Question
Answer: Option D. -> 6  -6  0  1


None.


Question 12. What is the output of this C code?    void main()    {        int x = 4;        int *p = &x;        int *k = p++;        int r = p - k;        printf("%d", r);    }
  1.    4
  2.    8
  3.    1
  4.    Run time error
 Discuss Question
Answer: Option C. -> 1


None.


Question 13. What is the output of this C code?    void main()    {        int x = 1, y = 0, z = 5;        int a = x && y && z++;        printf("%d", z);    }
  1.    6
  2.    5
  3.    0
  4.    Varies
 Discuss Question
Answer: Option B. -> 5


None.


Question 14. What is the output of this C code?    void main()    {        int x = 1, y = 0, z = 5;        int a = x && y || z++;        printf("%d", z);    }
  1.    6
  2.    5
  3.    0
  4.    Varies
 Discuss Question
Answer: Option A. -> 6


None.


Question 15. What is the output of this C code?    void main()    {        int a = -5;        int k = (a++, ++a);        printf("%d\n", k);    }
  1.    -4
  2.    -5
  3.    4
  4.    -3
 Discuss Question
Answer: Option D. -> -3


None.


Question 16. Are logical operators sequence points?
  1.    True
  2.    False
  3.    Depends on the compiler
  4.    Depends on the standard
 Discuss Question
Answer: Option A. -> True


None.


Question 17. What is the output of this C code?    int main()    {        int a = 10, b = 5, c = 3;        b != !a;        c = !!a;        printf("%d\t%d", b, c);    }
  1.    5  1
  2.    0  3
  3.    5  3
  4.    1  1
 Discuss Question
Answer: Option A. -> 5  1


None.


Question 18. What will be the value of d in the following program?    int main()    {        int a = 10, b = 5, c = 5;        int d;        d = b + c == a;        printf("%d", d);    }
  1.    Syntax error
  2.    1
  3.    5
  4.    10
 Discuss Question
Answer: Option B. -> 1


None.


Question 19. Does logical operators in C language are evaluated with short circuit?
  1.    True
  2.    False
  3.    Depends on the compiler
  4.    depends on the standard
 Discuss Question
Answer: Option A. -> True


None.


Question 20. Result of a logical or relational expression in C is?
  1.    True or False
  2.    0 or 1
  3.    0 if expression is false and any positive number if expression is true
  4.    None of the mentioned
 Discuss Question
Answer: Option B. -> 0 or 1


None.


Latest Videos

Latest Test Papers