Professional Documents
Culture Documents
< ?php
one = 1;
two = 2;
three = 3;
four = 4;
echo "one / two + three / four";
?>
A. 0.75 B. 0.25 C. 1.25 D. Error
4. What will be the output of the following PHP code?
< ?php
echo $red ;
?>
A. 0 B. Nothing C. True D. Error
5. Which of the following are correct ways of creating an array?
(i) state[0] = “Daffodil”;
(ii) $state[] = array(“Daffodil”);
(iii) $state[0] = “Daffodil”;
(iv) $state = array(“Daffodil”);
A. (iii) and (iv) B. (ii) and (iii)
C. Only (i) D. (ii), (iii) and (iv)
6. What will be the output of the following PHP code?
<?php
var $one = 1;
var $two = 2;
echo "$one / $two * $one / $two * $two";
?>
A. 1 B. 0 C. 0.5 D. Error
7. Which two predefined variables are used to retrieve information from forms?
A. $GET & $SET B. $_GET & $_SET C. $__GET & $__SET D. GET & SET
8. Which variable is used to collect form data sent with both the GET and POST methods?
A. $BOTH B. $_BOTH C. $REQUEST D. $_REQUEST
9. What will be the output of the following PHP code?
<?php
$a = 0;
$b = 0;
for( $i = 0; $i<5; $i++ ) {
$a += 10;
$b += 5;
}
echo ("At the end of the loop a = $a and b = $b”);
?>
Output:
10. Why Php is called a loosely typed language? Explain with example 2
11. Write a Program to swap two numbers in PHP. 4