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 loop evaluates the condition expression as Boolean, if it is true, it executes the statements and when it is false it will terminate?

For loop
while loop
do-while loop
All of the above

2. How many functions does PHP offer for searching and modifying strings using Perl-compatible regular expressions.

5
6
7
8

3. How many ways user can print output in PHP?

1
2
3
4

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

5. what $_SERVER variable do?

Will give the information about all the predefined variables to know the server information
To get the information about the files uploaded using POST methods
When the information is passed using POST methods
None of the above

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

<?php
for ($i = 0; $i < 4; $i++)
{
  for ($j = 0; $j < 3; $j++)
  {
   if ($i > 1)
   continue;
   echo("Hi 
");
  }
}
?>

prints "Hi" 3 times
prints "Hi" 4 times
prints "Hi" 5 times
prints "Hi" 6 times

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

<?php 
  
echo strpos("Hello letsfindcourse!", "lets"), " \n"; 
    
?>

4
5
6
7

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

$i = 0;
while(++$i || --$i)
{   
    print $i;
}

1
01234567891011121314…infinitely
1234567891011121314….infinitely
0

9. Which of the following is/are an exception?
i) OutOfBoundException
ii) OutOfRangeException
iii) OverflowException
iv) UnderflowException

i)
i) and iii)
i) and ii)
i), ii), iii) and iv)

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

Results