PHP 基础测试题(6~10)
来源:互联网 发布:猎聘网怎么样 知乎 编辑:程序博客网 时间:2024/06/06 07:33
网眼 2009-03-19 22:09:46 回复 置顶 修改 删除
6. What is the output of the following script?
6. What is the output of the following script?
$a = 10;
$b = 20;
$c = 4;
$d = 8;
$e = 1.0;
$f = $c + $d * 2;
$g = $f % 20;
$h = $b - $a + $c + 2;
$i = $h << $c;
$j = $i * $e;
print $j;
?>
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!?
$string = "Hello, World!";
$a = ?;
$b = ?;
$c = ?;
if($a) {
if($b && !$c) {
echo "Goodbye Cruel World!";
} else if(!$b && !$c) {
echo "Nothing here";
}
} else {
if(!$b){
if(!$a && (!$b && $c)) {
echo "Hello, World!";
} else {
echo "Goodbye World!";
}
} else {
echo "Not quite.";
}
}
?>
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?
$array = '0123456789ABCDEFG';
$s = '';
for ($i = 1; $i < 50; $i++) {
$s .= $array[rand(0,strlen ($array) - 1)];
}
echo $s;
?>
16
PHP Programming Basics
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?
if($a == 'a') {
somefunction();
} else if ($a == 'b') {
anotherfunction();
} else if ($a == 'c') {
dosomething();
} else {
donothing();
}
?>
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
10. What is the best way to iterate through the $myarray array, assuming you want to modify the
value of each element as you do?
$myarray = array ("My String",
"Another String",
"Hi, Mom!");
?>
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
- PHP 基础测试题(6~10)
- PHP 基础测试题(1~5)
- PHP 基础测试!
- PHP面向对象-测试题(6~10)
- PHP基础,从编写到测试
- 黑马程序员-JAVA基础测试题(6-10)
- 【原创】PHP测试题
- PHP入门测试题
- php入门测试题
- php测试题
- PHP测试题
- php测试题
- php测试题
- Php基础知识测试题
- PHP测试题
- PHP测试题
- 黑马基础测试6
- 黑马基础测试10
- 新的起点
- 子网计算窍门
- 关于.NET点击图片就可刷性验证码的问题解决方法
- RequiredFieldValidator控件中Text属性和ErrorMessage属性用法
- 配置JAVA系统的环境变量
- PHP 基础测试题(6~10)
- SQL*PLUS命令的使用大全(一)
- SQL*PLUS命令的使用大全(二)
- 这些案例!触目惊心!!! 女生万万小心!!!不是闹着玩
- the first time here
- 学习路上
- AspNetPager的属性设置
- FreeTextBox的属性设置
- 做一个快乐的人