1.
What will be the output of the following PHP code ?
<?php
$i = 2;
while (++$i)
{   
    while ($i --> 0)
        print $i;
}
?>

2.
What will be the output of the following PHP code ?
<?php
$i = 2;
while (++$i)
{   
    while (--$i > 0)
        print $i;
}
?>

3.
What will be the output of the following PHP code ?
<?php
echo 5 * 9 / 3 + 9;
?>

4.
What will be the output of the following PHP code ?
<?php
$i = 0;
$j = 0;
if ($i &&  ($j = $i + 10)) 
{
    echo "true";
}
echo $j;
?>

5.
What will be the output of the following PHP code ?
<?php
$i = 10;
$j = 0;
if ($i || ($j = $i + 10)) 
{
    echo "true";
}
echo $j;
?>

6.
What will be the output of the following PHP code ?
<?php
$i = 1;
if ($i++ && ($i == 1))
    printf("Yesn$i");
else
    printf("Non$i");
?>

7.
What will be the output of the following PHP code ?
<?php
$a = 1; $b = 3;
$d = $a++ + ++$b;
echo $d;
?>

8.
What will be the output of the following PHP code ?
<?php
$a = 1; $b = 1; $d = 1;
print ++$a + ++$a+$a++; print $a++ + ++$b; print ++$d + $d++ + $a++;
?>

9.
What will be the output of the following PHP code ?
<?php
$a = 10; $b = 10;
if ($a = 5)
    $b--;
print $a;print $b--;
?>

10.
What will be the output of the following PHP code ?
<?php
$i = 0;
$x = $i++; $y = ++$i;
print $x; print $y; 
?>

Read More Section(Operators and Expressions in php)

Each Section contains maximum 100 MCQs question on Operators and Expressions in php. To get more questions visit other sections.