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

CSE :: PHP - CS

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

    <?php

    $one = "Hello";

    $two = "World";

    echo $one, $two;

    ?>

  2. A.

     Hello World

    B.

     Hello

    C.

     World

    D.

     HelloWorld


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

    <?php

    $one = "Hello";

    $two = "World";

    echo "$one$two";

    ?>

  4. A.

     HelloWorld

    B.

     $one$two

    C.

     Hello

    D.

     Error


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

    <?php

    $one = "Hello";

    $two = "World";

    echo "$one"+"$two";

    ?>

  6. A.

     HelloWorld

    B.

     Hello+World

    C.

     0

    D.

     Error


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

    <?php

    echo "This is India";

    ?>

  8. A.

     This is India

    B.

     This is India

    C.

     This is

    D.

     Error


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

    <?php

    $cars = array("Volvo", "BMW", "Toyota");

    echo "My car is a {$cars[0]}";

    ?>

  10. A.

     My car is a Volvo

    B.

     My car is a BMW

    C.

     My car is a Toyota

    D.

     Error


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

    <?php

    print "echo hello world";

    ?>

  12. A.

     echo hello world

    B.

     hello world

    C.

     nothing

    D.

     error


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

    <?php

    $one = 1;

    print($one);

    print $one;

    ?>

  14. A.

     01

    B.

     11

    C.

     10

    D.

     Error


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

    <?php

    $cars = array("Volvo", "BMW", "Toyota");

    print $cars[2];

    ?>

  16. A.

     Volvo

    B.

     BMW

    C.

     Toyota

    D.

     Error


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

    <?php

    $one = "one";

    $two = "two";

    print($one$two);

    ?>

  18. A.

     onetwo

    B.

     one

    C.

     nothing

    D.

     error


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

    <?php

    $one = "one";

    $two = "two";

    print($one,$two);

    ?>

  20. A.

     onetwo

    B.

     one, two

    C.

     one

    D.

     error