Here Are 50 Quizzes / Multiple-Choice Questions (Mcqs) Related To
PHP PROGRAMMING
Along With Their Correct Answers
1. What does PHP stand for?
a) Personal Hypertext Preprocessor
b) Pretext Hyperlink Preprocessor
c) PHP: Hypertext Preprocessor
d) Preformatted Hypertext Processor
*Answer: c*
2. Which of the following is NOT a correct PHP variable name?
a) $myVar
b) $_myVar
c) 123var
d) $my_var
*Answer: c*
3. What is the correct way to start a PHP block of code?
a) <?php
b) <?
c) <?=
,d) <!php>
*Answer: a*
4. Which PHP function is used to output data to the browser?
a) echo()
b) print()
c) printf()
d) display()
*Answer: a*
5. Which operator is used for concatenating strings in PHP?
a) .
b) +
c) ,
d) -
*Answer: a*
6. What will the following code output?
$x = 5;
echo ++$x;
a) 6
b) 5
, c) 7
d) 10
*Answer: a*
7. Which superglobal variable is used to collect form data after submitting an
HTML form with method="post"?
a) $_REQUEST
b) $_POST
c) $_GET
d) $_GLOBALS
*Answer: b*
8. What function is used to determine the length of a string in PHP?
a) len()
b) length()
c) str_length()
d) strlen()
*Answer: d*
9. Which loop is used for iterating over an array in PHP?
a) while loop
b) do-while loop
PHP PROGRAMMING
Along With Their Correct Answers
1. What does PHP stand for?
a) Personal Hypertext Preprocessor
b) Pretext Hyperlink Preprocessor
c) PHP: Hypertext Preprocessor
d) Preformatted Hypertext Processor
*Answer: c*
2. Which of the following is NOT a correct PHP variable name?
a) $myVar
b) $_myVar
c) 123var
d) $my_var
*Answer: c*
3. What is the correct way to start a PHP block of code?
a) <?php
b) <?
c) <?=
,d) <!php>
*Answer: a*
4. Which PHP function is used to output data to the browser?
a) echo()
b) print()
c) printf()
d) display()
*Answer: a*
5. Which operator is used for concatenating strings in PHP?
a) .
b) +
c) ,
d) -
*Answer: a*
6. What will the following code output?
$x = 5;
echo ++$x;
a) 6
b) 5
, c) 7
d) 10
*Answer: a*
7. Which superglobal variable is used to collect form data after submitting an
HTML form with method="post"?
a) $_REQUEST
b) $_POST
c) $_GET
d) $_GLOBALS
*Answer: b*
8. What function is used to determine the length of a string in PHP?
a) len()
b) length()
c) str_length()
d) strlen()
*Answer: d*
9. Which loop is used for iterating over an array in PHP?
a) while loop
b) do-while loop