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

CSE :: PHP - CS

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

    <?php

    echo $x-- != ++$x;

    ?>

  2. A.

     1

    B.

     0

    C.

     error

    D.

     no output

    View Answer

    Workspace

    Discuss Discuss in Forum


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

    <?php

    $auth = 1;

    $status = 1;

    if ($result = (($auth == 1) && ($status != 0)))

    {

    print "result is $result";

    }

    ?>

  4. A.

     result is true

    B.

     result is 1

    C.

     error

    D.

     no output

    View Answer

    Workspace

    Discuss Discuss in Forum


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

    <?php

    $i = 0;

    while ($i = 10)

    {

    print "hi";

    }

    print "hello";

    ?>

  6. A.

     hello

    B.

     infinite loop

    C.

     hihello

    D.

     error

    View Answer

    Workspace

    Discuss Discuss in Forum


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

    <?php

    $i = "";

    while ($i = 10)

    {

    print "hi";

    }

    print "hello";

    ?>

  8. A.

     hello

    B.

     infinite loop

    C.

     hihello

    D.

     error

    View Answer

    Workspace

    Discuss Discuss in Forum


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

    <?php

    $i = 5;

    while (--$i > 0)

    {

    $i++;

    print $i;

    print "hello";

    }

    ?>

  10. A.

     4hello4hello4hello4hello4hello…..infinite

    B.

     5hello5hello5hello5hello5hello…..infinite

    C.

     no output

    D.

     error

    View Answer

    Workspace

    Discuss Discuss in Forum


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

    <?php

    $i = 5;

    while (--$i > 0 && ++$i)

    {

    print $i;

    }<

    ?>

  12. A.

     5

    B.

     555555555…infinitely

    C.

     54321

    D.

     error

    View Answer

    Workspace

    Discuss Discuss in Forum


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

    <?php

    $i = 5;

    while (--$i > 0 || ++$i)

    {

    print $i;

    }

    ?>

  14. A.

     54321111111….infinitely

    B.

     555555555…infinitely

    C.

     54321

    D.

     5

    View Answer

    Workspace

    Discuss Discuss in Forum


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

    <?php

    $i = 0;

    while(++$i || --$i)

    {

    print $i;

    }

    ?>

  16. A.

     1234567891011121314….infinitely

    B.

     01234567891011121314…infinitely

    C.

     1

    D.

     0

    View Answer

    Workspace

    Discuss Discuss in Forum


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

    <?php

    $i = 0;

    while (++$i && --$i)

    {

    print $i;

    }

    ?>

  18. A.

     1234567891011121314….infinitely

    B.

     01234567891011121314…infinitely

    C.

     no output

    D.

     error

    View Answer

    Workspace

    Discuss Discuss in Forum


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

    <?php

    $i = 0;

    while ((--$i > ++$i) - 1)

    {

    print $i;

    }

    ?>

  20. A.

     00000000000000000000….infinitely

    B.

     -1-1-1-1-1-1-1-1-1-1…infinitely

    C.

     no output

    D.

     error

    View Answer

    Workspace

    Discuss Discuss in Forum