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 the output of the following php code?

<?php
 $alphabet  = array("A" => array
 ( "php" => "php 7.0", "date" => "3 December 2019"),
 "B" => array( "python" => "python 3.8.2",
 "date" => "24 December 2019") );
 echo $alphabet ["A"]["date"];
 ?>

php 7.0
3 December 2019
python 3.8.2
24 December 2019

2. Which of the below statements are false?

Exception class can be inherited
The methods in Exception class are defined as abstract
The methods in Exception class are defined as final
Sub classess of Exception, can define new methods to extend the functionality

3. A function name cannot start with a ____

alphabet
underscore
number
Both C and B

4. A variable name can only contain ____________?

alphanumeric characters
underscores
Both A and B
None of the above

5. Why trim() function is used in php?

to remove whitespaces
to remove lowercase alphabet
to remove uppercase alphabet
to remove underscore

6. Classes are the _______ of objects.

type
blueprints
reference
instances

7. ______________ have a special meaning when used in the context of regular expressions.

()
{}
[]
$

8. In which of the following cases would function empty() return FALSE?

$x; echo empty($x);
$x=FALSE; echo empty($x);
$x=TRUE; echo empty($x);
$x=NULL; echo empty($x);

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

class myObject { }
define('myObject::CONSTANT', 'test');
echo myObject::CONSTANT;

test
error
myObject::CONSTANT
no output

10. Which of the following is the output of the below code?

<?php
class letsfindcourse 
{     
    public $lfc_name = "letsfindcourse"; 
      
    
    public function __construct($lfc_name) 
    { 
        $this->lfc_name = $lfc_name; 
    } 
} 


$lfc = new letsfindcourse("letsfindcourse");  
echo $lfc->lfc_name; 

?> 

letsfindcourse
1
Error
No Output

Results