Sail E0 Webinar

MCQs

Total Questions : 73 | Page 1 of 8 pages
Question 1. What is the output of this C code?    int main()    {        int i = -5;        int k = i %4;        printf("%d\n", k);    }
  1.    Compile time error
  2.    -1
  3.    1
  4.    None
 Discuss Question
Answer: Option B. -> -1


None.


Question 2.

What is the output of this C code?    int main()    {        int i = 5;        int l = i / -4;        int k = i % -4;        printf("%d %d\n", l, k);        return 0;    }

  1.    Compile time error
  2.    -1  1
  3.    1  -1
  4.    Run time error
 Discuss Question
Answer: Option B. -> -1  1


None.


Question 3. What is the output of this C code?    int main()    {        int i = 7;        i = i / 4;        printf("%d\n", i);       return 0;    }
  1.    Run time error
  2.    1
  3.    3
  4.    Compile time error
 Discuss Question
Answer: Option B. -> 1


None.


Question 4. What is the value of x in this C code?    void main()    {        int x = 4 *5 / 2 + 9;    }
  1.    6.75
  2.    1.85
  3.    19
  4.    3
 Discuss Question
Answer: Option C. -> 19


None.


Question 5. What is the output of this C code?    void main()    {        int x = 4.3 % 2;        printf("Value of x is %d", x);    }
  1.    Value of x is 1.3
  2.    Value of x is 2
  3.    Value of x is 0.3
  4.    Compile time error
 Discuss Question
Answer: Option D. -> Compile time error


None.


Question 6. Comment on the output of this C code?    int main()    {        int i = 2;        int i = i++ + i;        printf("%d\n", i);    }
  1.    = operator is not a sequence point
  2.    ++ operator may return value with or without side effects
  3.    it can be evaluated as (i++)+i or i+(++i)
  4.    Both a and b
 Discuss Question
Answer: Option A. -> = operator is not a sequence point


None.


Question 7.

What is the output of this C code?

    int main()    {        int i = 0;        int x = i++, y = ++i;        printf("%d % d\n", x, y);        return 0;    }

  1.    0, 2
  2.    0, 1
  3.    1, 2
  4.    Undefined
 Discuss Question
Answer: Option A. -> 0, 2


None.


Question 8. What is the output of this C code?    void main()    {        int x = 97;        int y = sizeof(x++);        printf("X is %d", x);    }
  1.    X is 97
  2.    X is 98
  3.    X is 99
  4.    Run time error
 Discuss Question
Answer: Option A. -> X is 97


None.


Question 9. What is the output of this C code?    int main()    {        int i = 10;        int *p = &i;        printf("%d\n", *p++);    }
  1.    10
  2.    11
  3.    Garbage value
  4.    Address of i
 Discuss Question
Answer: Option A. -> 10


None.


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


None.


Latest Videos

Latest Test Papers