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 of the following are valid statements to raise an exception

throw new exception()
throw new exception("Error Occured")
throw new exception("Error Occured",5)
All of the above

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

<?php
function myTest() {
    static $x;
    echo $x;
}

myTest();

?> 

0
1
No Output
Error

3. The purpose of r+ mode is?

Opens the file for reading and writing
Places the file pointer at the beginning of the file
Places the file pointer at the end of the file
Both A and B

4. How many value does Boolean data type hold?

1
2
3
4

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

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

<?php 
  
var_dump(strpos("Hello letsfindcourse!", "course")); 
    
?>

int(13)
char(14)
int(14)
int(15)

7. How can errors be logged in files?

Turn on log_errors
Set error_log to file name
Both A and B
None of the above

8. The __________ function searches a string specified by string for a string specified by pattern, returning true if the pattern is found, and false otherwise.

ereg_replace()
ereg()
eregi()
eregi_replace()

9. fopen() requires _______ arguments.

0
1
2
3

10. Predict the output of the following code snippet :

<?php
function sample()
	{
	$var1=20;
	echo $var1;
	echo $GLOBALS['var1'];
	}
$var1=10;
sample();
echo $var1;
?>

201010
202010
101010
201020

Results