UndilutedNG.com

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

What will be the output of the following PHP code?

   

   $a = "clue";

   $a .= "get";

   echo "$a";

   ?>

2 / 15

What will be the output of the following PHP code?

   

   $color = "maroon";

   $var = $color[2];

   echo "$var";

   ?>

3 / 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”);

4 / 15

Which of the looping statements is/are supported by PHP?

i) for loop

ii) while loop

iii) do-while loop

iv) foreach loop

5 / 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]);

   }

   ?>

6 / 15

What will be the output of the following PHP code?

   

   $score = 1234;

   $scoreboard = (array) $score;

   echo $scoreboard[0];

   ?>

7 / 15

What will be the output of the following PHP code ?

$i = 2;

while (++$i)

{  

   while ($i --> 0)

       print $i;

}

?>

8 / 15

What will be the output of the following code?

   

   $foo = 'Bob';              

   $bar = &$foo;              

   $bar = "My name is $bar";  

   echo $bar;

   echo $foo;

   ?>

9 / 15

What will be the output of the following PHP code?

   

   function calc($price, $tax="")

   {

       $total = $price + ($price * $tax);

       echo "$total";

   }

   calc(42);

   ?>

10 / 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 );

   ?>

11 / 15

What will be the output of the following PHP code ?

$i = 0;

while ((--$i > ++$i) - 1)

{  

   print $i;

}

?>

12 / 15

How to define a function in PHP?

13 / 15

Which is the right way of declaring a variable in PHP?

i) $3hello

ii) $_hello

iii) $this

iv) $This

14 / 15

Type Hinting was introduced in which version of PHP?

15 / 15

What will be the output of the following PHP code?

advertisement

   

   $total = "25 students";

   $more = 10;

   $total = $total + $more;

   echo "$total";

   ?>

Your score is

UndilutedNG.com

To Top
%d