Sail E0 Webinar

MCQs

Total Questions : 73 | Page 3 of 8 pages
Question 21.

What is the output of this C code?    void main()    {        int a = 5;        int b = ++a + a++ + --a;        printf("Value of b is %d", b);    }

  1.    Value of x is 16
  2.    Value of x is 21
  3.    Value of x is 15
  4.    Undefined behaviour
 Discuss Question
Answer: Option D. -> Undefined behaviour


None.


Question 22. Which of the following is not an arithmetic operation?
  1.    a *= 20;
  2.    a /= 30;
  3.    a %= 40;
  4.    a != 50;
 Discuss Question
Answer: Option D. -> a != 50;


None.


Question 23. The precedence of arithmetic operators is (from highest to lowest)?
  1.    %, *, /, +, -
  2.    %, +, /, *, -
  3.    +, -, %, *, /
  4.    %, +, -, *, /
 Discuss Question
Answer: Option A. -> %, *, /, +, -


None.


Question 24.

What is the output of this C code?    void main()    {        int y = 3;        int x = 7 % 4 * 3 / 2;        printf("Value of x is %d", x);    }

  1.    Value of x is 1
  2.    Value of x is 2
  3.    Value of x is 3
  4.    Compile time error
 Discuss Question
Answer: Option A. -> Value of x is 1


None.


Question 25. Which of the following data type will throw an error on modulus operation(%)?
  1.    char
  2.    short
  3.    float
  4.    int
 Discuss Question
Answer: Option C. -> float


None.


Question 26. What is the output of this C code?    void main()

    {        1 < 2 ? return 1: return 2;    }

  1.    returns 1
  2.    returns 2
  3.    varies
  4.    Compile time error
 Discuss Question
Answer: Option D. -> Compile time error


None.


Question 27. What is the output of this C code?    int main()    {        int x = 2, y = 2;        x /= x / y;        printf("%d\n", x);        return 0;    }
  1.    2
  2.    1
  3.    0.5
  4.    Undefined behaviour
 Discuss Question
Answer: Option A. -> 2


None.


Question 28. What is the output of this C code?    int main()    {        int x = 1, y = 0;        x &&= y;        printf("%d\n", x);    }
  1.    Compile time error
  2.    1
  3.    0
  4.    Undefined behaviour
 Discuss Question
Answer: Option A. -> Compile time error


None.


Question 29. What is the output of this C code?

    void main()    {        unsigned int x = -5;        printf("%d", x);    }

  1.    Run time error
  2.    Varies
  3.    -5
  4.    5
 Discuss Question
Answer: Option C. -> -5


None.


Question 30. What is the output of this C code?    int main()    {        int x = 2, y = 1;        x *= x + y;        printf("%d\n", x);        return 0;    }
  1.    5
  2.    6
  3.    Undefined behaviour
  4.    Compile time error
 Discuss Question
Answer: Option D. -> Compile time error


None.


Latest Videos

Latest Test Papers