-- advertisement --

Operators

  1. Which of the following is not a logical operator?
    1. &
    2. &&
    3. ||
    4. !
  1. View Hint | View Answer | Workspace | Discuss In Forum | Report

    & is a Bitwise Operator.

    Correct Option: A

    & is a Bitwise Operator.

    Report

  1. Which of the following statements are correct about the program given below?
    #include <stdio.h>
    int main ( )
    {
    float x = 2.8, y = 2.88;
    if (x = y)
    printf ("x and y are equal\n");
    else
    printf ("x and y are not equal\n");
    return 0;
    }
    1. The output of the program would be "x and y are equal".
    2. The statement if (x = y) would report a compilation error.
    3. Floats cannot be compared using if.
    4. switch should be used to compare floats.
    5. Conditional operates should be used to compare floats.
  1. View Hint | View Answer | Workspace | Discuss In Forum | Report

    There is a non zero assignment value inside "if" so, it if condition will be true hence The output of the program would be "x and y are equal".

    Correct Option: A

    There is a non zero assignment value inside "if" so, it if condition will be true hence The output of the program would be "x and y are equal".

    Report

-- advertisement --


  1. Which of the following is correct order of evaluation for the expression given below ?

    c = a + b * c / 4 % 2 -1;
    1. * / % + - =
    2. = * / % + -
    3. / * % - + =
    4. * / % - + =
    5. - % / * + =
  1. View Hint | View Answer | Workspace | Discuss In Forum | Report

    Refer precedence table

    Correct Option: A

    Refer precedence table
    The output will be
    * / % + - =

    Report

  1. Which of the following is the correct output for the program given below?
    #include <stdio.h>
    int main ( )
    {
    int a, b, c;
    a = b = c =1;
    printf ("a = %d b = %d c = %d\n", ++a, b++, ++c);
    return 0;
    }
    1. a = 2 b = 1 c = 2
    2. a = 2 b = 2 c = 2
    3. a = 2 b = 2 c = 1
    4. a = 1 b = 2 c = 1
  1. View Hint | View Answer | Workspace | Discuss In Forum | Report

    a = 2 b = 1 c = 2

    Correct Option: A

    a = 2 b = 1 c = 2

    Report

-- advertisement --

-- advertisement --