Home / CSE / PHP - CS :: Control Structures(Loop in PHP)

CSE :: PHP - CS

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

    <?php

    $x;

    if ($x)

    print "hi" ;

    else

    print "how are u";

    ?>

  2. A.

     how are u

    B.

     hi

    C.

     error

    D.

     no output


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

    <?php

    $x = 0;

    if ($x++)

    print "hi";

    else

    print "how are u";

    ?>

  4. A.

     hi

    B.

     no output

    C.

     error

    D.

     how are u


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

    <?php

    $x;

    if ($x == 0)

    print "hi" ;

    else

    print "how are u";

    print "hello"

    ?>

  6. A.

     how are uhello

    B.

     hihello

    C.

     hi

    D.

     no output


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

    <?php

    $x = 0;

    if ($x == 1)

    if ($x >= 0)

    print "true";

    else

    print "false";

    ?>

  8. A.

     true

    B.

     false

    C.

     error

    D.

     no output


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

    <?php

    $a = 1;

    if ($a--)

    print "True";

    if ($a++)

    print "False";

    ?>

  10. A.

     true

    B.

     false

    C.

     error

    D.

     no output


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

    <?php

    $x;

    if ($x)

    print "hi" ;

    else

    print "how are u";

    ?>

  12. A.

     how are u

    B.

     hi

    C.

     error

    D.

     no output


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

    <?php

    $x = 0;

    if ($x++)

    print "hi";

    else

    print "how are u";

    ?>

  14. A.

     hi

    B.

     no output

    C.

     error

    D.

     how are u


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

    <?php

    $x;

    if ($x == 0)

    print "hi" ;

    else

    print "how are u";

    print "hello"

    ?>

  16. A.

     how are uhello

    B.

     hihello

    C.

     hi

    D.

     no output


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

    <?php

    $x = 0;

    if ($x == 1)

    if ($x >= 0)

    print "true";

    else

    print "false";

    ?>

  18. A.

     true

    B.

     false

    C.

     error

    D.

     no output


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

    <?php

    $a = 1;

    if ($a--)

    print "True";

    if ($a++)

    print "False";

    ?>

  20. A.

     true

    B.

     false

    C.

     error

    D.

     no output