Vidyalelo
PHP · all questions

Operators And Expressions
practice.

Practice every MCQ with options. Use Show answers when you want the correct option and solution.

143

Questions

6/8

Page

Pick an option on a question to see the right answer and solution.

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

Select an option to see the answer and solution.

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

Select an option to see the answer and solution.

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

Select an option to see the answer and solution.

What will be the output of the following PHP code ?
<?php
$i = 0;
$j = 0;
if (i <span class="p-blue">&& </span> <span class="p-blue">(</span>j = $i + 10)) 
{
    echo "true";
}
echo $j;
?>

Select an option to see the answer and solution.

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

Select an option to see the answer and solution.

What will be the output of the following PHP code ?
<?php
$i = 1;
if (i<span class="p-blue">++ && (</span>i == 1))
    printf("Yesn$i");
else
    printf("Non$i");
?>

Select an option to see the answer and solution.

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

Select an option to see the answer and solution.

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

Select an option to see the answer and solution.

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

Select an option to see the answer and solution.

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

Select an option to see the answer and solution.

What will be the output of the following PHP code ?
<?php
 b = -7; $c =0; 
 a && ++c;
 print a;
?>

Select an option to see the answer and solution.

What will be the output of the following PHP code ?
<?php
c = 4; $a = 5; 
b + a;
print $d;
?>

Select an option to see the answer and solution.

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

Select an option to see the answer and solution.

What will be the output of the following PHP code ?
<?php
$var1 = 1 + ++5;
echo $var1; 
?>

Select an option to see the answer and solution.

What will be the output of the following PHP code ?
<?php
$var1 = 0;
var1 + 5)++; 
echo $var1; 
?>

Select an option to see the answer and solution.

What will be the output of the following PHP code ?
<?php
$var1 = 0;
var1++ + 5; 
echo $var1; 
?>

Select an option to see the answer and solution.

What will be the output of the following PHP code ?
<?php
$var1 = 0;
var1 + 5; 
echo $var1; 
?>

Select an option to see the answer and solution.

What will be the output of the following PHP code ?
<?php
$var1 = 0;
var1 + 5; 
echo $var1++; 
?>

Select an option to see the answer and solution.

What will be the output of the following PHP code ?
<?php
$var1 = 1;
echo var1 % 2 + ++$var1; 
?>

Select an option to see the answer and solution.

What will be the output of the following PHP code ?
<?php
$var1 = 1;
echo var1 % 2 + ++$var1; 
?>

Select an option to see the answer and solution.