<?php $color1 = red;
$color2 = 1;
$color3 = greyecho $color1 + $color2 . $color3;
?>
1grey
grey
0
red1grey
A. 1grey
Complete text representation of month
Day of month, with leading zero
Daylight saving time
Day of month, without zeros
<?php $i = ;
while ($i = 10){ print hi;
}print hello;
?>
hello
infinite loop
hihello
error
3
4
5
6
Which of the following must be installed on your computer so as to run PHP script?
i) Adobe Dreamweaver
ii) PHP
iii) Apache
iv) IIS
All of the mentioned.
Only ii)
ii) and iii)
ii), iii) and iv)
<?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 $color1 = 1;
$color2 = 1;
echo $color1 + $color2;
?>
11
2
0
1
<?php $i = 2;
while (++$i){ while (--$i > 0) print $i;
} ?>
210
10
no output
infinite loop
What does PHP stand for?
i) Personal Home Page
ii) Hypertext Preprocessor
iii) Pretext Hypertext Processor
iv) Preprocessor Home Page
Both i) and iii)
Both ii) and iv)
Only ii)
Both i) and ii)
<?php $color = red;
echo $color . red ;
?>
red red
red
error
nothing
<?php $i = 0;
while ((--$i > ++$i) - 1){ print $i;
} ?>
00000000000000000000….infinitely
-1-1-1-1-1-1-1-1-1-1…infinitely
no output
error
<?php define(NEW_GOOD_NAME_CONSTANT, I have a value);
define(OLD_BAD_NAME_CONSTANT, NEW_GOOD_NAME_CONSTANT);
�echo NEW_GOOD_NAME_CONSTANT;
echo OLD_BAD_NAME_CONSTANT;
?>
I have a value
I have a valueI have a value
ERROR
I have a valueNEW_GOO_NAME_CONSTANTS
$date = Date(22 JUNE 2013)
$date = new Date(JUNE 22 2013)
$date = DateTime(22 JUNE 2013)
$date = new DateTime(22 JUNE 2013)
<?php $fname = array(Peter, Ben, Joe);
$age = array(35, 37, 43);
$c = array_combine($fname, $age);
print_r($c);
?>
Array ( Peter Ben Joe )
Array ( [Peter] => 35 [Ben] => 37 [Joe] => 43 )
Array ( 35 37 43 )
Array ( [Peter] => 35 [Ben] => 37 [Joe] => 43 )
<?php $color = red;
$color = green;
echo $color;
?>
red
green
red green
error
<?php $a = array(A, Cat, Dog, A, Dog);
print_r(array_count_values($a));
?>
Array ( [A] => 2 [Cat] => 1 [Dog] => 2 )
Array ( [A] => 2 [Cat] => 2 [Dog] => 1 )
Array ( [A] => 1 [Cat] => 1 [Dog] => 2 )
Array ( [A] => 2 [Cat] => 1 [Dog] => 1)
<?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
<?php $color1 = red;
$color2 = red;
echo $color1 + $color2;
?>
redgreen
red green
0
1
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 printf( date(t) ) ?>
30
22
JUNE
2013
lastmod()
getlastmod()
last_mod()
get_last_mod()
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)
<?php $a = array(a=>red, b=>green, c=>blue);
echo array_shift($a);
print_r ($a);
?>
green
red
redArray( [c] => green [c] => blue )
redArray( [b] => green [c] => blue )
A PHP script should start with ___ and end with ___:
< php >
< ? php ?>
<?php ?>
<% %>
<?php $a1 = array(red, green);
$a2 = array(blue, yellow);
print_r(array_merge($a1, $a2));
?>
Array ( [0] => red [1] => green)
Array ( [0] => blue [1] => yellow [2] => red [3] => green )
Array ( [0] => red [1] => green [2] => blue [3] => yellow )
Array ( [0] => blue [1] => yellow )
PHP files have a default file extension of..
.html
.xml
.php
.ph
.asp
.jsp
totime(+45)
totime(+45 days)
strtotime(+45 days)
strtotime(-45 days)
<?php $color1 = red;
$color2 = green;
echo $color1 . $color2;
?>
red
green
red green
redgreen
<?php $i = 0;
while(++$i || --$i){ print $i;
} ?>
1234567891011121314….infinitely
01234567891011121314…infinitely
1
0
<?php $color1 = red;
$color2 = 1;
$color3 = greyecho $color1 + $color2 . $color3;
?>
1grey
grey
0
red1grey