-
What does PHP stand for?
- A) Personal Home Page
- B) Preprocessed Hypertext Processor
- C) PHP: Hypertext Preprocessor
- D) Hypertext Markup Language
Answer: C) PHP: Hypertext Preprocessor
-
Which of the following is not a valid PHP variable name?
- A) $my_var
- B) $myVar123
- C) $_myVar
- D) $123myVar
Answer: D) $123myVar
-
What is the correct way to start a PHP block of code?
- A) <php>
- B) <?php
- C) <?
- D) <?
Answer: B) <?php
-
Which of the following PHP functions is used to open a file for writing?
- A) fopen("filename", "r")
- B) fopen("filename", "w")
- C) fopen("filename", "a")
- D) file_get_contents("filename")
Answer: B) fopen("filename", "w")
-
What does the function
echo
do in PHP?- A) Outputs one or more strings
- B) Returns a value
- C) Parses XML
- D) Creates an array
Answer: A) Outputs one or more strings
-
How do you comment out a single line in PHP?
- A) // Comment
- B) /* Comment */
- C) # Comment
- D) <!-- Comment -->
Answer: A) // Comment
-
What is the correct way to end a PHP statement?
- A) ;
- B) :
- C) ,
- D) .
Answer: A) ;
-
Which function is used to check if a variable is an array in PHP?
- A) is_array()
- B) array()
- C) isArray()
- D) check_array()
Answer: A) is_array()
-
What does the PHP
isset()
function do?- A) Checks if a variable has a value
- B) Checks if a variable is empty
- C) Checks if a variable is set and not null
- D) Checks if a variable is initialized
Answer: C) Checks if a variable is set and not null
-
Which of the following is not a valid PHP comparison operator?
- A) ==
- B) ===
- C) ><
- D) !=
Answer: C) ><
Comments