Question 1. What is the primary purpose of the 'phpinfo()' function in
PHP?
A) To display server configuration information and PHP settings
B) To execute a PHP script from a file
C) To generate a PHP error report
D) To initialize a PHP session
Answer: A
Explanation: The 'phpinfo()' function outputs information about PHP's
configuration, including server details, loaded modules, and
environment settings, aiding in debugging and configuration
verification.
Question 2. Which data type in PHP is used to store a sequence of
characters?
A) Integer
B) String
C) Boolean
D) Array
Answer: B
Explanation: The string data type holds sequences of characters, used for
text manipulation and storage.
Question 3. How do you declare a constant in PHP?
, Zend Certified PHP Engineer Exam
A) define('CONSTANT_NAME', 'value');
B) const CONSTANT_NAME = 'value';
C) const CONSTANT_NAME = 'value';
D) Both A and B are correct
Answer: D
Explanation: PHP supports declaring constants using 'define()' function
and 'const' keyword; both are valid depending on context.
Question 4. Which operator is used for string concatenation in PHP?
A) '.'
B) '+'
C) '&&'
D) '||'
Answer: A
Explanation: The '.' operator concatenates strings in PHP, joining
multiple string values into one.
Question 5. What is the purpose of the 'switch' statement in PHP?
A) To execute multiple statements based on different conditions
B) To replace multiple 'if-else' statements for value matching
C) To iterate over arrays
, Zend Certified PHP Engineer Exam
D) To handle exceptions
Answer: B
Explanation: The 'switch' statement provides a cleaner way to perform
different actions based on the value of an expression, replacing multiple
'if-else' branches.
Question 6. Which looping structure executes its block at least once
regardless of the condition?
A) for
B) while
C) do-while
D) foreach
Answer: C
Explanation: The 'do-while' loop executes its block before checking the
condition, ensuring at least one execution.
Question 7. What is the primary difference between 'include' and
'require' in PHP?
A) 'include' produces a warning on failure, 'require' produces a fatal
error
B) 'require' can include only PHP files, 'include' can include any file
C) 'include' is faster than 'require'
D) There is no difference
, Zend Certified PHP Engineer Exam
Answer: A
Explanation: 'include' issues a warning if the file cannot be included, but
the script continues; 'require' causes a fatal error, stopping script
execution.
Question 8. How does namespace declaration help in PHP?
A) It allows organizing code and avoiding name conflicts
B) It improves script execution speed
C) It encrypts class names for security
D) It replaces the need for autoloading
Answer: A
Explanation: Namespaces organize code into logical groups and prevent
naming conflicts between classes, functions, or constants.
Question 9. Which PHP feature allows defining a function without a
name?
A) Named function
B) Closure (anonymous function)
C) Static method
D) Class method
Answer: B