wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

PHP

Total questions: 25

Worksheet time: 13mins

Name
Class
Date
1.

What does PHP stand for?

a)

PHP: Hypertext Preprocessor

b)

Private Home Page

c)

Personal Hypertext Processor

2.

PHP server scripts are surrounded by delimiters, which?

a)

<?php>...</?>

b)

<&>...</&>

c)

<script>...</script>

d)

<?php...?>

3.

How do you write "Hello World" in PHP

a)

"Hello World";

b)

echo "Hello World";

c)

Document.Write("Hello World");

4.

All variables in PHP start with which symbol?

a)

!

b)

$

c)

&

5.

What is the correct way to end a PHP statement?

a)

New Line

b)

</php>

c)

;

d)

.

6.

The PHP syntax is most similar to:

a)

JavaScript

b)

VBScript

c)

Perl and C

7.

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

a)

Request.QueryString;

b)

Request.Form;

c)

$_GET[];

8.

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

a)

True

b)

False

9.

In PHP you can use both single quotes ( ' ' ) and double quotes ( " " ) for strings:

a)

True

b)

False

10.

Include files must have the file extension ".inc"

a)

False

b)

True

11.

What is the correct way to include the file "time.inc" ?

a)

<?php include file="time.inc";?>

b)

<?php include "time.inc";?>

c)

<!-- include file="time.inc" -->

d)

<?php include:"time.inc";?>

12.

What is the correct way to create a function in PHP?

a)

new_function myFunction()

b)

function myFunction()

c)

create myFunction()

13.

What is the correct way to open the file "time.txt" as readable?

a)

fopen("time.txt","r");

b)

fopen("time.txt","r+");

c)

open("time.txt");

d)

open("time.txt","read");

14.

PHP allows you to send emails directly from a script

a)

False

b)

True

15.

Which superglobal variable holds information about headers, paths, and script locations?

a)

$_GET

b)

$_SESSION

c)

$_SERVER

d)

$GLOBALS

16.

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

a)

$count++;

b)

count++;

c)

++count

d)

$count =+1

17.

What is a correct way to add a comment in PHP?

a)

<comment>...</comment>

b)

*\...\*

c)

/*...*/

d)

<!--...--->

18.

PHP can be run on Microsoft Windows IIS(Internet Information Server):

a)

False

b)

True

19.

The die() and exit() functions do the exact same thing.

a)

True

b)

False

20.

Which one of these variables has an illegal name?

a)

$my-Var

b)

$myVar

c)

$my_Var

21.

How do you create a cookie in PHP?

a)

setcookie()

b)

makecookie()

c)

createcookie()

22.

In PHP, the only way to output text is with echo.

a)

True

b)

False

23.

How do you create an array in PHP?

a)

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

b)

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

c)

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

24.

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

a)

True

b)

False

25.

Which operator is used to check if two values are equal and of same data type?

a)

=

b)

==

c)

===

d)

!=