adplus-dvertising

Welcome to the PHP Controls Structures MCQs Page

Dive deep into the fascinating world of PHP Controls Structures with our comprehensive set of Multiple-Choice Questions (MCQs). This page is dedicated to exploring the fundamental concepts and intricacies of PHP Controls Structures, a crucial aspect of PHP. In this section, you will encounter a diverse range of MCQs that cover various aspects of PHP Controls Structures, from the basic principles to advanced topics. Each question is thoughtfully crafted to challenge your knowledge and deepen your understanding of this critical subcategory within PHP.

frame-decoration

Check out the MCQs below to embark on an enriching journey through PHP Controls Structures. Test your knowledge, expand your horizons, and solidify your grasp on this vital area of PHP.

Note: Each MCQ comes with multiple answer choices. Select the most appropriate option and test your understanding of PHP Controls Structures. You can click on an option to test your knowledge before viewing the solution for a MCQ. Happy learning!

PHP Controls Structures MCQs | Page 7 of 11

Q61.
What will be the output of the following PHP code ?
<?php
$i = 0
while ($i != 3)
{
    print "hi";
 $i++;
}
?>
Discuss
Answer: (b).hi
hi
hi
Q62.
What will be the output of the following PHP code ?
<?php
$i = 0
while ($i < 3)
{
    print "hi";
    $i--;
}
print "hello"
?>
Discuss
Answer: (d).infinite loop
Q63.
What will be the output of the following PHP code ?
<?php
$i = 0
while ($i < 3)
{
    $i++;
}
print $i;
?>

a.

2

b.

3

c.

0

d.

1

Discuss
Answer: (b).3
Q64.
What will be the output of the following PHP code ?
<?php
$i = 0
do
{
    $i++;
}
while ($i < 3);
print $i;
?>

a.

2

b.

3

c.

0

d.

1

Discuss
Answer: (b).3
Q65.
What will be the output of the following PHP code ?
<?php
$i = 0
while ($i++)
{
    print $i;
}
print $i;
?>
Discuss
Answer: (d).1
Q66.
What will be the output of the following PHP code ?
<?php
$i = "";
while($i)
{   
    print "hi";
}
print "hello";
?>
Discuss
Answer: (a).hello
Q67.
What will be the output of the following PHP code ?
<?php
$i = "";
while ($i)
{   
    print "hi";
} 
while($i < 8)
    $i++;
print "hello";
?>
Discuss
Answer: (d).Hi is printed once, hello 7 times and then hi 2 times
Q68.
What will be the output of the following PHP code ?
<?php
$i = 0;
while($i = 10)
{   
    print "hi";
}
print "hello";
?>
Discuss
Answer: (b).infinite loop
Q69.
What will be the output of the following PHP code ?
<?php
$i = "";
while ($i = 10)
{   
    print "hi";
}
print "hello";
?><?php
$i = 5;
while (--$i > 0)
{   
    $i++; print $i; print "hello";
}
?>
Discuss
Answer: (a).4hello4hello4hello4hello4hello…..infinite
Q70.
What will be the output of the following PHP code ?
<?php
$i = 5;
while (--$i > 0 && ++$i)
{   
    print $i;
}
?><?php
$i = 5;
while (--$i > 0 || ++$i)
{   
    print $i;
}
?>
Discuss
Answer: (a).54321111111….infinitely

Suggested Topics

Are you eager to expand your knowledge beyond PHP? We've curated a selection of related categories that you might find intriguing.

Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!