Sail E0 Webinar

MCQs

Total Questions : 15 | Page 2 of 2 pages
Question 11. For initialization a = 2, c = 1 the value of a and c after this code will be
c = (c) ? a = 0 : 2;
  1.    a = 0, c = 0;
  2.    a = 2, c = 2;
  3.    a = 2, c = 2;
  4.    a = 1, c = 2;
 Discuss Question
Answer: Option A. -> a = 0, c = 0;


None.


Question 12. What will be the data type of the expression (a < 50) ? var1 : var2;
provided a = int, var1 = double, var2 = float
  1.    float
  2.    int
  3.    double
  4.    Cannot be determined
 Discuss Question
Answer: Option C. -> double


None.


Question 13. Comment on the following expression?
c = (n) ? a : b; can be rewritten as
  1.    if (!n)c = b; else c = a
  2.    if (n
  3.    if (n > 0)c = a; else c = b;
  4.    All of the mentioned
 Discuss Question
Answer: Option A. -> if (!n)c = b; else c = a


None.


Question 14. Which expression has to be present in the following?
exp1 ? exp2 : exp3;
  1.    exp1
  2.    exp2
  3.    exp3
  4.    All of the mentioned
 Discuss Question
Answer: Option D. -> All of the mentioned


None.


Question 15. Value of c after the following expression (initializations a = 1, b = 2, c = 1):
c += (-c) ? a : b;
  1.    syntax error
  2.    c = 1
  3.    c = 2
  4.    c = 3
 Discuss Question
Answer: Option C. -> c = 2


None.


Latest Videos

Latest Test Papers