wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

PHP Assessment 1

Total questions: 14

Worksheet time: 33mins

Name
Class
Date
1.

In PHP, variable names are case-sensitive. (T/F)

a)

True

b)

False

2.

The elseif keyword can be written as else if in PHP. (T/F

a)

True

b)

False

3.

The foreach loop can only be used with arrays. (T/F)

a)

True

b)

False

4.

In PHP, arrays can store elements of different data types. (T/F)

a)

True

b)

False

5.

The if statement can only be used with integer values. (T/F)

a)

True

b)

False

6.

To declare a variable in PHP, you must use the (a)   symbol before the variable name.

7.

The (a)   operator is used to concatenate strings in PHP.

8.

In a for loop, the three expressions are separated by (a)   .

9.

To access the length or to count the number of an array in PHP, you can use the (a)   function.

10.

Find and fix the error in the following code:

4 lines
11.
  1. Correct the syntax error in this array declaration:

4 lines
12.

Fix the loop to properly iterate through the array:

4 lines
13.

Correct the code to properly check if the key exists in the array:

4 lines
14.

Which of the following is NOT a valid way to start a PHP code block?

a)

<?php

b)

<?=

c)

<!--

d)

<?