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 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 can be used to get information sent via get/post method in PHP?

A - $_REQUEST

B - $REQUEST

C - $REQUEST_PAGE

D - None of the above.

Answer : A

Explanation

The PHP $_REQUEST variable can be used to get the result from form data sent with both the GET and POST methods.

Q 6 - Singly quoted strings are treated almost literally, whereas doubly quoted strings replace variables with their values as well as specially interpreting certain character sequences.

A - true

B - false

Answer : A

Explanation

Singly quoted strings are treated almost literally, whereas doubly quoted strings replace variables with their values as well as specially interpreting certain character sequences.

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 provides content type of the uploaded file in PHP?

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

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

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

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

Answer : D

Explanation

$_FILES['file']['type'] − it provides the content type of the uploaded file in PHP.

Q 9 - Which of the following method of Exception class returns source filename?

A - getMessage()

B - getCode()

C - getFile()

D - getLine()

Answer : C

Explanation

getFile() method of Exception class returns source filename.

Q 10 - Which of the following method can be used to close a MySql database using PHP?

A - mysql_connect()

B - mysql_query()

C - mysql_close()

D - None of the above

Answer : C

Explanation

PHP uses mysql_close function to close a MySQL database.


php_questions_answers.htm

Advertisements