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

Q21.
What will be the output of the following PHP code?
<?php
    echo str_pad("Salad", 5)." is good.";
?>
Discuss
Answer: (d).Salad is good
Q22.
What will be the output of the following PHP code?
<?php
    $str = "Hello World"
    echo wordwrap($str,5,"<br>\n");    
?>
Discuss
Answer: (b).Hello
World
Q23.
What will be the output of the following PHP code?
<?php
    echo ucwords("i love my country");
?>
Discuss
Answer: (d).I Love My Country
Q24.
What will be the output of the following PHP code?
<?php
    echo lcfirst("welcome to India");
?>
Discuss
Answer: (a).welcome to India
Q25.
What will be the output of the following PHP code?
<?php
    echo hex2bin("48656c6c6f20576f726c6421");
?>
Discuss
Answer: (a).Hello World!
Q26.
What will be the output of the following PHP code?
<?php 
    $str = addslashes('What does "yolo" mean?');
    echo($str); 
?>
Discuss
Answer: (c).What does \”yolo\” mean?
Discuss
Answer: (b).Array ( [0] => Hello [1] => world. [2] => It’s [3] => a [4] => beautiful [5] => day. )
Q28.
What will be the output of the following PHP code?
<?php
    echo strtr("Hilla Warld","ia","eo");
?>
Discuss
Answer: (b).Hello World
Q29.
What will be the output of the following PHP code?
<?php
    echo stripos("I love php, I love php too!","PHP");
?>

a.

3

b.

7

c.

8

d.

10

Discuss
Answer: (b).7
Q30.
What will be the output of the following PHP code ?
<?php
    function A1($x)
    {
        switch($x)
        {
        case 1: 
            //this statement is the same as if($x == 1)
            echo 'Case 1 was executed.';
            break;
        case 2: 
            //this statement is the same as if($x == 2)
            echo 'Case 2 was executed.';
            break;
        case 3: 
            //this statement is the same as if($x == 3)
            echo 'Case 3 was executed.';
            break;
        case 4: 
            //this statement is the same as if($x == 4)
            echo 'Case 4 was executed.';
            break;
        default: 
            //this statement is the same as if $x does not equal the other conditions
            echo 'Default was executed.';
            break;
 
        }
    }
    A1(9);
?>
Discuss
Answer: (d).Case 4 was executed
Page 3 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!