PHP Quiz

PHP Quiz



1Q.   What does PHP stand for?
A Preprocessed Hypertext Page
B Hypertext Markup Language
C PHP: Hypertext Preprocessor
D Hypertext Transfer Protocol

 

2Q.    Which of the following is the way to create comments in PHP?
A // commented code to end of line
B /* commented code here */
C # commented code to end of line
D all of the above

 

3Q.   A value that has no defined value is expressed in PHP with the following keyword:
A undef
B null 
C None
D There is no such concept in PHP

 

4Q.   What gets printed?
$var = ‘false’;
 
if ($var) {
echo ‘true’;
} else {
echo ‘false’;
}
A true
B False

 

5Q.   Which of the following is used to declare a constant
A const
B constant
C define
D #pragma
E def

 

6Q.  Which of the following is NOT a magic predefined constant?
A __LINE__
B __FILE__
C __DATE__ 
D __CLASS__
E __METHOD__

 

7Q.  Which of the following is NOT a valid PHP comparison operator?
A !=
B >=
C <=> 
D <>
E ===

 

8Q.   Which extension is not a correct PHP file extension?
A .php
B  .phtml
C  .php3
D  .phpRobert

 

9Q.   Which of the following is the correct way to use the require command?
A require(“example.php”)
B require “example.php”;
C require(“example.php”);
D None of the above

 
 

10Q.   How do you start the shorthand form PHP scripting block?
A <?php … ?>
B <? … ?>
C <? … ?php>
D <?php … php?>