• 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

Q 2 - Which of the following type of variables are floating-point numbers, like 3.14159 or 49.1?

A - Integers

B - Doubles

C - Booleans

D - Strings

Answer : B

Explanation

Doubles: are floating-point numbers, like 3.14159 or 49.1.

Q 4 - Which of the following keyword causes the loop to skip the remainder of its body and immediately retest its condition prior to reiterating?

A - break

B - continue

Answer : B

Explanation

continue causes the loop to skip the remainder of its body and immediately retest its condition prior to reiterating.

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 - If there is any problem in loading a file then the require() function generates a warning but the script will continue execution.

A - true

B - false

Answer : B

Explanation

If there is any problem in loading a file then the require() function generates a fatal error and halt the execution of the script.

Q 7 - Which of the following is used to get cookies?

A - getcookie() function

B - $_COOKIE variable

C - isset() function

D - None of the above.

Answer : B

Explanation

PHP provides many ways to access cookies. Simplest way is to use either $_COOKIE or $HTTP_COOKIE_VARS variables.

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 9 - Which of the following gives a string containing PHP script file name in which it is called?

A - $_PHP_SELF

B - $php_errormsg

C - $_COOKIE

D - $_SESSION

Answer : A

Explanation

$_PHP_SELF − A string containing PHP script file name in which it is called.

Q 10 - final keyword prevents child classes from overriding a method by prefixing the definition with final?

A - true

B - false

Answer : A

Explanation

PHP 5 introduces the final keyword, which prevents child classes from overriding a method by prefixing the definition with final. If the class itself is being defined final then it cannot be extended.

php_questions_answers.htm
Advertisements