360
180
3600
1800
B. 180
<?php $color1 = red;
$color2 = 1;
echo $color1 + $color2;
?>
red1
red 1
0
1
lastmod()
getlastmod()
last_mod()
get_last_mod()
<?php $i = 5;
while (--$i > 0){ $i++;
print $i;
print hello;
} ?>
4hello4hello4hello4hello4hello…..infinite
5hello5hello5hello5hello5hello…..infinite
no output
error
<?php class myObject { }define('myObject::CONSTANT', 'test');
echo myObject::CONSTANT;
?>
test
error
myObject::CONSTANT
no output
A PHP script should start with ___ and end with ___:
< php >
< ? php ?>
<?php ?>
<% %>
<?php echo Today is .date(F d, Y) ?>
Today is 22 June, 2013
Today is 22-06-2013
Today is 06-22-2013
Today is June 22, 2013
<?php define(__LINE__, PHP is a scripting language);
echo __LINE__;
?>
PHP is a scripting language
__LINE__
2
ERROR
Delete the previous session
Start a new session
Check whether a valid session exists
Handle the session
<?php $i = 0;
while ($i = 10){ print hi;
}print hello;
?>
hello
infinite loop
hihello
error
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 iv)
time()
mktime()
mrtime()
mtime()
PHP files have a default file extension of..
.html
.xml
.php
.ph
.asp
.jsp
<?php $i = 2;
while (++$i){ while ($i --> 0) print $i;
} ?>
210
10
no output
infinite loop
<?php $i = 5;
while (--$i > 0 && ++$i){ print $i;
} ?>
5
555555555…infinitely
54321
error
What will be the output of the following code?
<?php
$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
totime(+45)
totime(+45 days)
strtotime(+45 days)
strtotime(-45 days)
Integer
String
Boolean
Float
Which of following variables can be assigned a value to it?
i) $3hello
ii) $_hello
iii) $this
iv) $This
All of the mentioned
Only ii)
ii), iii) and iv)
ii) and iv)
<?php $a1 = array(a=>red, b=>green, c=>blue, d=>yellow);
$a2 = array(e=>red, f=>green, g=>blue);
$result = array_diff($a1, $a2);
print_r($result);
?>
Array ( [d] => yellow )
Array ( [c] => blue )
Array ( [a] => red )
Array ( [e] => yellow )
Session
Cookie
URL rewriting
Nothing happens
<?php $i = ;
while ($i = 10){ print hi;
}print hello;
?>
hello
infinite loop
hihello
error
1800
3600
1440
1540
<?php printf( date(t) ) ?>
30
22
JUNE
2013
<?php define(VAR_NAME,test);
${VAR_NAME} = value;
echo VAR_NAME;
echo ${VAR_NAME};
?>
test
testtest
testvalue
error, constant value cannot be changed
<?php $color1 = 1;
$color2 = 1;
echo $color1 + $color2;
?>
11
2
0
1
<?php $cars = array(Volvo, BMW, Toyota);
echo I like . $cars[0] . , . $cars[1] . and . $cars[2] . .;
?>
I like Volvo BMW and Toyota.
I like Volvo, BMW and Toyota)
I like Volvo, BMW and Toyota.
I like. Volvo.,. BMW. and. Toyota)
<?php $i = 0;
while(++$i || --$i){ print $i;
} ?>
1234567891011121314….infinitely
01234567891011121314…infinitely
1
0
save_data
session.save
session.save_data
session.save_handler
<?php $color = red;
$color = green;
echo $color;
?>
red
green
red green
error
<?php $a1 = array_fill(3, 4, blue);
$b1 = array_fill(0, 1, red);
print_r($a1);
echo
;
print_r($b1);
?>
Array ( [3] => blue [4] => blue)
Array ( [0] => red )
Array ( [4] => blue [5] => blue [6] => blue)
Array ( [0] => red )
Array ( [3] => blue [4] => blue [5] => blue [6] => blue )
Array ()
Array ( [3] => blue [4] => blue [5] => blue [6] => blue )
Array ( [0] => red )