Sunday, January 7, 2018

PHP Sample Test Paper

PHP Online Test Quiz. PHP Test Papaer MCQ.

PHP Sample Test Quiz

1. What do PHP stand for?

Personal Hypertext Preprocessor
Pretext Hypertext Processor
Hypertext Processor
None

2. A PHP code should put butween?

<php> and </php>
<?php and ?>
<? and ?>
<?php and php?>

3. Which version of PHP introduced Try/catch Exception?

PHP 5
PHP 6
PHP 7
PHP 4

4. What extension is used for PHP code file?

.html
.ht
.php
.ph

5. Which of the statement will store value 111 in a PHP variable name num?

int $num = 111;
int num = 111;
integer num = 111;
$num = 111;

6. How to create a function in PHP?

function test()
function=test()
function:test()
function::test()

7. How to call a function named "test" in PHP?

function test()
call test()
test()
call function test()

8. How to comment/comment code in PHP?

//my comment
'my comment
<--my comment-->
/my comment/

9. How to declare a variable in PHP?

$myvar;
var $myvar;
var myvar;
variable $myvar;

10. Which attribute is used to use a global variable in PHP?

scope
glob
global
None

11. Which one is used to new line in PHP?

\n
/n
\r
/r

12. A function in PHP which starts with double underscore is known as?

Inbuilt funcion
Magic function
User defined function
Default function

13. Which version of PHP introduced Type hinting?

PHP 4
PHP 5
PHP 6
PHP 7

14. Which is the valid function name in PHP?

$function()
.function()
#()
function()

15. Which of the following is not a valid PHP variable name?

_varname
2varname
varname
None

16. Which language is used to server side validation of a web page?

PHP
HTML
CSS
XML

17. How to write for loop in PHP?

for($i=0; $i<=10; ++$i)
for i=10 then iterate
for each (i<=10)
for(i=0; i<=10; ++i)

18. Which of the following is correct way to write "Hello World" on the screen?

echo("Hello World");
print("Hello World");
out.print("Hello World");
document.write("Hello World");

19. Which will print $x on the screen?

echo "$x";
echo "\$x";
echo "$$x";
echo "/$x";

20. Which statement is equivalent to $x += $x ?

$x = $x;
$x = $x + $x + 1;
$x = $x + $x;
$x = $x + 1;



No comments:

Post a Comment