網眼 2009-03-19 22:09:46 回複 置頂 修改 刪除
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.128B.42C.242.0D.256E.342 7. Which values should be assigned to the variables $a, $b and $c in order for the followingscript 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, FalseB.True, True, FalseC.False, True, TrueD.False, False, TrueE.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;?>16PHP Programming BasicsA.A string of 50 random charactersB.A string of 49 copies of the same character, because the random number generator has not been initializedC.A string of 49 random charactersD.Nothing, because $array is not an arrayE.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 caseB.A recursive function callC.A while statementD.It is the only representation of this logicE.A switch statement using a default case 10. What is the best way to iterate through the $myarray array, assuming you want to modify thevalue of each element as you do?$myarray = array ("My String","Another String","Hi, Mom!");?>A.Using a for loopB.Using a foreach loopC.Using a while loopD.Using a do…while loopE.There is no way to accomplish this goal