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 will be the output of the following PHP code?

$y = 2;
if (--$y == 2 || $y xor --$y)
{
    echo $y;
}

1
0
2
no output

2. Key/value pair can be initialized using = operator?

True
False
Depend on program
Keys does not exist in array

3. Which one of the following PHP function is used to determine a file’s last access time?

fileltime()
filectime()
fileatime()
filetime()

4. A _________ is a way to store information (in variables) to be used across multiple pages.

cookies
filters
session
exception

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

define('IF', 42); 
echo ""IF: "", IF;

IF:42
No output
IF:
Error

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

<?php
echo "This","is"|"a","PHP"."MCQs";
?>

ThisisaPHPMCQs
ThisisPHPMCQs
Thisis a PHPMCQs
Thisis aPHPMCQS

7. The files length can be found using the _______function.

fsize()
fcount()
filesize()
count()

8. What is the use of is_array() function?

Function is used to print the array in readable format.
Adds elements to the beginning of the array and returns the size of array.
Function can be used to verify if a variable is an array. Returns TRUE or FALSE
Adds elements to the end of the array and returns the size of array.

9. Which of the following is true about constant?

Once the Constants have been set, may not be redefined or undefined
Constants may be defined and accessed anywhere without regard to variable scoping rules
Constants cannot be defined by simple assignment, they may only be defined using the define() function
All of the above

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

Results