Home / CSE MCQs / C-MCQs :: Conditional Expressions

CSE MCQs :: C-MCQs

  1. What will be the data type of the expression (a < 50) ? var1 : var2; provided a = int, var1 = double, var2 = float
  2. A.
    float
    B.
    int
    C.
    double
    D.
    Cannot be determined

    View Answer

    Workspace

    Discuss Discuss in Forum


  3. Which expression has to be present in the following? exp1 ? exp2 : exp3;
  4. A.
    exp1
    B.
    exp2
    C.
    exp3
    D.
    All of the mentioned

    View Answer

    Workspace

    Discuss Discuss in Forum


  5. Value of c after the following expression (initializations a = 1, b = 2, c = 1): c += (-c) ? a : b;
  6. A.
    syntax error
    B.
    c = 1
    C.
    c = 2
    D.
    c = 3

    View Answer

    Workspace

    Discuss Discuss in Forum


  7. Comment on the following expression? c = (n) ? a : b; can be rewritten as
  8. A.
    if (!n)c = b; else c = a
    B.
    if (n <= 0)c = b; else c = a;
    C.
    if (n > 0)c = a; else c = b;
    D.
    All of the mentioned

    View Answer

    Workspace

    Discuss Discuss in Forum