Home / CSE / PHP - CS :: Functions in PHP

CSE :: PHP - CS

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

    <?php

    function TV($string)

    {

    echo "my favourite TV show is ".$string;

    function b()

    {

    echo " I am here to spoil this code";

    }

    }

    b();

    ?>

  2. A.

     I am here to spoil this code

    B.

     Error

    C.

     My favourite TV show isI am here to spoil this code

    D.

     None of the mentioned


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

    <?php

    function TV($string)

    {

    echo "my favourite TV show is ".$string;

    function b()

    {

    echo " I am here to spoil this code";

    }

    }

    function b()

    {

    echo " I am here to spoil this code";

    }

    b();

    ?>

  4. A.

     I am here to spoil this code

    B.

     Error

    C.

     my favourite TV show isI am here to spoil this code

    D.

     None of the mentioned


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

    <?php

    function TV($string)

    {

    echo "my favourite TV show is ".$string;

    function b()

    {

    echo " I am here to spoil this code";

    }

    }

    function b()

    {

    echo " I am here to spoil this code";

    }

    b();

    TV("Sherlock");

    ?>

  6. A.

     I am here to spoil this code

    B.

     Error

    C.

     My favourite TV show isI am here to spoil this code

    D.

     None of the mentioned


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

    <?php

    function TV($string)

    {

    echo "my favourite TV show is ".$string;

    function b()

    {

    echo " I am here to spoil this code";

    }

    }

    a("Sherlock");

    b();

    ?>

  8. A.

     I am here to spoil this code

    B.

     Error

    C.

     my favourite TV show is SherlockI am here ro spoil this code

    D.

     None of the mentioned


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

    <?php

    function calc($num1, $num2)

    {

    $total = $num1 * $num2;

    }

    $result = calc(42, 0);

    echo $result;

    ?>

  10. A.

     Error

    B.

     0

    C.

     42

    D.

     84


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

    <?php

    function calc($num1, $num2)

    {

    $total = $num1 * $num2;

    return $total;

    }

    $result = calc(42, 0);

    echo $result;

    ?>

  12. A.

     Error

    B.

     0

    C.

     42

    D.

     84


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

    <?php

    $var = 10;

    function one()

    {

    echo $var;

    }

    one();

    ?>

  14. A.

     Error

    B.

     10

    C.

     No Output

    D.

     None of the Mentioned


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

    <?php

    function mine($m)

    {

    if ($m < 0)

    echo "less than 0";

    if ($ >= 0)

    echo "Not True";

    }

    mine(0);

    ?>

  16. A.

     Less Than 0

    B.

     Not True

    C.

     No Output

    D.

     None of the Mentioned


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

    <?php

    $x = 75;

    $y = 25;

    function addition()

    {

    $GLOBALS['z'] = $GLOBALS['x'] + $GLOBALS['y'];

    }

    addition();

    echo $z;

    ?>

  18. A.

     100

    B.

     error

    C.

     75

    D.

     25


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

    <?php

    function 2myfunc()

    {

    echo "Hello World";

    }

    2myfunc();

    ?>

  20. A.

     Hello World

    B.

     No Output

    C.

     ERROR

    D.

     None of the mentioned