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

CSE :: PHP - CS

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

    <?php

    $x;

    echo "$x";

    ?>

  2. A.

     0

    B.

     1

    C.

     Nothing

    D.

     Error


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

    <?php

    $x = 5;

    {

    $x = 10;

    echo "$x";

    }

    echo "$x";

    ?>

  4. A.

     1010

    B.

     105

    C.

     510

    D.

     error


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

    <?php

    $x = 5;

    {

    echo "$x";

    }

    ?>

  6. A.

     0

    B.

     5

    C.

     Nothing

    D.

     Error


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

    <?php

    $x = 5;

    function fun()

    {

    echo "$x";

    }

    fun();

    ?>

  8. A.

     0

    B.

     5

    C.

     Nothing

    D.

     Error


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

    <?php

    $x = 5;

    function fun()

    {

    $x = 10;

    echo "$x";

    }

    fun();

    echo "$x";

    ?>

  10. A.

     0

    B.

     105

    C.

     510

    D.

     Error


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

    <?php

    $x = 5;

    function fun()

    {

    $x = 10;

    echo "$x";

    }

    fun();

    echo "$x";

    ?>

  12. A.

     0

    B.

     105

    C.

     510

    D.

     Error


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

    <?php

    $x = 4;

    $y = 3;

    function fun($x = 3, $y = 4)

    {

    $z = $x+$y/$y+$x;

    echo "$z";

    }

    echo $x;

    echo $y;

    echo $z;

    fun($x, $y);

    ?>

  14. A.

     43

    B.

     943

    C.

     349

    D.

     439


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

    <?php

    $x =4;

    $y = 3;

    function fun($x, $y)

    {

    $z = $x + $y / $y + $x;

    echo "$z";

    }

    echo $x;

    echo $y;

    echo $z;

    fun(3, 4);

    ?>

  16. A.

     437

    B.

     439

    C.

     349

    D.

     347


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

    <?php

    function fun($x,$y)

    {

    $x = 4;

    $y = 3;

    $z = $x + $y / $y + $x;

    echo "$z";

    }

    fun(3, 4);

    ?>

  18. A.

     7

    B.

     9

    C.

     0

    D.

     Error


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

    <?php

    $x = 3, 4, 5, 6;

    echo "$x";

    ?>

  20. A.

     3

    B.

     4

    C.

     6

    D.

     Error