Conditional Statements
1.

What will be the output of the following PHP code?


<?php
$x;
if ($x)
    print "hi" ;
else
    print "how are u";
?>
A.  

how are u

B.  

hi

C.  

error

D.  

no output

2.

What will be the output of the following PHP code?


<?php
$x = 0;
if ($x++)
    print "hi";
else
    print "how are u";
?>
A.  

hi

B.  

no output

C.  

error

D.  

how are u

3.

What will be the output of the following PHP code?


<?php
$x;
if ($x == 0)
    print "hi" ;
else
    print "how are u";
    print "hello"
?>
A.  

how are uhello

B.  

hihello

C.  

hi

D.  

no output

4.

What will be the output of the following PHP code?

<?php
$x = 0;
if ($x == 1)
    if ($x >= 0)
        print "true";
    else
        print "false"; 
?>
A.  

true

B.  

false

C.  

error

D.  

no output

5.

What will be the output of the following PHP code?

<?php
$a = 1;
if ($a--)
    print "True";
if ($a++)
    print "False"; 
?>
A.  

true

B.  

false

C.  

error

D.  

no output

6.

What will be the output of the following PHP code?

<?php
$a = 1;
if (echo $a)
    print "True";
else
    print "False"; 
?>
A.  

true

B.  

false

C.  

error

D.  

no output
 

7.

What will be the output of the following PHP code?

<?php
$a = 1;
if (print $a)
    print "True";
else
    print "False"; 
?>
A.  

true

B.  

false

C.  

error

D.  

no output

8.

What will be the output of the following PHP code?

<?php
$a = 10;
if (1) 
    print "all";
else 
    print "some"
else 
    print "none";
?>
A.  

all

B.  

some

C.  

error

D.  

none

9.

What will be the output of the following PHP code?

<?php
$a = 10;
if (0) 
    print "all";
 if 
 else 
     print "some"
?>
A.  

all

B.  

some

C.  

error

D.  

no output

10.

What will be the output of the following PHP code?

<?php
$a = "";
if ($a) 
    print "all";
if 
else 
    print "some";
?>
A.  

all

B.  

some

C.  

error

D.  

no output