• 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 instances of programmer-defined classes?

A - Strings

B - Arrays

C - Objects

D - Resources

Answer : C

Explanation

Objects: are instances of programmer-defined classes, which can package up both other kinds of values and functions that are specific to the class.

Answer : C

Explanation

Both of the above options are correct.

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 can be used to get an array in the reverse order?

A - array_reverse()

B - array_search()

C - array_shift()

D - array_slice()

Answer : A

Explanation

array_reverse() − Returns an array in the reverse order.

Answer : A

Explanation

To concatenate two string variables together, use the dot (.) operator.

Answer : A

Explanation

PHP provided setcookie() function to set a cookie.

Q 8 - Which of the following provides the error code associated with this file upload?

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

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

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

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

Answer : A

Explanation

$_FILES['file']['error'] − it provides the error code associated with this file upload.

Q 9 - Which of the following method of Exception class retrieve the error message when error occured?

A - getMessage()

B - getCode()

C - getFile()

D - getLine()

Answer : A

Explanation

getMessage() method of Exception class returns the message of exception.

Q 10 - Can you create a class in PHP?

A - true

B - false

Answer : A

Explanation

Yes! class can be created in PHP.

php_questions_answers.htm
Advertisements