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 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 2 / 15 What will be the output of the following code? function track() { static $count = 0; $count++; echo $count; } track(); track(); track(); ?> 123 111 000 011 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 If $a = 12 what will be returned when ($a == 12) ? 5 : 1 is executed? 12 1 Error 5 5 / 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 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 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 8 / 15 What will be the output of the following PHP code ? $i = ""; while ($i) { print "hi"; } while($i < 8) $i++; print "hello"; ?> Hi is printed 8 times, hello 7 times and then hi 2 times Hi is printed 10 times, hello 7 times Hi is printed once, hello 7 times Hi is printed once, hello 7 times and then hi 2 times 9 / 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 10 / 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 11 / 15 What will be the output of the following PHP code? $team = "arsenal"; switch ($team) { case "manu": echo "I love man u"; case "arsenal": echo "I love arsenal"; case "manc": echo "I love manc"; } ?> I love arsenal Error I love arsenalI love manc I love arsenalI love mancI love manu 12 / 15 What will be the output of the following PHP code? $score = 1234; $scoreboard = (array) $score; echo $scoreboard[0]; ?> 1 Error 1234 2 13 / 15 What will be the output of the following PHP code? $a = "clue"; $a .= "get"; echo "$a"; ?> get true false clueget 14 / 15 Which of the looping statements is/are supported by PHP? i) for loop ii) while loop iii) do-while loop iv) foreach loop i and ii i, ii and iii i, ii, iii and iv Only iv 15 / 15 What will be the output of the following code? $foo = 'Bob'; $bar = &$foo; $bar = "My name is $bar"; echo $bar; echo $foo; ?> Error My name is BobBob My name is BobMy name is Bob My name is Bob Bob Your score is LinkedIn Facebook Twitter VKontakte Restart quiz Send feedback Like this:Like Loading...