50 Most Important Interview Questions of PHP with Answers
..
PHP Objective Questions with Explanation
1. If errors occur while including a file into another file using require() function
a) It stops the execution of the script with a warning and a fatal error
b) It does not give any warning
c) Produces a warning and continue to execute
d) Neither error nor warning takes place.
2. The function imagetypes()
a) Gives the image format
b) Types supported by the current version of GD-PHP.
c) Both a and b
d) None of the above
3. A Persistent Cookie is
a) Not stored in a cookie file on the browser's computer.
b) Temporarily stored in a cookie file on the browser's computer.
c) Permanently stored in a cookie file on the browser's computer.
d) All of the above
4. By default, cookies are
a) temporary
b) Erased if we close the browser.
c) permanent
d) both a and b
5. How can we get IP address of a client in PHP?
a) $_SERVER["IP_ADDR”]
b) $_SERVER["REMOTE_ADDR"];
c) $_SERVER["MAC_ADDR"];
d) $_SERVER["IP_ADD"];
6. The PHP split() function
a) Prints the string
b) Count the number of characters in a string
c) splits a string
d) shows the string
7. The PHP split() function splits a string into
a) An array
b) A character
c) An Integer
d) A float
8. The PHP split() function splits string into an array by
a) Conditions
b) Regular expressions
c) Loops
d) Recursion
9. A regular expression is
a) A sequence of integers
b) A sequence of doubles
c) a sequence of characters
d) a sequence of arrays
10. A regular expression is a sequence of characters that forms
a) A new pattern
b) A search pattern.
c) A browse pattern
d) A print pattern
11. PHP explode() function.
a) Shows a string into an array
b) Prints a string on browser
c) Deletes a string
d) Breaks a string into an array
12. In PHP, regular expressions are strings composed of
a) a pattern
b) Optional modifiers
c) delimiters
d) all of the above
13. htaccess in PHP is a
a) script on apache server
b) configuration file
c) PHP file on apache server
d) Deleted file on apache server
14. Regular expressions can be used
a) To perform all types of text search
b) Text replace operations
c) Both a and b
d) None of the above
15. A regular expression can be
a) a single character
b) a more complicated pattern
c) Both a and b
d) None of the above
16. Which among the following is the encryption function in PHP?
a) MD5()
b) MD2()
c) MD3()
d) MD4()
17. Which of the following errors are not displayed to the user?
a) Fatal Errors
b) Notices
c) Warnings
d) None of the above
18. ___________ function is used to stop the execution of PHP script.
a) stop()
b) exit()
c) quit()
d) abandon()
19. Which of the following errors do not result in script termination?
a) Fatal Errors
b) Notices
c) Warnings
d) None of the above
20. Which among the following is the encryption function in PHP?
a) CRYPTO()
b) CRYPT()
c) ENCRYPT()
d) ECRYPT()
Answers of PHP Objective Questions
1. Answer: a) It stops the execution of the script with a warning and a fatal error
Explanation: If there are any errors, then the require() function produces a warning and a fatal error and stops the script.
2. Answer: c)
Explanation: The function imagetypes() gives the image format and types supported by the current version of GD-PHP.
3. Answer: c)
Explanation: Permanently stored in a cookie file on the browser's computer.
4. Answer: d)
Explanation: By default, cookies are temporary and are erased if we close the browser.
5. Answer: d)
Explanation: We can get IP address of a client using $_SERVER["REMOTE_ADDR"];
6. Answer: c)
Explanation: The PHP split() function splits string into an array by regular expression.
7. Answer: a)
Explanation: The PHP split() function splits string into an array by regular expression.
8. Answer: b)
Explanation: The PHP split() function splits string into an array by regular expression.
9. Answer: c)
Explanation: A regular expression is a sequence of characters that forms a search pattern. When you search for data in a text, you can use this search pattern to describe what you are searching for.
10. Answer: b)
Explanation: A regular expression is a sequence of characters that forms a search pattern. When you search for data in a text, you can use this search pattern to describe what you are searching for.
11. Answer: d)
Explanation: breaks a string into an array
12. Answer: d)
Explanation: In PHP, regular expressions are strings composed of delimiters, a pattern and optional modifiers.
13. Answer: b)
Explanation: The .htaccess is a configuration file on Apache server. You can change configuration settings using directives in Apache configuration files like .htaccess and httpd.conf.
14. Answer: c)
Explanation: Regular expressions can be used to perform all types of text search and text replace operations.
15. Answer: c)
Explanation: A regular expression can be a single character, or a more complicated pattern.
16. Answer: a)
Explanation: CRYPT() and MD5() are the encryption functions in PHP.
17. Answer: b)
Explanation: Notices are non-critical errors. These errors are not displayed to the users.
18. Answer: b)
Explanation: The exit() function is used to stop the execution of PHP script.
19. Answer: c)
Explanation: Warnings are more serious errors, but they do not result in script termination. By default, these errors are displayed to the user.
20. Answer: b)
Explanation: CRYPT() and MD5() are the encryption functions in PHP.
We hope that you must have found this exercise quite useful. If you wish to pursue course on JAVA, PHP, ASP.NET, J2EE, PYTHON, feel free to contact us at +91-9936804420 or email us at info@inspirontechnologies.co.in
Happy Learning
Team Inspiron Technologies
Leave a comment