My Report

PHP Programming Mock Test 1


Correct Answer: 2 points | Wrong: -1 point
Grades: A* (100% score) | A (80%-99%) | B (60%-80%) | C (40%-60%) | D (0%-40%)
advertisement
 10%

Question 1 of 10

1. Which of the following is/are a PHP code editor?

    i) Notepad
    ii) Notepad++
    iii) Adobe Dreamweaver
    iv) PDT

Question 1 of 10

Question 2 of 10

2. Which of the conditional statements is/are supported by PHP?

i) if statements
ii) if-else statements
iii) if-elseif statements
iv) switch statements

Question 2 of 10

Question 3 of 10

3. What will be the output of the following PHP code?

    <?php
    $fruits = array ("apple", "orange", array ("pear", "mango"),
    "banana");
    echo (count($fruits, 1));
    ?> 

Question 3 of 10

Question 4 of 10

4. What will be the output of the following PHP code?

    <?php 
    $foo = 'Bob';              
    $bar = &$foo;              
    $bar = "My name is $bar";  
    echo $bar;
    echo $foo;
    ?>
        

Question 4 of 10

Question 5 of 10

5. Which of the following function is used to get the value of the previous element in an array?

Question 5 of 10

Question 6 of 10

6. Which of the following PHP functions can be used to get the current memory usage?

Question 6 of 10

Question 7 of 10

7. How to define a function in PHP?

Question 7 of 10

Question 8 of 10

8. What will be the output of the following PHP code?

<?php
$cars = array("Volvo", "BMW", "Toyota");
echo "I like " . $cars[2] . ", " . $cars[1] . " and " . $cars[0] . ".";
?>

Question 8 of 10

Question 9 of 10

9. Who is the father of PHP?

Question 9 of 10

Question 10 of 10

10. What will be the output of the following PHP code?

    <?php
    function a()
    {
        function b()
        {
            echo 'I am b';
 	}
        echo 'I am a';
    }
    a();
    a();
    ?>
        

Question 10 of 10


 

Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.