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. Objects are also known as ______.

reference
template
class
instances

2. What will be the output of the following code?

<?php

function WRITEMSG() {
    echo "Hello world!";
}

writemsg();
?>

Hello world!
Null
No Output
None of the above

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

4. Which function returns an array consisting of associative key/value pairs?

count()
array_count()
array_count_values()
count_values()

5. A cache is a collection of duplicate data, where the original data is expensive to fetch or compute (usually in terms of access time) relative to the cache.

TRUE
FALSE
Can be true or false
None of the above

6. Function names are case-sensitive.

True
False
Only Built-In function
Only User-defined function

7. The spliti() function operates exactly in the same manner as its sibling split(), except that it is not case sensitive.

TRUE
FALSE
Can be true or false
Can not say

8. Predict the output of the following code snippet :

<?php
$str="chess was played";
echo strlen(substr($str,3,2))."
"
?>

1
2
3
Array

9. Rimo is handling the exception raised by Nanda and wants to print the appropriate error message and code. Identify the correct catch block

catch() { echo getMessage(); echo getCode(); }
catch(Exception $e) { echo $e->getMessage(); echo $e->getCode(); }
catch(Exception $e) { echo "Message:Uninitialized Variable"; echo "Code:5"; }
None of the above

10. Predict the output of the following code snippet :

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

11,11,11
10,11,11
10,11,10
10,10,10

Results