wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

PHP QUIZ

Total questions: 20

Worksheet time: 11mins

Name
Class
Date
1.

What does PHP stand for?

a)

Personal Home Page

b)

Hyper Text Preprocessor

c)

Pretext Hyper Text Preprocessor

d)

Preprocessor Home Page

2.

PHP is a___________ scripting language.

a)

Serverside

b)

Clientside

c)

Middleside

d)

None of the Above

3.

We can use __________ to comment a single line in PHP

a)

/

b)

//

c)

#

d)

/* */

4.

In an associative array index or key will be represented by

a)

String

b)

Value

c)

Boolean

d)

None

5.

To destroy the session we use

a)

session_unset()

b)

session_ start()

c)

session_destroy()

d)

None

6.

Which of the following is a ternary operator?

a)

&

b)

=

c)

+=

d)

?:

7.

var_dump gives _________ of given variable or expression

a)

data type

b)

value

c)

result

d)

None

8.

PHP script is executed on

a)

ISP Computer

b)

Server Computer

c)

Client Computer

d)

None of these

9.

Which of the following variables is not a predefined variables?

a)

$_get

b)

$_post

c)

$_ask

d)

$_request

10.

Which of the following printing construct/function accepts multiple parameters?

a)

echo

b)

print

c)

printf

d)

None of the above

11.

What will be the output of the following code?
$a=10
Echo 'value of a=$a'

a)

Value of a=10

b)

Value of a=$a

c)

Undefined

d)

Syntax Error

12.

Which function add the new element at the end of an array?

a)

push()

b)

pop()

c)

stack()

d)

none

13.

Which of the following is used for printing in PHP?

a)

echo()

b)

print()

c)

Both A & B

d)

display()

14.

If we need variable values to remain save even outside function then we have to use

a)

Static keyword

b)

local keyword

c)

global keyword

d)

None of these

15.

Who is the father of PHP?

a)

Rasmus Ledorf

b)

William Makepiece

c)

Drek Kolkevi

d)

List Barely

16.

Which of the following PHP statements will store 111 in variable num?

a)

int $ num=111

b)

int num=111

c)

$num=111

d)

111=$num

17.

Which of the following method sends input to a script via URL?

a)

GET

b)

POST

c)

BOTH

d)

None

18.

What is the output of the program?

<?PHP

$num="1"

$num2="2"

print $num+$num2

?>

a)

3

b)

1+2

c)

Error

d)

12

19.

Which of the following are valid PHP data types?

a)

resource

b)

null

c)

Boolean

d)

All of the above

20.

Write the output of the following?

<?PHP

function display()

{

static $a=10;

$a++;

return $a;

}

echo display();

echodisplay();

?>

a)

10
11

b)

11
12

c)

12
12

d)

11
11