1. PHP supports explicit type definition in variable declaration.
a) False
b) True
2. Which of the following differences are valid between PHP 4 and PHP 5?
a) Built-in native support for SQLite
b) improved MySQL support
c) Support for inheritance
d) Both a and b
3. What is the strpos() function used for?
a) Find the last character of a string
b) Both b and c
c) Search for character within a string
d) Locate position of a string’s first character
*4. What is the use of mysql_pconnect()?
a) Used to connect to mysql server
b) Used to create a persistant connection to mysql server.
c) Used to return an identifier of an existing open connection before opening new connection.
d) Both b and c
5. How do I find out the number of parameters passed into function?
a) By using func_num_args()
b) By using func_get_arg()
c) By using func_get_args()
d) None of the above
6. What is the difference between echo and print?
a) They both behave the same.
b) Print can take multiple parameters where as echo cannot
c) Echo can take multiple parameters where as print cannot
d) Print is a function where as echo is not.
*7. Can I have new lines in $subject tag of php's mail function?
a) Yes by specifying /n
b) No
8. Which of the following rules is/are false for exceptions?
a) Each try block or "throw" must have at least one corresponding catch block
b) Multiple catch blocks can be used to catch different classes of exceptions
c) Both a and b
d) Exceptions cannot be thrown (or re-thrown) in a catch block within a try block
*9. How do we start a php session?
a) Using session_start()
b) Using session_register()
c) Using the variable $_SESSION
d) Using session_set()
10. What happens if no file path is given in include() function?
a) PHP continues to execute the script.
b) Results in a fatal error
c) Include_path is made use of
d) It haults the script.
11. What is the purpose of $_SESSION[]?
a) Used to register a global variable
b) Used to initialize a session.
c) Used to store variables of the current session
d) none of the above
*12. A PHP function cannot be overloaded or redefined
a) True
b) False
13. What is PHP heredoc used for?
a) allows creating single line of string without using quotations
b) allows creating multiple lines of string without using quotations
c) allows creating multiple lines of string with quotations
d) allows creating single lines of string with using quotations
14. Can we use include (”test.php”) two times in a PHP page “test1.PHP”?
a) Yes
b) No
15. Which function is used to strip whitespace (or other characters) from the beginning and end of a string?
a) trim_str
b) strip_str
c) strip
d) trim
16. How do we submit form data without a Sumbit button?
a) Using header() function
b) Using Javascript
c) Using fdf_set_submit_form_action() fucntion
d) Both a and b above
*17. Parent constructors are not called __________ if the child class defines a constructor
a) implicitly
b) explicitly
18. What does explode() do?
a) Used to convert a string to an array.
b) Used to split a given string into the number of chunks specified
c) Used to split a string by a string
d) Used to split string into two equal halves.
*19. What is Joomla in PHP?
a) Set of library enriched with fucntions
b) An open source CMS
c) Framework for designing dynamic pages
d) Framework and distribution system for reusable PHP components
*20. Can I generate DLL files from PHP scripts like in Perl?
a) No
b) Yes
21. Which of the following statements is FALSE for PHP Error and Logging?
a) The error and logging functions are part of the PHP core
b) debug_backtrace() generates a backtrace
c) trigger_error() and user_error() are different
22. Can I run several versions of PHP at the same time?
a) Yes
b) No
23. What is array_keys() used for?
a) Compares array keys, and returns the matches
b) Checks if the specified key exists in the array
c) Returns all the keys of an array
d) Both b and c
24. What is the difference between GET and POST method?
a) GET displays the form values entered in the URL of the address bar where as POST does not.
b) POST displays the form values entered in the URL of the address bar where as GET does not.
c) There is no difference
25. PHP supports both simple and multi-dimensional arrays
a) True
b) False
26. Is strstr and strchr aliases?
a) Yes
b) No
27. How do I create PHP arrays in a HTML ?
a) < input name= MyArray[]/>
b) < input ="MyArray[]" />
c) < input name="MyArray[]" />
d) < input MyArray[] />
28. What is x+ mode in fopen() used for?
a) Read/Write. Creates a new file. Returns FALSE and an error if file already exists
b) Write only. Creates a new file. Returns TRUE and an error if file already exists
c) Read/Write. Opens and clears the contents of file;
d) Write. Opens and clears the contents of file;
*29. In mysql_fetch_array() if two or more columns of the result have the same field names, what action is taken?
a) the first column will take precedence
b) the column is skipped
c) the last column will take precedence
d) an error