CSC 202 Pre Test 0% 0 Created by Oladeji Timilehin Daramola CSC 202 NOTE: The quiz is meant for revision purpose only! Join the 200 level group to access other quiz CLICK TO JOIN 1 / 15 Which of the following PHP statements will output Hello World on the screen? i) echo (“Hello World”); ii) print (“Hello World”); iii) printf (“Hello World”); iv) sprintf (“Hello World”); i and ii i, ii and iii All of the mentioned i, ii and iii 2 / 15 Which is the right way of declaring a variable in PHP? i) $3hello ii) $_hello iii) $this iv) $This Only ii Only ii ii, iii and iv ii and iv 3 / 15 Which of the below statements is equivalent to $add += $add ? $add = $add $add = $add +$add $add = $add + 1 $add = $add + $add + 1 4 / 15 What will be the output of the following PHP code? $color = "maroon"; $var = $color[2]; echo "$var"; ?> a Error $var r 5 / 15 Which type of function call is used in line 8? function calc($price, $tax) { $total = $price + $tax; } $pricetag = 15; $taxtag = 3; calc($pricetag, $taxtag); ?> Call By Value Call By Reference Default Argument Value Type Hinting 6 / 15 What will be the output of the following PHP code? $a = 5; $b = 5; echo ($a === $b); ?> 5 === 5 Error 1 False 7 / 15 How to define a function in PHP? function {function body} data type functionName(parameters) {function body} functionName(parameters) {function body} function functionName(parameters) {function body} 8 / 15 Which of the conditional statements is/are supported by PHP? i) if statements ii) if-else statements iii) if-elseif statements iv) switch statements Only i i, ii and iv ii, iii and iv i, ii,iii and iv 9 / 15 What will be the output of the following PHP code ? $i = 2; while (++$i) { while ($i --> 0) print $i; } ?> 210 10 no output infinite loop 10 / 15 What will be the output of the following PHP code? advertisement $total = "25 students"; $more = 10; $total = $total + $more; echo "$total"; ?> Error 35 students 35 25 students 11 / 15 What will be the output of the following PHP code ? $i = 0; while ((--$i > ++$i) - 1) { print $i; } ?> 00000000000000000000….infinitely -1-1-1-1-1-1-1-1-1-1…infinitely no output error 12 / 15 What is the value of $a and $b after the function call? function doSomething( &$arg ) { $return = $arg; $arg += 1; return $return; } $a = 3; $b = doSomething( $a ); ?> a is 3 and b is 4 a is 4 and b is 3 Both are 3 Both are 4 13 / 15 What will be the output of the following PHP code? function calc($price, $tax="") { $total = $price + ($price * $tax); echo "$total"; } calc(42); ?> Error 0 42 84 14 / 15 What will be the output of the following PHP code? $user = array("Ashley", "Bale", "Shrek", "Blank"); for ($x=0; $x < count($user); $x++){ if ($user[$x] == "Shrek") continue; printf ($user[$x]); } ?> AshleyBale AshleyBaleBlank ShrekBlank Shrek 15 / 15 Who is the father of PHP? Rasmus Lerdorf Willam Makepiece Drek Kolkevi List Barely Your score is LinkedIn Facebook Twitter VKontakte Restart quiz Send feedback