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

Answer : C

Explanation

Both of the above options are correct.

Q 4 - Which of the following function is used to get length of a string?

A - size()

B - strlen()

C - length

D - None of the above.

Answer : B

Explanation

The strlen() function is used to find the length of a string.

Q 5 - Which of the following function is used to get environment variables in PHP?

A - search()

B - environment()

C - env()

D - getenv()

Answer : D

Explanation

PHP provides a function getenv() to access the value of all the environment variables.

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 is used to delete a cookie?

A - setcookie() function

B - $_COOKIE variable

C - isset() function

D - None of the above.

Answer : A

Explanation

To delete a cookie you should call setcookie() with the name argument only.

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