wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Quiz 2: Introduction to PHP

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

What does PHP stands for?

a)

PHP: Hypertext Preprocessor

b)

Private Home Page

c)

Personal Hypertext Processor

2.

Which among the following is the correct delimiters that surround PHP server scripts?

a)

<?php>...</?>

b)

<script>...</script>

c)

<?php...?>

d)

<&>...</&>

3.

How do you write "Hello World" in PHP

a)

Document.Write("Hello World");

b)

"Hello World";

c)

echo "Hello World";

4.

1. All variables in PHP start with which symbol?

a)

$

b)

!

c)

&

5.

How do you get information from a form that is submitted using the "get" method?

a)

Request.QueryString;

b)

$_GET[];

c)

Request.Form;

6.

When using the POST method, variables are displayed in the URL:

a)

True

b)

False

7.

How do you create an array in PHP?

a)

$cars = "Volvo", "BMW", "Toyota";

b)

$cars = array["Volvo", "BMW", "Toyota"];

c)

$cars = array("Volvo", "BMW", "Toyota");

8.

What is the correct way to add 1 to the $count variable?

a)

$count =+1

b)

$count++;

c)

++count

d)

count++;

9.

The if statement is used to execute some code only if a specified condition is true

a)

True

b)

False

10.

Which of the following is the correct code snippet for a foreach statement in PHP?

a)

foreach ($variable as $key => $value)

b)

foreach ($variable => $key as $value)

c)

foreach ($ctr = 0; $ctr < $array_size; $ctr++)

d)

foreach ($variable => $key => $value)