• 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 are whole numbers, without a decimal point, like 4195?

A - Integers

B - Doubles

C - Booleans

D - Strings

Answer : A

Explanation

Integers: are whole numbers, without a decimal point, like 4195.

Q 3 - Which of the following magic constant of PHP returns current line number of the file?

A - _LINE_

B - _FILE_

C - _FUNCTION_

D - _CLASS_

Answer : A

Explanation

_LINE_ − The current line number of the file.

Q 4 - Which of the following array represents an array with strings as index?

A - Numeric Array

B - Associative Array

C - Multidimentional Array

D - None of the above.

Answer : B

Explanation

Associative array − An array with strings as index. This stores element values in association with key values rather than in a strict linear index order.

Q 5 - Which of the following function creates an array?

A - array()

B - array_change_key_case()

C - array_chunk()

D - array_count_values()

Answer : A

Explanation

array() − Creates an array.

Q 6 - Which of the following function returns selected parts of an array?

A - array_reverse()

B - array_search()

C - array_shift()

D - array_slice()

Answer : D

Explanation

array_slice() − Returns selected parts of an array.

Q 7 - Which of the following is used to create a session?

A - session_start() function

B - $_SESSION[]

C - isset() function

D - session_destroy() function

Answer : A

Explanation

A PHP session is easily started by making a call to the session_start() function.

Q 8 - Which of the following contains a reference to every variable which is currently available within the global scope of the script?

A - $GLOBALS

B - $_SERVER

C - $_COOKIE

D - $_SESSION

Answer : A

Explanation

$GLOBALS − Contains a reference to every variable which is currently available within the global scope of the script. The keys of this array are the names of the global variables.

Q 10 - Which of the following method returns a formatted string representing a date?

A - time()

B - getdate()

C - date()

D - None of the above

Answer : C

Explanation

The date() function returns a formatted string representing a date. You can exercise an enormous amount of control over the format that date() returns with a string argument that you must pass to it.

php_questions_answers.htm
Advertisements