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. Which type of string can processes special characters inside quotes?

single quote string
double quote string
Both A and B
None of the above

2. 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

3. what is finally 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

4. Class is a programmer-defined data type, which includes _____ methods and ______ variable?

local, global
global, global
global, local
local, local

5. What is the output of the following php code?

<?php
    $username = "letsfindcourse";
    if (preg_match("([^a-z])",$username))
        echo "Name must be all lowercase!";
    else
        echo "Name is all lowercase!";
    ?>

Error
No Output
Name must be all lowercase!
Name is all lowercase!

6. Which one is not a data type in PHP?

Resources
Objects
Null
Void

7. How many main parameter are used in for loop?

2
3
4
1

8. Which of the following is not specialized keywords in exception handling.

try
catch
throw
this

9. Predict the output of the following PHP code.

<?php

$fruits = array ("apple", "orange", "banana", "guava", "pine-apple", "papaya", "melon");
next($fruits);
next($fruits);
prev($fruits);

?>

guava
banana
orange
pine-apple

10. The PHP ________ function is used to open a file.

open()
fopen()
create()
insert()

Results