Operators


  1. Which of the following is the correct order of calling functions in the code snippet given below?
    a = f1 (10, 20 ) * f2 (30/40) + f3();









  1. View Hint View Answer Discuss in Forum

    Here, the multiplication will happen before the addition, but in which order the functions would be called is undefined.

    Correct Option: C

    Here, the multiplication will happen before the addition, but in which order the functions would be called is undefined. In an arithmetic expression the parentheses tell the compiler which operands go with which operators but do not force the compiler to evaluate everything within the parentheses first.


  1. Which of the following is the correct output for the program given below?
    #include <stdio.h>
    int main ( )
    {
    int a = 25;
    printf ("%d %d %d\n",a <= 20, a = 15, a >= 10);
    return 0;
    }











  1. View Hint View Answer Discuss in Forum

    In printf the execution of expressions is from Right to Left.

    Correct Option: A

    Step 1: int a=25; here variable a is declared as an integer type and initialized to '25'.

    Step 2: printf("%d, %d, %d\n", a<=25, a=20, a>=10);
    In printf the execution of expressions is from Right to Left.
    here a>=10 returns TRUE hence it prints '1'.
    a=15 here a is assigned to 15 Hence it prints '15'.
    a<=55 returns TRUE. hence it prints '1'.

    Step 3: Hence the output is "1, 15, 1".