PHP Programming Quiz


Play this quiz that will help you to excel in PHP certification exams, placements etc. This PHP programming quiz consist of 10 questions that you need to solve in 10 minutes. We’ve specially designed this quiz so that you can quickly acquaint to the pattern of questions you can be asked in placement drives, certification exams etc. This PHP programming test enables you to assess your knowledge of PHP programming.

Take the Free Practice Test



PHP MCQs

Practice PHP MCQ Questions, which will help you to clear your PHP Programming related concepts and also helps you to prepare for placements, technical rounds, interviews, competitive exams etc.

PHP Quiz

Try Free PHP Quiz, to start a quiz you need to login first, after login you will get start quiz button and then by clicking on that you can start quiz. You will get 10 Minutes to answer all questions.

PHP Quiz

1. what is try block do?

It represent block of code in which exception can arise.
It is used in place of catch block or after catch block .
It is used to throw an exception.
None of the above

2. A variable declared _____ has a LOCAL SCOPE?

outside program
inside function
outside function
None Of the Above

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

echo $x-- != ++$x;

1
0
error
no output

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

<?php
echo 'This is  "letsfindcourse"' ;
?>

This is letsfindcourse
This is "letsfindcourse"
Error
No Output

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

<?php
$a = 1;
$b = 2;
$c = 3;
echo ($a * (($b) - $c));
?>

1
-1
2
-2

6. Which data type in PHP offers special variables that hold the references of resources that are external to PHP?

Array
Resources
object
string

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

<?php   
$num = 2; 
do { 
    $num += 2; 
    echo $num, "\n"; 
} while ($num < 0); 
?>

Error
No Output
infinite loop
4

8. Predict the output of the following code snippet :

<?php
$i=10;
function sample($i)
{
    $i+=2;
    GLOBAL $i;
    echo $i+$i,",";
}
echo $i.",";
GLOBAL $i;
sample($i);
echo $i;
?>

10,20,10
10,24,10
10,20,20
10,22,10

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

<?php
$i=-5;
while($i){
        $i++;
        if($i%2==0)
                continue;
        else
        {
                $i++;
        }
       echo($i);
}
?>

4 to 20
-20
Null
infinite loop

10. Why Exception Handling in PHP used?

Separation of error handling code from normal code
Grouping of error types
Both A And B
None of the above

Results