• 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 sequences of characters, like 'PHP supports string operations.'?

A - Strings

B - Arrays

C - Objects

D - Resources

Answer : A

Explanation

Strings: are sequences of characters, like 'PHP supports string operations.'

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

Q 7 - Which of the following is used to check that a cookie is set or not?

A - getcookie() function

B - $_COOKIE variable

C - isset() function

D - None of the above.

Answer : C

Explanation

You can use isset() function to check if a cookie is set or not.

Q 8 - Which of the following is an associative array of variables passed to the current script via HTTP cookies?

A - $GLOBALS

B - $_SERVER

C - $_COOKIE

D - $_SESSION

Answer : C

Explanation

$_COOKIE − An associative array of variables passed to the current script via HTTP cookies.

Q 10 - Which of the following method connect a MySql database using PHP?

A - mysql_connect()

B - mysql_query()

C - mysql_close()

D - None of the above

Answer : A

Explanation

PHP provides mysql_connect function to open a database connection.

php_questions_answers.htm
Advertisements