1. How many validation filters like FILTER_VALIDATE_EMAIL are currently available?
Explanation: There are seven validation filters. They are FILTER_VALIDATE_EMAIL, FILTER_VALIDATE_BOOLEAN, FILTER_VALIDATE_FLOAT, FILTER_VALIDATE_INT, FILTER_VALIDATE_IP, FILTER_VALIDATE_REGEXP, FILTER_VALIDATE_URL.
2. Which function initializes the constants necessary for using the openlog(), clodelog(), and syslog() functions?
Explanation: If you’re running PHP version 5.2.X or older, you need to execute this function before using any of the following logging functions.
3. Which variable is used to collect form data sent with both the GET and POST methods?
Explanation: In PHP the global variable $_REQUEST is used to collect data after submitting an HTML form.
4. Objects are defined as instances of user defined classes that can hold ____________?
c) both values and functions
d) None of the above
Explanation: Objects are defined as instances of user-defined classes that can hold both values and functions.
5. Which function is used to remove all HTML tags from a string passed to a form?
Explanation: The function strip_tags() is used to strip a string from HTML, XML, and PHP tags.
6. You can extend the exception base class, but you cannot override any of the preceding methods because they are declared as_______.
Explanation: Marking a method as final prevents it from being overridden by a subclass.
7. How many methods are available for the exception class?
Explanation: The seven methods are: getCode(), getFile(), getLine(), getMessage(), getPrevious(), getTrace(), getTraceAsString().
8. How many compound data types are available in php?
Explanation: The first five are called simple data types and the last three are compound data types.
9. Which two predefined variables are used to retrieve information from forms?
a) $GET & $SET
b) $_GET & $_SET
c) $__GET & $__SET
d) GET & SET
Explanation: The global variables $_GET is used to collect form data after submitting an HTML form with the method=”get”. The variable $_SET is also used to retrieve information from forms.
10. PHP is a __________ language?
a) user-side scripting
b) client-side scripting
c) server-side scripting
d) Both B and C
Explanation: PHP is a server-side scripting language designed specifically for web development.