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

CSE :: PHP - CS

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

    <?php

    "Hello World"

    ?>

  2. A.

     Error

    B.

     Hello World

    C.

     Nothing

    D.

     Missing semicolon error


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

    <?php

    print_r "Hello world"

    ?>

  4. A.

     Error

    B.

     Hello World

    C.

     Nothing

    D.

     Missing semicolon error


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

    <?php

    $color = "red";

    echo "$color";

    echo "$COLOR";

    echo "$Color";

    ?>

  6. A.

     redredred

    B.

     redred

    C.

     red

    D.

     Error


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

    <?php

    # echo "Hello world";

    echo "# Hello world";

    ?>

  8. A.

     # Hello world

    B.

     Hello world# Hello world

    C.

     Hello world

    D.

     Error


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

    <?php

    echo "Hello World"

    ?>

  10. A.

     Hello world

    B.

     Hello world in italics

    C.

     Nothing

    D.

     Error


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

    <?php

    echo "echo "Hello World"";

    ?>

  12. A.

     Hello world

    B.

     echo “Hello world”

    C.

     echo Hello world

    D.

     Error


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

    <?php

    <?php

    echo "Hello world";

    ?>

    ?>

  14. A.

     Hello

    B.

     Hello world

    C.

     Nothing

    D.

     Error


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

    <?php

    $color = red;

    echo "$color";

    ?>

  16. A.

     red

    B.

     $color

    C.

     red

    D.

     Error


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

    <?php

    $color = red;

    echo "$color" . red ;

    ?>

  18. A.

     red red

    B.

     red

    C.

     error

    D.

     nothing


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

    <?php

    $color1 = red;

    $color2 = green;

    echo "$color1"."$color2";

    ?>

  20. A.

     red green

    B.

     red

    C.

     green

    D.

     error