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

Q 2 - Which of the following type of variables are named and indexed collections of other values?

A - Strings

B - Arrays

C - Objects

D - Resources

Answer : B

Explanation

Arrays: are named and indexed collections of other values.

Q 4 - Which of the following array represents an array with a numeric index?

A - Numeric Array

B - Associative Array

C - Multidimentional Array

D - None of the above.

Answer : A

Explanation

Numeric array − An array with a numeric index. Values are stored and accessed in linear fashion.

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 function is used to get the size of a file?

A - fopen()

B - fread()

C - filesize()

D - file_exist()

Answer : C

Explanation

The files's length can be found using the filesize() function which takes the file name as its argument and returns the size of the file expressed in bytes.

Q 8 - Which of the following is an array containing information such as headers, paths, and script locations?

A - $GLOBALS

B - $_SERVER

C - $_COOKIE

D - $_SESSION

Answer : B

Explanation

$_SERVER − This is an array containing information such as headers, paths, and script locations. The entries in this array are created by the web server. There is no guarantee that every web server will provide any of these. See next section for a complete list of all the SERVER 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 can be used to create a MySql database using PHP?

A - mysql_connect()

B - mysql_query()

C - mysql_close()

D - None of the above

Answer : B

Explanation

PHP uses mysql_query function to create a MySQL database.


php_questions_answers.htm

Advertisements