159. What will be the output of the following PHP code ?
<?php
$x = 4;
$y = -3;
$z = 11;
echo 4 + $y * $z / $x;
?>
a) 4.25
b) 3.25
c) -3.25
d) -4.25
Answer: d
160. What will be the output of the following PHP code ?
<?php
$x = 3.5;
$y = 2;
$z = 2;
echo $x / $y / $z;
?>
a) 1.75
b) 0.875
c) 3.5
d) Error
Answer: b
161. What will be the output of the following PHP code ?
<?php
one = 1;
two = 2;
three = 3;
four = 4;
echo "one / two + three / four";
?>
a) 0.75
b) 0.05
c) 1.25
d) Error
Answer: d
162. What will be the output of the following PHP code ?
<?php
$on$e = 1;
$tw$o = 2;
$thre$e = 3;
$fou$r = 4;
echo "$on$e / $tw$o + $thre$e / $fou$r";
?>
a) 0.75
b) 0.05
c) 1.25
d) Error
Answer: d
163. What will be the output of the following PHP code ?
<?php
$on_e = 1;
$tw_o = 2;
$thre_e = 3;
$fou_r = 4;
echo $on_e / $tw_o + $thre_e / $fou_r;
?>
a) 0.75
b) 0.05
c) 1.25
d) Error
Answer: c
164. What will be the output of the following PHP code ?
<?php
$On_e = 1;
$tw_o = 2;
$thre_e = 3;
$fou_r = 4;
echo $on_e / $tw_o + $thre_e / $fou_r;
?>
a) 0.75
b) 0.05
c) 1.25
d) Error
Answer: a
165. What will be the output of the following PHP code ?
<?php
echo $red;
?>
a) 0
b) Nothing
c) True
d) Error
Answer: b
166. What will be the output of the following PHP code ?
<?php
$four4 = 4;
$three3 = 3;
$two2 = 2;
echo $four4 + $three3 / $two2 - 1;
?>
a) 4.5
b) 7
c) 3.5
d) Error
Answer: a
167. What will be the output of the following PHP code ?
<?php
$4four = 4;
$3three = 3;
$2two = 2;
echo $4four + $3three / $2two - 1;
?>
a) 4.5
b) 7
c) 3.5
d) Error
Answer: d
168. What will be the output of the following PHP code ?
<?php
int $one = 1;
echo "$one";
?>
a) 0
b) 1
c) $one
d) Error
Answer: d
169. What will be the output of the following PHP code ?
<?php
var $one = 1;
var $two = 2;
echo $one / $two * $one / $two * $two;
?>
a) 1
b) 0
c) 0.5
d) Error
Answer: d
170. What will be the output of the following PHP code ?
<?php
$hello = "Hello World";
$bye = "Bye";
echo $hello;"$bye";
?>
a) Hello World
b) Bye
c) Hello worldBye
d) Error
Answer: a
171. What will be the output of the following PHP code ?
<?php
$x;
echo "$x";
?>
a) 0
b) 1
c) Nothing
d) Error
Answer: c
172. What will be the output of the following PHP code ?
<?php
$x = 5;
{
$x = 10;
echo "$x";
}
echo "$x";
?>
a) 1010
b) 105
c) 510
d) error
Answer: a
173. What will be the output of the following PHP code ?
<?php
$x = 5;
{
echo "$x";
}
?>
a) 0
b) 5
c) Nothing
d) Error
Answer: b
174. What will be the output of the following PHP code ?
<?php
$x = 5;
function fun()
{
echo "$x";
}
fun();
?>
a) 0
b) 5
c) Nothing
d) Error
Answer: c
175. What will be the output of the following PHP code ?
<?php
$x = 5;
function fun()
{
$x = 10;
echo "$x";
}
fun();
echo "$x";
?>
a) 0
b) 105
c) 510
d) Error
Answer: b
176. What will be the output of the following PHP code ?
<?php
$x = 4;
$y = 3;
function fun($x = 3, $y = 4)
{
$z = $x+$y/$y+$x;
echo "$z";
}
echo $x;
echo $y;
echo $z;
fun($x, $y);
?>
a) 43
b) 943
c) 349
d) 439
Answer: d
177. What will be the output of the following PHP code ?
<?php
$x = 4;
$y = 3;
function fun($x, $y)
{
$z = $x + $y / $y + $x;
echo "$z";
}
echo $x;
echo $y;
echo $z;
fun(3, 4);
?>
a) 437
b) 439
c) 349
d) 347
Answer: a
178. What will be the output of the following PHP code ?
<?php
function fun($x,$y)
{
$x = 4;
$y = 3;
$z = $x + $y / $y + $x;
echo "$z";
}
fun(3, 4);
?>
a) 7
b) 9
c) 0
d) Error
Answer: b
179. What will be the output of the following PHP code ?
1. <?php
2. $x = 3, 4, 5, 6;
3. echo "$x";
4. ?>
a) 3
b) 4
c) 6
d) Error
Answer: d
180. What will be the output of the following PHP code ?
<?php
$a = 10;
$b = 4;
$c = fun(10,4);
function fun($a,$b)
{
$b = 3;
return $a - $b + $b - $a;
}
echo $a;
echo $b;
echo $c;
?>
a) 104
b) 410
c) 1400
d) 4100
Answer: c
181. What will be the output of the following PHP code ?
<?php
$a = "$winner";
$b = "/$looser";
echo $a,$b;
?>
a) $winner/$looser
b) /$looser
c) /
d) $looser
Answer: c
182. What will be the output of the following PHP code ?
<?php
$a = "$winner";
$b = "\$looser";
echo $a, $b;
?>
a) $winner\$looser
b) \$looser
c) \
d) $looser
Answer: d
183. What will be the output of the following PHP code ?
<?php
$a = "$winner";
$b = "\\$looser";
echo $a, $b;
?>
a) $winner\\$looser
b) \\$looser
c) \
d) $looser
Answer: c
184. What will be the output of the following PHP code ?
<?php
$x = 5;
$y = 10;
function fun()
{
$GLOBALS['y'] = $GLOBALS['x'] + $GLOBALS['y'];
}
fun();
echo $y;
?>
a) 5
b) 10
c) 15
Answer: c
185. What will be the output of the following PHP code ?
<?php
$x = 5;
$y = 10;
function fun()
{
$y = $GLOBALS['x'] + $GLOBALS['y'];
}
fun();
echo $y;
?>
a) 5
b) 10
c) 15
d) Error
Answer: b
186. What will be the output of the following PHP code ?
<?php
function fun()
{
$x = 0;
echo $x;
$x++;
}
fun();
fun();
fun();
?>
a) 012
b) 123
c) 000
d) 111
Answer: c
187. What will be the output of the following PHP code ?
<?php
function fun()
{
static $x = 0;
echo $x;
$x++;
}
fun();
fun();
fun();
?>
a) 012
b) 123
c) 111
d) Error
Answer: a
188. What will be the output of the following PHP code ?
<?php
static $x = 0;
function fun()
{
echo $x;
$x++;
}
fun();
fun();
fun();
?>
a) 012
b) 123
c) Nothing
d) Error
Answer: c
189. What will be the output of the following PHP code ?
<?php
$x=0;
function fun()
{
echo $GLOBALS['x'];
$GLOBALS['x']++;
}
fun();
fun();
fun();
?>
a) 000
b) 012
c) 123
d) Error
Answer: b
.
190. What will be the output of the following PHP code ?
<?php
$x = 0;
function fun()
{
echo $GLOBALS['x'];
$x++;
}
fun();
fun();
fun();
?>
a) 000
b) 012
c) Nothing
d) Error
Answer: a