Zend认证试题
第一章(PHP Programming Basics)
ZendChina官方:最重要的是要您要掌握好基础知识。这些知识是需要您一直去关注和学习的,因为它们是学习PHP语言的根基。考试中您没有准备到的部分也可能是您日常程序开发中不会接触到的知识,但是本章中的问题还是需要得到您的重视,毕竟,如果您对最基本知识了解不够,对于您更深入的学习和开发也会带来诸多不便。
1、Choose the selection that best matches the following statements:
PHP is a _____ scripting language based on the ____ engine. It is primarily used to develop dynamic
_____ content, although it can be used to generate ____ documents(among others) as well.
A.Dynamic, PHP, Database, HTML
B.Embedded, Zend, HTML, XML
C.Perl-based, PHP, Web, Static
D.Embedded, Zend, Docbook, MySQL
E.Zend-based, PHP, Image, HTML
2、Which of the following tags is not a valid way to begin and end a PHP code block?
A.<% %>
B.<? ?>
C.<?= ?>
D.<! !>
E.<?php ?>
3、Which of the following is not valid PHP code?
A.$_10
B.${“MyVar”}
C.&$something
D.$10_somethings
E.$aVaR
4、What is displayed when the following script is executed?
A.The value is: Dog
B.The value is: Cat
C.The value is: Human
D.The value is: 10
E.Dog
5、What is the difference between print() and echo()?
A.print() can be used as part of an expression, while echo() can’t
B.echo() can be used as part of an expression, while print() can’t
C.echo() can be used in the CLI version of PHP, while print() can’t
D.print() can be used in the CLI version of PHP, while echo() can’t
E.There’s no difference: both functions print out some text!
6、What is the output of the following script?
A. 128
B. 42
C. 242.0
D. 256
E. 342
7、Which values should be assigned to the variables $a, $b and $c in order for the following script to display the string Hello, World!?
A. False, True, False
B. True, True, False
C. False, True, True
D. False, False, True
E. True, True, True
8、What will the following script output?
A. A string of 50 random characters
B. A string of 49 copies of the same character, because the random number generator has not been
initialized
C. A string of 49 random characters
D. Nothing, because $array is not an array
E. A string of 49 ‘G’ characters
9、Which language construct can best represent the following series of if conditionals?
A. A switch statement without a default case
B. A recursive function call
C. A while statement
D. It is the only representation of this logic
E. A switch statement using a default case
strcmp was not declared in10、What is the best way to iterate through the $myarray array, assuming you want to modify the value of each element as you do?
A. Using a for loop
B. Using a foreach loop
C. Using a while loop
D. Using a do…while loop
E. There is no way to accomplish this goal
11、Consider the following segment of code:
What should go in the marked segment to produce the following array output?
A. foreach($result as $key => $val)
B. while($idx *= 2)
C. for($idx = 1; $idx < STOP_AT; $idx *= 2)
D. for($idx *= 2; STOP_AT >= $idx; $idx = 0)
E. while($idx < STOP_AT) do $idx *= 2
12、Choose the appropriate function declaration for the user-defined function is_leap(). Assume
that, if not otherwise defined, the is_leap function uses the year 2000 as a default value:
A. function is_leap($year = 2000)
B. is_leap($year default 2000)
C. function is_leap($year default 2000)
D. function is_leap($year)
E. function is_leap(2000 = $year)
13、What is the value displayed when the following is executed? Assume that the code was
executed using the following URL:
testscript.php?c=25
A. 25
B. -5
C. 10
D. 5
E. 0
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论