wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

PHP Quiz

Total questions: 35

Worksheet time: 6mins

Name
Class
Date
1.

Which of the following is correct about PHP?

a)

PHP is a recursive acronym for "PHP: Hypertext Preprocessor".

b)

PHP is a server side scripting language that is embedded in HTML.

c)

It is used to manage dynamic content, databases, session tracking, even build entire e-commerce sites.

d)

All of the above.

2.

Which of the following is correct about PHP?

a)

PHP performs system functions, i.e. from files on a system it can create, open, read, write, and close them.

b)

PHP can handle forms, i.e. gather data from files, save data to a file, thru email you can send data, return data to the user.

c)

You add, delete, modify elements within your database thru PHP.

d)

All of the above.

3.

Is PHP whitespace sensitive?

a)

true

b)

false

4.

What is the output of this code?

a)

The number is incorrect.

b)

False

c)

True

d)

The number is 1

5.

Which of the following is true about php variables?

a)

All variables in PHP are denoted with a leading dollar sign ($).

b)

The value of a variable is the value of its most recent assignment.

c)

Variables are assigned with the = operator, with the variable on the left-hand side and the expression to be evaluated on the right.

d)

All of the above.

6.

Which of the following type of variables are whole numbers, without a decimal point, like 4195?

a)

Integers

b)

Double

c)

Boolean

d)

Strings

7.

Which of the following type of variables are floating-point numbers, like 3.14159 or 49.1?

a)

Integers

b)

Double

c)

Boolean

d)

Strings

8.

Which of the following type of variables have only two possible values either true or false?

a)

Integers

b)

Double

c)

Boolean

d)

Strings

9.

What is the output of this code?

a)

Yay! It`s Friday!

b)

error

c)

blank

d)

Yay! It`s friday!

10.

Which of the following type of variables are special type that only has one value: NULL?

a)

Strings

b)

Double

c)

Boolean

d)

NULL

11.

Which of the following is not an arithmetic operator?

a)

Addition(+)

b)

Subtraction(-)

c)

Multiplication(*)

d)

Assign(=)

12.

Using which of the following way can you embed PHP code in an HTML page?

a)

<?php PHP code goes here ?>

b)

<? PHP code goes here ?>

c)

<script language="php"> PHP code goes here </script>

d)

All of the above.

13.

What will be the output of this line of codes?

a)

Yay! It`s Friday

b)

'Yay! It`s Friday'

c)

error

d)

blank

14.

Is PHP case sensitive?

a)

true

b)

false

15.

What will be the result of this line of code?

a)

Your value for case 1 is 2

b)

Your value for case 1 is 4

c)

Your value for case 2 is 2

d)

Your value for case 2 is 4

16.

$var and $VAR are two different variables?

a)

Yes

b)

No

17.

Which of the following is not correct rules for naming of the PHP variables?

a)

$var

b)

$Var

c)

$4ab

d)

$_abc

18.

PHP variables need to be declared before adding a value to it.

a)

True

b)

False

19.

Which of the following is correct about variable naming rules?

a)

Variable names must begin with a letter or underscore character.

b)

A variable name can consist of numbers, letters, underscores.

c)

You cannot use characters like + , - , % , ( , ) . & , etc in a variable name.

d)

All of the above.

20.

Which of the following is not a comparison operators?

a)

>

b)

<

c)

>=

d)

+=

21.

Which of the following is not a logical operators?

a)

AND

b)

OR

c)

NOT

d)

++

22.

What is the output of this code?

a)

1

b)

0

c)

null

d)

error

23.

Which of the following is correct operator for combining two strings?

a)

Dot(.)

b)

Addition(+)

c)

Multiplication(*)

24.

Which operator is used to find the modulus in PHP?

a)

/

b)

%

c)

/

d)

*

25.

The output of this code would be?

a)

The number is 1

b)

The number is incorrect.

c)

error

d)

blank

26.

What is correct output of echo 17%5

a)

3

b)

2

c)

1

d)

0

27.

The output would be?

a)

The number is 1

b)

Incorrect data type.

c)

The number is incorrect.

d)

error

28.

What is correct output of echo (10>5)

a)

1

b)

0

29.

What is correct output of echo 2**3

a)

2

b)

3

c)

6

d)

8

30.

FILL IN THE BLANKS

a)

$message

b)

message

c)

text

d)

return

31.

What is the name of %= operator?

a)

Divide and assign quotient

b)

Divide and assign modulus

c)

Subtraction and assign

32.

Which of the following is not an assignment operators?

a)

=

b)

+=

c)

%=

d)

%

33.

What is the missing operator on this code?

a)

*

b)

!=

c)

%

d)

&&

34.

Which is not a floating point type?

a)

1.234

b)

1920202.4443

c)

12.0

d)

13

35.

What is the displayed output on this code?

a)

21

b)

343

c)

6561

d)

49