PHP Online Quiz


Advertisements


Following quiz provides Multiple Choice Questions (MCQs) related to PHP. You will have to read all the given answers and click over the correct answer. If you are not sure about the answer then you can check the answer using Show Answer button. You can use Next Quiz button to check new set of questions in the quiz.

Questions and Answers

Answer : D

Explanation

All of the above options are correct.

Q 2 - Which of the following type of variables are special type that only has one value: NULL?

A - Strings

B - Doubles

C - Booleans

D - NULL

Answer : D

Explanation

NULL: is a special type that only has one value: NULL.

Answer : C

Explanation

Both of the above options are correct.

Q 4 - Which of the following magic constant of PHP returns class method name?

A - _METHOD_

B - _FILE_

C - _FUNCTION_

D - _CLASS_

Answer : A

Explanation

_METHOD_ − The class method name. (Added in PHP 5.0.0) The method name is returned as it was declared (case-sensitive).

Q 5 - Which of the following function sorts an array in reverse order?

A - rsort()

B - sort()

C - shuffle()

D - reset()

Answer : A

Explanation

rsort() − Sorts an array in reverse order.

Q 6 - Which of the following function opens a file?

A - fopen()

B - fread()

C - filesize()

D - file_exist()

Answer : A

Explanation

The PHP fopen() function is used to open a file. It requires two arguments stating first the file name and then mode in which to operate.

Q 7 - Which of the following is used to check that a cookie is set or not?

A - getcookie() function

B - $_COOKIE variable

C - isset() function

D - None of the above.

Answer : C

Explanation

You can use isset() function to check if a cookie is set or not.

Q 8 - Which of the following is used to destroy the session?

A - session_start() function

B - $_SESSION[]

C - isset() function

D - session_destroy() function

Answer : D

Explanation

A PHP session can be destroyed by session_destroy() function.

Q 10 - Which of the following method returns current date and time?

A - time()

B - getdate()

C - date()

D - None of the above

Answer : A

Explanation

PHP's time() function gives you all the information that you need about the current date and time. It requires no arguments but returns an integer.


php_questions_answers.htm

Advertisements