|
在 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.
D.
Answers
1. The closing tag used by PHP is ?>. 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
|
|