If $a = 12 what will be returned when ($a == 12) ? 5 : 1 is executed?
1.12
2.1
3.Error
4.5
What will be the output of the following PHP code? <?php $num = 1; $num1 = 2; print $num . "+". $num1; ?>
1.3
2.1+2
3. 1.+.2
4.Error
What will be the output of the following PHP code? <?php function track() { static $count = 0; $count++; echo $count; } track(); track(); track(); ?>
1.123
2.111
3.000
4.011
Which is the right way of declaring a variable in PHP? i) $3hello ii) $_hello iii) $this iv) $This
1.Only ii)
2.Only iii)
3.ii), iii) and iv)
4. ii) and iv)
Which of the below statements is equivalent to $add += $add?
1.$add = $add
2.$add = $add +$add
3. $add = $add + 1
4. $add = $add + $add + 1
Which of the below symbols is a newline character?
1.
2.
3. /n
4. /r
Which of the following is/are a PHP code editor?
1.Notepad
2.Notepad++
3.Adobe Dreamweaver
4.PDT
Who is the father of PHP?
1.Rasmus Lerdorf
2.Willam Makepiece
3.Drek Kolkevi
4.List Barely
How should we add a single line comment in our PHP code? i) /? ii) // iii) # iv) /* */
1.Only ii)
2.i), iii) and iv)
3.ii), iii) and iv)
4. Both ii) and iv)
PHP files have a default file extension of_______
1..html
2..xml
3..php
4. .ph
What does PHP stand for? i) Personal Home Page ii) Hypertext Preprocessor iii) Pretext Hypertext Processor iv) Preprocessor Home Page
1.Both i) and iii)
2.Both ii) and iv)
3.Only ii)
4.Both i) and ii)
What should be the correct syntax to write a PHP code?
1.< php >
2.< ? php ?>
3.<? ?>
4. <?php ?>
What will be the output of the following PHP code? <?php $a = "clue"; $a .= "get"; echo "$a"; ?>
1.get
2.true
3.false
4.clueget
What will be the output of the following PHP code? <?php $a = 5; $b = 5; echo ($a === $b); ?>
1.5 === 5
2.Error
3.1
4.False
What will be the output of the following PHP code? <?php $color = "maroon"; $var = $color[2]; echo "$var"; ?>
1.a
2.Error
3.$var
4.R
What will be the output of the following PHP code? <?php $score = 1234; $scoreboard = (array) $score; echo $scoreboard[0]; ?>
1.1
2.Error
3.1234
4.2
What will be the output of the following PHP code? <?php $team = "arsenal"; switch ($team) { case "manu": echo "I love man u"; case "arsenal": echo "I love arsenal"; case "manc": echo "I love manc"; } ?>
1. I love arsenal
2.Error
3.I love arsenalI love manc
4. I love arsenalI love mancI love manu
What will be the output of the following PHP code? <?php $total = "25 students"; $more = 10; $total = $total + $more; echo "$total"; ?>
1.Error
2.35 students
3.35
4.25 students
What will be the output of the following PHP code? <?php $user = array("Ashley", "Bale", "Shrek", "Blank"); for ($x=0; $x < count($user); $x++) { if ($user[$x] == "Shrek") continue; printf ($user[$x]); } ?>
1.AshleyBale
2.AshleyBaleBlank
3.ShrekBlank
4.Shrek
What will be the output of the following PHP code? <?php $foo = 'Bob'; $bar = &$foo; $bar = "My name is $bar"; echo $bar; echo $foo; ?>
1. Error
2.My name is BobBob
3.My name is BobMy name is Bob
4.My name is Bob Bob
What will be the value of $a and $b after the function call in the following PHP code? <?php function doSomething( &$arg ) { $return = $arg; $arg += 1; return $return; } $a = 3; $b = doSomething( $a ); ?>
1.a is 3 and b is 4
2. a is 4 and b is 3
3.Both are 3
4.Both are 4
Which of the conditional statements is/are supported by PHP? i) if statements ii) if-else statements iii) if-elseif statements iv) switch statements
1.Only i)
2. i), ii) and iv)
3. ii), iii) and iv)
4.i), ii), iii) and iv)
Which of the following must be installed on your computer so as to run PHP script? i) Adobe Dreamweaver ii) XAMPP iii) Apache and PHP iv) IIS
1.i), ii), iii) and iv)
2.Only ii)
3. ii) and iii)
4.ii), iii) and iv)
Which of the following PHP statement/statements will store 111 in variable num? i) int $num = 111; ii) int mum = 111; iii) $num = 111; iv) 111 = $num;
1.Both i) and ii)
2.i), ii), iii) and iv)
3.Only iii)
4.Only i)
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");
1.i) and ii)
2. i), ii) and iii)
3.i), ii), iii) and iv)
4.i), ii) and iv)
Which statement will output $x on the screen?
1. echo “$xâ€;
2. echo “$$xâ€;
3.echo “/$xâ€;
4.echo “$x;â€;
Which statement will output $x on the screen?
1. echo “$xâ€;
2. echo “$$xâ€;
3.echo “/$xâ€;
4.echo “$x;â€;
Which version of PHP introduced Try/catch Exception?
1.PHP 4
2.PHP 5
3.PHP 6
4. PHP 5 and later