Vous êtes sur la page 1sur 7

Topic: PHP Question Set: 1 Total Marks: 50 Time Given: 30 minutes 1.

Which PHP conditional operator means the values are equal AND of the same data type? A. == B. || C. === D. ==? 2. Which of the following statements are true regarding variables in PHP (choose two)? A. Variable names in PHP are case sensitive. B. Variable names in PHP are not case sensitive. C. PHP variables need to be declared before they can be used. D. PHP variables do not need to be declared before they can be used. 3. You are evaluating a script written by a previous employee. That script contains a require statement that causes the script to exit when an error occurs. You want to change this so the script will generate a warning when such an error occurs, but keep on running. What should you replace require with? A. involve B. need C. include D. call_for 4. Which escape character in PHP renders a linefeed? A. \n B. \r C. \t D. \\ 5. What file is used to configure global PHP settings? 6. If the value of $AU is currently 7, what is its value as a result of the command $AU++; A. 8 B. 9 C. 14 D. 49 7. Which printf type specifier is used for a floating point value? A. d B. f C. s D. u 8. Which PHP logical operator is used to see if both a and b are true? A. a & b B. a && b C. a | b D. a || b 9. If an array holds 100 entries, which identifier signifies the first entry? A. 100 B. 99 C. 1 D. 0

10. What function must be called to send the random number generator before array_rand()? A. limit() B. scope() C. srand() D. hinum() 11. Which two choices below represent the default order resulting from a sort utilizing asort()? A. A-Z B. Z-A C. 0-9 D. 9-0 12. Which of the following is not true for variable names? A. They can contain an underscore character B. They can begin with a numeric character C. They can begin with an alpha character D. They can contain alphanumeric characters 13. What are used to separate blocks of statements within a control structure? A. brackets [ ] B. parentheses ( ) C. curly braces { } D. quotation marks "" 14. Which function can be used to assign a data type to a variable? A. assign B. assigntype C. settype D. type 15. Which HTTP variable contains the IP address of the machine making a request? A. ADDR_IP B. ADDR C. IP_ADDR D. REMOTE_ADDR 16. You are creating a simple form for web users to send you a message. Which method should be used with that form? A. POST B. GET C. SEND D. READ 17. Within your PHP script, you are performing a division operation on two variables. What data type is assigned to the division result, by default, if it is a fractional result? A. integer B. double C. string D. Boolean 18. Which mode of the fopen() function opens a file for reading or writing, maintains exiting content, and places the file pointer at the beginning of the file? A. w B. a C. r+ D. w+

19. Which function can be used to copy a file? A. copy() B. clone() C. rename() D. repr() 20. Which of the following is used to set a cookie to expire 24 hours from now? A. $cookie_expire = time() +24 B. $cookie_expire = time() +1440 C. $cookie_expire = time() +86400 21. Which character is used as a statement terminator to indicate the end of a PHP command? A. = B. # C. | D. ; 22. Which of the following commands will initialize the $days array? A. $days = () B. $days = array(); C. $days = "" D. $days = initialize [ ] E. 12345 F. 12,3,45 G. 1{2,3,4}5 23. What function can be used to see if a file exists? A. file() B. file_there() C. exist_file() D. file_exists() 24. To create a cookie, your code uses the following entry: SetCookie ("user", "Emmett Dulaney", time() +1800); Which of the following is the best to use to see the value "Emmett Dulaney"? A. $user B. $COOKIE[user] C. $_COOKIE[user] D. $COOKIE_user 25. Which of the following should be used to combine two or more existing arrays? A. array_add() B. array_merge() C. array_join() D. array_combine() 26. What function is used to determine whether a session has been started for the current user and then start one if necessary? 27. After opening a file with the fopen() function, what is used to close the file pointer? A. fclose() B. close() C. die() D. end()

28. Which of the following functions can be used to show the data type for the $remain variable? A. echo show($remain); B. echo gettype($remain); C. echo type($remain); D. echo explain($remain); 29. Which of the following functions removes a directory from a file system? A. rmdir() B. dir() C. del() D. dir_gone() 30. What is the difference between sleep() and usleep()? A. sleep() suspends operations and usleep() resumes them B. sleep() accepts seconds and usleep() accepts milliseconds C. sleep() works for the current process and usleep() works for all processes D. sleep() can only be specified for the current user and usleep() can be specified for all users 31. You need to know how many elements are in an array. What function should you use to count this? A. list() B. count() C. number() D. sizeof() 32. Information about a session, by default, is configured in the PHP configuration file to be saved beneath which directory? A. /var B. /etc C. /tmp D. /usr 33. Which of the following contains variables provided to a script by means of the server environment? A. $_FILES B. $_POST C. $_GET D. $_ENV 34. Which of the following can be used to delete a file? A. delete() B. rid() C. unlink() D. close() 35. Which of the following functions can be used to destroy a variable? A. erase B. fi C. remove D. unset 36. Which mode of the fopen() function opens a file for writing and places the file pointer at the end of the file? A. w B. a C. r+ D. w+

37. Which HTTP variable contains the browser type, and browser version, among other values? A. BROWSE_AGENT B. BROWSER_TYPE C. BROWSER_ENV D. HTTP_USER_AGENT 38. If the current value of $bsns is 4400, what is the new value as a result of this command: $bsns -= 150; A. -150 B. 150 C. 4250 D. 4400 E. 4550 F. "4400-150" 39. What are used to enclose conditional expressions? A. brackets [ ] B. parentheses ( ) C. curly braces { } D. quotation marks " " 40. Which PHP data type can be either TRUE or FALSE? A. Truth B. Integer C. Boolean D. Float 41. Which of the following contains variables provided to a script by means of file uploads? A. $_FILES B. $_POST C. $_GET D. $_ENV 42. Which constant identifies the highest random number that the system can generate? A. URAND B. END_NUMBER C. ULIMIT D. RAND_MAX 43. PHP provides support for POSIX through functions of which class? A. grep B. ereg C. psx D. efgrp 44. From a Boolean standpoint, every zero value in PHP is considered: A. True B. False C. Error D. Null 45. Which function places results in the opposite order of asort()? A. arsort() B. rev() C. trosa() D. zsort()

46. Which printf type specifier is used for a string? A. d B. f C. s D. u 47. Which PHP conditional operator means not equal to? A. != B. =! C. <=> D. <> 48. Which of the following can be used to get the ID generated from a previous INSERT operation? A. mysql_get_id() B. mysql_fetch_id() C. mysql_get_insert_id() D. mysql_insert_id() 49. Which of the following can be used to fetch a result row as an associative array, a numeric array, or both? A. mysql_fetch_row() B. mysql_fetch_assoc() C. mysql_fetch_object() D. mysql_fetch_array() 50. Which of the following can be used to get a result row as an enumerated array? A. mysql_fetch_row() B. mysql_fetch_assoc() C. mysql_fetch_object() D. mysql_fetch_array()

------------------------------------

Answers 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40. 41. 42. 43. 44. 45. 46. 47. 48. 49. 50. C A and D C A php.ini A B B D C A and C B C C D A B C A C D B D C B session_start() A B A B D C D C D B D C B C A D B B A C A D D A