wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Unit 19 - First Quiz

Total questions: 20

Worksheet time: 10mins

Name
Class
Date
1.

PHP is a client-side programming language.

a)

True

b)

False

2.

PHP can be embedded inside HTML code.

a)

True

b)

False

3.

PHP scripts are executed on the server.

a)

True

b)

False

4.

PHP variables must start with the $ symbol.

a)

True

b)

False

5.

Multi-line comments in PHP use /* */.

a)

True

b)

False

6.

Logical operators are used to perform mathematical calculations.

a)

True

b)

False

7.

The while loop executes at least once, even if the condition is false

a)

True

b)

False

8.

The break statement continues to the next iteration of a loop.

a)

True

b)

False

9.

What does the str_replace() function do?

a)

Reverses a string

b)

Replaces part of a string

c)

Splits a string

d)

Finds string length

10.

Which of the following is a numeric array?

a)

$students = ["Ali", "Sara", "John"];

b)

$students = ["name"=>"Ali", "age"=>20];

c)

$students = [["Ali",20],["Sara",22]];

d)

None of the above

11.

Arrow functions are mainly used for:

a)

Multi-line code blocks

b)

Loops

c)

Simple, one-line expressions

d)

Database connections

12.

Which function gives the number of seconds since January 1, 1970?

a)

date()

b)

time()

c)

strtotime()

d)

mktime()

13.

Which numeric function rounds up to the nearest integer?

a)

floor()

b)

ceil()

c)

round()

d)

abs()

14.

In associative arrays, values are stored with:

a)

Keys

b)

Indexes only

c)

Strings only

d)

None

15.

strpos("Hello World", "o") returns:

a)

2

b)

4

c)

5

d)

6

16.

Which is NOT a built-in numeric function in PHP?

a)

pow()

b)

sqrt()

c)

strlen()

d)

abs()

17.

Which type of array can contain other arrays?

a)

Indexed array

b)

Associative array

c)

Multidimensional array

d)

String array

18.

The continue keyword in PHP:

a)

Ends the loop

b)

Skips current iteration

c)

Exits PHP code

d)

Repeats the loop

19.

Which version of PHP was popular in 2025?

a)

7.48.2

b)

8.2

c)

5.6

d)

9.0

20.

Constants in PHP are defined using:

a)

var()

b)

define()

c)

const()

d)

set()