adplus-dvertising

Welcome to the Functions in PHP MCQs Page

Dive deep into the fascinating world of Functions in PHP with our comprehensive set of Multiple-Choice Questions (MCQs). This page is dedicated to exploring the fundamental concepts and intricacies of Functions in PHP, a crucial aspect of PHP. In this section, you will encounter a diverse range of MCQs that cover various aspects of Functions in PHP, 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 Functions in PHP. 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 Functions in PHP. You can click on an option to test your knowledge before viewing the solution for a MCQ. Happy learning!

Functions in PHP MCQs | Page 4 of 6

Q31.
What will be the output of the following PHP code ?
<?php
    function uppercase($string)
    {
        echo ucwords($string);
    }
    $wow = "uppercase";
    $wow("Time to live king size");
?>
Discuss
Answer: (d).Time To Live King Size
Q32.
What will be the output of the following PHP code ?
<?php
    function TV($string)
    {
        echo "my favourite TV show is ".$string;
        function b()
        {
            echo " I am here to spoil this code";
        }
    }
    b();
?>
Discuss
Answer: (b).Error
Q33.
What will be the output of the following PHP code ?
<?php
    function TV($string)
    {
        echo "my favourite TV show is ".$string;
        function b()
        {
            echo " I am here to spoil this code";
        }
    }
    function b()
    {
        echo " I am here to spoil this code";
    }
    b();
?>
Discuss
Answer: (a).I am here to spoil this code
Q34.
What will be the output of the following PHP code ?
<?php
    function TV($string)
    {
        echo "my favourite TV show is ".$string;
        function b()
        {
            echo " I am here to spoil this code";
        }
    }
    function b()
    {
        echo " I am here to spoil this code";
    }
    b();
    TV("Sherlock");
?>
Discuss
Answer: (b).Error
Q35.
What will be the output of the following PHP code ?
<?php
    function TV($string)
    {
        echo "my favourite TV show is ".$string;
        function b()
        {
            echo " I am here to spoil this code";
        }
    }
    a("Sherlock");
    b();
?>
Discuss
Answer: (c).my favourite TV show is SherlockI am here to spoil this code
Q36.
What will be the output of the following PHP code ?
<?php
    function calc($num1, $num2)
    {
        $total = $num1 * $num2; 
    }
    $result = calc(42, 0);
    echo $result;    
?>
Discuss
Answer: (a).Error
Q37.
What will be the output of the following PHP code ?
<?php
    function calc($num1, $num2)
    {
        $total = $num1 * $num2;
        return $total; 
    }
    $result = calc(42, 0);
    echo $result;    
?>
Discuss
Answer: (b).0
Q38.
What will be the output of the following PHP code ?
<?php
    $var = 10;
    function one()
    {
        echo $var;
    }
    one();
?>
Discuss
Answer: (c).No Output
Q39.
What will be the output of the following PHP code ?
<?php
    function mine($m)
    {
        if ($m < 0)
            echo "less than 0";
        if ($ >= 0)
            echo "Not True";
    }
    mine(0);
?>
Discuss
Answer: (b).Not True
Q40.
What will be the output of the following PHP code ?
<?php 
$x = 75;
$y = 25; 
function addition()
{
    $GLOBALS['z'] = $GLOBALS['x'] + $GLOBALS['y'];
}
addition();
echo $z;
?>
Discuss
Answer: (a).100
Page 4 of 6

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!