• PHP Video Tutorials

PHP Online Quiz



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 have only two possible values either true or false?

A - Integers

B - Doubles

C - Booleans

D - Strings

Answer : C

Explanation

Booleans: have only two possible values either true or false.

Q 4 - Which of the following function is used to get length of a string?

A - size()

B - strlen()

C - length

D - None of the above.

Answer : B

Explanation

The strlen() function is used to find the length of a string.

Q 5 - Which of the following variable is used for the PHP script name?

A - $_PHP_SELF

B - $SELF

C - $PHP

D - None of the above.

Answer : A

Explanation

The PHP default variable $_PHP_SELF is used for the PHP script name and when you click "submit" button then same PHP script will be called.

Q 6 - Which of the following function returns the sum of the values in an array?

A - array_sum()

B - array_splice()

C - array_udiff()

D - array_udiff_assoc()

Answer : A

Explanation

array_sum() − Returns the sum of the values in an array.

Q 7 - Which of the following is used to check if session variable is already set or not in PHP?

A - session_start() function

B - $_SESSION[]

C - isset() function

D - session_destroy() function

Answer : C

Explanation

Make use of isset() function to check if session variable is already set or not.

Q 8 - Which of the following provides the size of the uploaded file in PHP?

A - $_FILES['file']['tmp_name']

B - $_FILES['file']['name']

C - $_FILES['file']['size']

D - $_FILES['file']['type']

Answer : C

Explanation

$_FILES['file']['size'] − it provides the size of the uploaded file in PHP.

Q 9 - Which of the following method of Exception class returns array of the backtrace?

A - getMessage()

B - getCode()

C - getTrace()

D - getTraceAsString()

Answer : C

Explanation

getTrace() method of Exception class returns array of the backtrace.

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