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

Q51.
What will be the output of the following PHP code ?
<?php
function addFunction($num1, $num2)
{
    $sum = $num1 + $num2;
    return $sum;
}
$return_value = addFunction(10, 20);
echo "Returned value from the function : " .$return_value
?>
Discuss
Answer: (c).Returned value from the function : 30
Q52.
What will be the output of the following PHP code ?
<?php
function time($string)
{
    echo strtr("Towe Pa55", "ow5", $string);
}
time("ims");
?>
Discuss
Answer: (d).Time Pass
Q53.
What will be the output of the following PHP code ?
<?php
function constant()
{
    define("GREETING", "Welcome to Narnia");
    echo greeting;
}
?>
Discuss
Answer: (d).ERROR
Q54.
What will be the output of the following PHP code ?
<?php
function constant()
{
    define("GREETING", "Welcome to Narnia",true);
    echo greeting;
}
?>
Discuss
Answer: (a).Welcome to Narnia
Q55.
What will be the output of the following PHP code ?
<?php
function start($string)
{
    if ($string < 45)
        return 20;
    else
        return 40;
}
$t = start(90);
if ($t < 20)
{
    echo "Have a good day!";
}
else
{
    echo "Have a good night!";
}
?>
Discuss
Answer: (b).Have a good night!
Q56.
What will be the output of the following PHP code ?
<?php
function case()
{
    ECHO "Hello World!<br>";
    echo "Hello World!<br>";
    EcHo "Hello World!<br>";
}
case();
?>
Discuss
Answer: (c).Hello World!
Hello World!
Hello World!
Q57.
What will be the output of the following PHP code ?
<?php
function email()
{
    $email = ’user@yahoo.com’;
    $new = strstr($email, ‘@');
    echo $new;
}
email();
?>
Discuss
Answer: (c).@yahoo.com
Q58.
What will be the output of the following PHP code ?
<?php
function string()
{
    echo strstr("Hello world!", 111);
}
string();
?>
Discuss
Answer: (a).o world!
Q59.
What will be the output of the following PHP code ?
<?php
function CalAll($x,$y)
{
    echo ($x + $y);
    echo "<br>";
    echo ($x - $y);
    echo "<br>";
    echo ($x * $y);
    echo "<br>";
    echo ($x / $y); 
    echo "<br>";
    echo ($x % $y);
}
$x = 10; 
$y = 6;
CalcAll(); 
?>
Discuss
Answer: (b).16
4
60
1.6666666666667
4
Page 6 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!