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

CSE :: PHP - CS

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

    <?php

    $a = '12345';

    print "qwe".$a."rty";

    ?>

  2. A.

     qwe12345rty

    B.

     qwe$arty

    C.

     error

    D.

     no output


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

    <?php

    $a = '12345';

    echo 'qwe{$a}rty';

    ?>

  4. A.

     qwe12345rty

    B.

     qwe{$a}rty

    C.

     error

    D.

     no output


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

    <?php

    $a = '12345';

    echo "qwe$arty";

    ?>

  6. A.

     qwe12345rty

    B.

     qwe$arty

    C.

     qwe

    D.

     error


  7. PHP can automatically convert integers to floating point numbers and floating point numbers to integers.

  8. A.

     TRUE

    B.

     FALSE


  9. In PHP the integer 45 is stored exactly as 45. The floating point number 46.3 could be stored as.

  10. A.

     46

    B.

     46.3

    C.

     46.2999999

    D.

     none of above


  11. What is the output of given statement?

    Print 17 % 3;

  12. A.

     5.67

    B.

     2

    C.

     5.666667

    D.

     none of above


  13. In order to find if a variable holds an actual number or a string containing characters that can be translated into a number you can use:

  14. A.

     is_num()

    B.

     is_number()

    C.

     if_numeric

    D.

     is_numeric()


  15. The result of both the below expressions in PHP will be same:

    1) 3+4*2

    2) (3+4)*2

  16. A.

     TRUE

    B.

     FALSE


  17. Numbers in PHP can’t be infinitely large or small, there is some minimum and maximum size. If more larger (or smaller) numbers are needed then . . . . . must be used:
    1. GPM libraries
    2. GMP libraries
    3. CBMath
    4. BCMath

  18. A.

     Option 2 and 4

    B.

     Option 3 and 4

    C.

     Option 1 and 4

    D.

     Option 2 and 3


  19. Ceil(-2.1) would be

  20. A.

     3

    B.

     -3

    C.

     -2

    D.

     2