您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

测试您的 PHP 水平的题目_PHP教程

2024/2/18 14:13:07发布24次查看
在 unix review 上看到这个很有意思的测试,和大家共享。 
unixreview.com
may 2007
test your knowledge of php
by emmett dulaney
from: http://www.unixreview.com/documents/s=10130/ur0705d/
increasingly, php seems to be the tool/language that is used to make web sites dynamic. while it is far from the only open source scripting language available, php's abilities and features are quickly making it not only a must-have in the web world but also a topic on many certification exams. following are fifty questions on php at the knowledge level found on beginning/intermediate certification exams. good luck (answers are at the end of the article)!
1. what is the closing tag used by a php-driven web page?
a. />
b. #>
c. ?>
d. .>
2. which php conditional operator means the values are equal and of the same data type?
a. ==
b. ||
c. ===
d. ==?
3. which of the following statements is 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.
4. 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
5. which of the following does not represent a comment in a php script?
a. // this is a comment
b. 
c. # this is a comment
d. /* this is a comment */
6. which escape character in php renders a linefeed?
a. \n
b. \r
c. \t
d. \\
7. what file is used to configure global php settings? ______________ (fill in the blank.)
8. 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
9. which printf type specifier is used for a floating point value?
a. d
b. f
c. s
d. u
10. 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
11. if an array holds 100 entries, which identifier signifies the first entry?
a. 100
b. 99
c. 1
d. 0
12. what function must be called to send the random number generator before array_rand()?
a. limit()
b. scope()
c. srand()
d. hinum()
13. 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
14. 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
15. what is the opening tag used on a php-driven web page?
a. . answer: c.
2. the php conditional operator of three equal signs (===) means the values are equal and of the same data type. answer: c.
3. php variable names are case sensitive and variables do not need to be declared before they can be used. answer: a and d.
4. the include instruction will create a warning, but allow the script to continue running when an error is encountered. answer: c.
5. there are at least three ways to create comments in a php script, and 
6. the \n escape character in php renders a linefeed. answer: a.
7. the global configuration file is php.ini.
8. the command $au++; increments the variable by one – changing it from 7 to 8. answer: a.
9. the printf type specifier f is used for a floating point value. answer: b.
10. the php logical operator to use to see if both a and b are true would be a && b. answer: b.
11. the first entry is 0, the second is 1, and the numbers increment from there. answer: d.
12. the srand() function must be called to send the random number generator before array_rand(). answer: c.
13. the default order resulting from a sort utilizing asort() is alphabetic (a-z) and lowest to highest (0-9). answer: a and c.
14. variable names cannot begin with a numeric character. answer: b.
15. the opening tag used by php is 16. curly braces are used to separate blocks of statements within a control structure. answer: c.
17. the settype function can be used to assign a data type to a variable. answer: c.
18. the remote_addr http variable contains the ip address of the machine making a request. answer: d.
19. the post method should be used for a form as described. answer: a.
20. if the result is not a whole number, it is assigned the double data type if it is a whole number, integer is assigned. answer: b.
21. the r+ 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. answer: c.
22. the copy() function can be used to copy a file. answer: a.
23. to set a cookie to expire 24 hours from now, compute the number of seconds and use the time() function: $cookie_expire = time() +86400. answer: c.
24. the semicolon character (;) is used as a statement terminator to indicate the end of a php command. answer: d.
25. the command $days = array(); will initialize the $days array. answer: b.
26. the file_exists() function can be used to see if a file by the given name is already in existence. answer: d.
27. the value of $_cookie[user] is equal to what was set in the cookie. answer: c.
28. the array_merge() function should be used to combine two or more existing arrays. answer: b.
29. the function to use is session_start()
30. after opening a file with the fopen() function, fclose() is used to close the file pointer. answer: a.
31. the gettype function can be used to show the data type for a variable. answer: b.
32. the rmdir() function removes a directory from a file system. answer: a.
33. sleep() accepts seconds and usleep() accepts milliseconds. answer: b.
34. the sizeof() function can tell how many elements are in an array answer: d.
35. information about a session, by default, is configured in the php configuration file to be saved beneath /tmp. answer: c.
36. $_env contains variables provided to a script by means of the server environment. answer: d.
37. the unlink() function can be used to delete a file. answer: c.
38. the unset function can be used to destroy a variable. answer: d.
39. the a mode of the fopen() function opens a file for writing and places the file pointer at the end of the file. answer: b.
40. the http_user_agent http variable contains the browser type, and browser version, among other values. answer: d.
41. this operation subtracts 150 from the existing value. answer: c.
42. parentheses are used to enclose conditional expressions. answer: b.
43. the boolean php data type can be either true or false. answer: c.
44. $_files contains variables provided to a script by means of file uploads. answer: a.
45. the rand_max constant identifies the highest random number that a system can generate. answer: d.
46. php provides support for posix through functions of the ereg class. answer: b.
47. from a boolean standpoint, every zero value in php is considered false. answer: b.
48. the arsort() function places results in the opposite order of asort(). answer: a.
49. the printf type specifier s is used for a string. answer: c.
50. the != php conditional operator means not equal to. answer: a.
emmett dulaney is the author of the several books on linux/unix and certification as well as a columnist for unixreview.com. emmett's blog can be found at: http://edulaney.blogspot.com, and he can be reached (and welcomes your comments) at: edulaney@insightbb.com.
http://www.bkjia.com/phpjc/318309.htmlwww.bkjia.comtruehttp://www.bkjia.com/phpjc/318309.htmltecharticle在unixreview上看到这个很有意思的测试,和大家共享。 unixreview.com may2007 testyourknowledgeofphp byemmettdulaney from:http://www.unixreview.com/documents/s=10130...
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product