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 5 of 11

Q41.
What will be the output of the following PHP code ?
<?php
if (print "hi" - 1)
    print "hello"
?>
Discuss
Answer: (c).error
Q42.
What will be the output of the following PHP code ?
<?php
$x = 1;
if ($x--)
    print "hi"
    $x--;
else
    print "hello"
?>
a) hi
Discuss
Answer: (c).error
Q43.
What will be the output of the following PHP code ?
<?php
$a = 10;
$b = 11;
if ($a < ++$a || $b < ++$b)
    print "hello";
else
    print "hi";
?>
Discuss
Answer: (a).hi
Q44.
What will be the output of the following PHP code ?
<?php
$a = 2;
if ($a-- - --$a - $a)
    print "hello";
else
    print "hi";
?>
Discuss
Answer: (b).hello
Q45.
What will be the output of the following PHP code ?
<?php
$a = 2;
if ($a-- - --$a - $a)
    print "hello";
else
    print "hi";
?><?php
$a = "hello";
if ($a.length)
    print $a.length;
else
    print "hi";
?>
Discuss
Answer: (a).hellolength
Q46.
What will be the output of the following PHP code ?
<?php
$a = "hello";
if (strlen($a))
    print strlen($a);
else
    print "hi";
?>
Discuss
Answer: (b).5
Q47.
What will be the output of the following PHP code ?
<?php
$a = "1";
$b = "0";
if ((int)$a && $b) 
    print"hi";
else 
    print "hello";
?>
Discuss
Answer: (a).hello
Q48.
What will be the output of the following PHP code ?
<?php
$a = "1";
switch ($a)
{
case 1:
    print "hi";
case 2:
    print "hello";
default:
    print "hi1";
}
?>
Discuss
Answer: (a).hihellohi1
Q49.
What will be the output of the following PHP code ?
<?php
$a = "2";
switch ($a)
{
case 1:
    print "hi";
case 2:
    print "hello";
    break;
default:
    print "hi1";
}
?>
Discuss
Answer: (b).hello
Q50.
What will be the output of the following PHP code ?
<?php
$a = "1";
switch($a)
{
case 1:
    break;
    print "hi";
case 2:
    print "hello";
    break;
default:
    print "hi1";
}
?>
Discuss
Answer: (b).no output
Page 5 of 11

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!