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

Answer : C

Explanation

Both of the above options are correct.

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 is used to get information sent via get method in PHP?

A - $_GET

B - $GET

C - $GETREQUEST

D - None of the above.

Answer : A

Explanation

The PHP provides $_GET associative array to access all the sent information using GET method.

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 function is used to check if a file exists or not?

A - fopen()

B - fread()

C - filesize()

D - file_exist()

Answer : D

Explanation

File's existence can be confirmed using file_exist() function which takes file name as an argument.

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