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

Q41.
What will be the output of the following PHP code ?
<?php
function 2myfunc()
{
    echo "Hello World";
}
2myfunc();
?>
Discuss
Answer: (c).ERROR
Q42.
What will be the output of the following PHP code ?
<?php
function _func()
{
    echo "Hello World";
}
_func();
?>
Discuss
Answer: (a).Hello World
Q43.
What will be the output of the following PHP code ?
<?php
function test($int)
{
    if ($int == 1)
        echo "This Works";
    if ($int == 2)
        echo "This Too Seems To Work";
}
test(1);
TEST(2);
?>
Discuss
Answer: (c).This WorksThis Too Seems To Work
Q44.
What will be the output of the following PHP code ?
<?php
function mine($num)
{
    $num = 2 + $num;
echo $num;
}
mine(3);
?>
Discuss
Answer: (c).5
Q45.
What will be the output of the following PHP code ?
<?php
function mine($num)
{
    $num = 2 + $num;
    echo "$num";
}
mine(3);
?>
Discuss
Answer: (b).$num
Q46.
What will be the output of the following PHP code ?
<?php
function one($string)
{
    echo "I am ". $String;
}
one("Batman");
?>
Discuss
Answer: (d).ERROR
Q47.
What will be the output of the following PHP code ?
<?php
    function string($title);
    {
        $title = ucwords($title);
        echo lcfirst($title);
    }
    string("welcome to compsciedu site");
?>
Discuss
Answer: (d).welcome To Compsciedu Site
Q48.
What will be the output of the following PHP code ?
<?php
    function multi($num)
    {
        if ($num == 3)
            echo "I Wonder";
        if ($num == 7)
            echo "Which One";
        if ($num == 8)
            echo "Is The";
        if ($num == 19)
            echo "Correct Answer";
    }
    $can = stripos("I love php, I love php too!","PHP");
    multi($can);
?>
Discuss
Answer: (b).Which One
Q49.
What will be the output of the following PHP code ?
<?php
function movie($int)
{
    $movies = array("Fight Club", "Kill Bill", "Pulp Fiction");
    echo "You Do Not Talk About ". $movie[$integer];
}
movie(0);
?>
Discuss
Answer: (a).You Do Not Talk About Fight Club
Q50.
What will be the output of the following PHP code ?
<?php
function colour()
{ 
    $colors = array("red", "green", "blue", "yellow"); 
    foreach ($colors as $value)
    {
        echo "$value <br>";
    }
}
colour();
?>
Discuss
Answer: (a).red
green
blue
yellow
Page 5 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!