Home / CSE / PHP - CS :: Operators and Expressions in php

CSE :: PHP - CS

  1. What will be the output of the following PHP code ?

    <?php

    $a = 5; $b = -7; $c =0;

    $d = ++$a && ++$b || ++$c;

    print $d; print $a;

    ?>

  2. A.

     16

    B.

     06

    C.

     15

    D.

     05


  3. What will be the output of the following PHP code ?

    <?php

    $b = 1; $c = 4; $a = 5;

    $d = $b + $c == $a;

    print $d;

    ?>

  4. A.

     5

    B.

     0

    C.

     10

    D.

     1


  5. What will be the output of the following PHP code ?

    <?php

    echo 5 * 9 / 3 + 9;

    ?>

  6. A.

     24

    B.

     3.7

    C.

     3.85

    D.

     0


  7. What will be the output of the following PHP code ?

    <?php

    $var1 = 1 + ++5;

    echo $var1;

    ?>

  8. A.

     no output

    B.

     error

    C.

     6

    D.

     7


  9. What will be the output of the following PHP code ?

    <?php

    $var1 = 0;

    $var1 = ($var1 + 5)++;

    echo $var1;

    ?>

  10. A.

     5

    B.

     error

    C.

     6

    D.

     7


  11. What will be the output of the following PHP code ?

    <?php

    $var1 = 0;

    $var1 = $var1++ + 5;

    echo $var1;

    ?>

  12. A.

     5

    B.

     error

    C.

     6

    D.

     7


  13. What will be the output of the following PHP code ?

    <?php

    $var1 = 0;

    $var1 = ++$var1 + 5;

    echo $var1;

    ?>

  14. A.

     5

    B.

     error

    C.

     6

    D.

     7


  15. What will be the output of the following PHP code ?

    <?php

    $var1 = 0;

    $var1 = $var1 + 5;

    echo $var1++;

    ?>

  16. A.

     5

    B.

     error

    C.

     6

    D.

     7


  17. What will be the output of the following PHP code ?

    <?php

    $var1 = 1;

    echo $var1 = ++$var1 % 2 + ++$var1;

    ?>

  18. A.

     1

    B.

     0

    C.

     2

    D.

     3


  19. What will be the output of the following PHP code ?

    <?php

    $var1 = 1;

    echo $var1 = ++$var1 % 2 + ++$var1;

    ?>

  20. A.

     1

    B.

     0

    C.

     2

    D.

     3