
IT Interview Exam Paper: PHP 17
Subject: PHP 17
Part 17: List for questions and answers of PHP
Q1. What will be the output of the following PHP code ?
<?php
“Hello World”
?>?>
a) Error
b) Hello World
c) Nothing
d) Missing semicolon error
Q2. What will be the output of the following PHP code ?
<?php
print_r “Hello world”
?>?>
a) Error
b) Hello World
c) Nothing
d) Missing semicolon error
Q3. What will be the output of the following PHP code ?
<?php
echo ‘Hello World’;
<html>
Hello world
</html>
?>?>
a) Hello world
b) Hello World Hello World
c) Hello world</option>
d) Syntax Error
Q4. What will be the output of the following PHP code ?
<?php
Echo “Hello World1”;
echo ” Hello world2″;
ECHO ” Hello world3″;
?>?>
a) Hello world1 Hello world2 Hello World3</option>
b) Hello world1 Hello world2 Hello World3</option>
c) Error</option>
d) Hello world1 Hello world3</option>
Q5. What will be the output of the following PHP code ?
<?php
$color = “red”;
echo “$color”;
echo “$COLOR”;
echo “$Color”;
?>?>
a) redredred
b) redred
c) red
d) Error
Q6. What will be the output of the following PHP code ?
<?php
$color1 = “red”;
$color2 = “red”;
echo “$color1” + “$color2”;
?>
a) redgreen
b) red green
c) 0
d) 1
Q7. What will be the output of the following PHP code ?
<?php
# echo “Hello world”;
echo “# Hello world”;
?>?>
a) # Hello world
b) Hello world# Hello world
c) Hello world
d) Error
Q8. What will be the output of the following PHP code ?
<?php
echo “<i>Hello World</i>”
?>?>
a) Hello world
b) Hello world in italics
c) Nothing
d) Error
Q9. What will be the output of the following PHP code ?
<?php
echo “echo “Hello World””;
?>?>
a) Hello world
b) echo “Hello world”
c) echo Hello world
d) Error
Q10. What will be the output of the following PHP code ?
<?php
$color = red;
echo “\$color”;
?>
a) red
b) $color
c) \red
d) Error
Q11. What will be the output of the following PHP code ?
<?php
/*
echo “Hello world”;
*/
?>
a) Hello world
b) Nothing
c) error
d) /* Hello world */
Q12. What will be the output of the following PHP code ?
<?php
$color = red;
echo “$color” . red ;
?>
a) red red
b) red
c) Error
d) Nothing
Q13. What will be the output of the following PHP code ?
<?php
$color1 = red;
$color2 = green;
echo “$color1”.”$color2″;
?>
a) red green
b) red
c) green
d) Error
Q14. What will be the output of the following PHP code ?
<?php
$color = “red”;
$color = “green”;
echo “$color”;
?>
a) red
b) green
c) red green
d) error
Q15. What will be the output of the following PHP code
<?php
$color1 = “red”;
$color2 = “green”;
echo “$color1” . “$color2”;
?>?
a) red
b) green
c) red green
d) redgreen
Q16. What will be the output of the following PHP code
<?php
$color1 = “red”;
$color2 = “green”;
echo “$color1” + “$color2”;
?>?
a) redgreen
b) red green
c) 0
d) error
Q17. What will be the output of the following PHP code ?
<?php
$color1 = “red”;
$color2 = “1”;
echo “$color1” + “$color2”;
?>
a) red1
b) red 1
c) 0
d) 1
Q18. What will be the output of the following PHP code ?
<?php
$color1 = “1”;
$color2 = “1”;
echo “$color1” + “$color2”;
?>
a) 11
b) 2
c) 0
d) 1
Q19. <?php echo $_SERVER[‘REMOTE_ADDR’]; ?>
a) shows the IP address of the local system
b) shows the IP address of the visitor
c) shows the IP address of the webserver
d) None of the above
Q20. What will be the output of the following PHP code ?
<?php
$color1 = “red”;
$color2 = “1”;
$color3 = “grey”
echo “$color1” + “$color2” . “$color3”;
?>
a) 1grey
b) grey
c) 0
d) red1grey
Part 17: List for questions and answers of PHP
Q1. Answer: c
Q2. Answer: a
Q3. Answer: d
Q4. Answer: a
Q5. Answer: c
Q6. Answer: c
Q7. Answer: a
Q8. Answer: b
Q9. Answer: d
Q10. Answer: b
Q11. Answer: b
Q12. Answer: c
Q13. Answer: d
Q14. Answer: b
Q15. Answer: d
Q16. Answer: c
Q17. Answer: d
Q18. Answer: b
Q19. Answer: a
Q20. Answer: a