If Statement MCQ Questions and Answers

Home | PHP | If Statement

We are providing If Statement question of PHP, where you can learn and practice.

Page: 1/1

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

$x;
if ($x)
print "hi" ;
else
print "how are u";

2) What will be the output of the following PHP code ?

$x = 0;
if ($x++)
print "hi";
else
print "how are u";

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

$x; if ($x == 0)
print "hi" ;
else
print "how are u";
print "hello";

4) What will be the output of the following PHP code ?

  $x = 0;
if ($x == 1)
if ($x >= 0)
print "true";
else
print "false";

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

 $a = 1;
if ($a--)
print "True";
if ($a++)
print "False";

6) What will be the output of the following PHP code ?

 $a = 1;
if (echo $a)
print "True";
else
print "False";

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

 $a = 1;
if (print $a)
print "True";
else
print "False";

8) What will be the output of the following PHP code ?

 $a = 10;
if (1)
print "all";
else
print "some"
else
print "none";

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

 $a = 10;
if (0)
print "all";
if
else
print "some"

10) What will be the output of the following PHP code ?

 $a = "";
if ($a)
print "all";
if
else
print "some";

Download MCQ PDF