wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

PHP hypertext preprocessor

Total questions: 20

Worksheet time: 4mins

Name
Class
Date
1.

Which of the following array represents an array with strings as index?

a)

Numeric Array

b)

Associative Array

c)

Multidimentional Array

2.

PHP server scripts are surrounded by delimiters, which?

a)
b)
c)
3.

What are the two types of array in php

a)

Indexed, sequence

b)

Associative, sequence

c)

Indexed, associative

d)

None

4.

How do you write "Hello World" in PHP

a)

Document.Write("Hello World");

b)

"Hello World";

c)

echo "Hello World";

5.

1. All variables in PHP start with which symbol?

a)

$

b)

!

c)

&

6.

What does PHP stands for?

a)

PHP: Hypertext Preprocessor

b)

Private Home Page

c)

Personal Hypertext Processor

7.

PHP is a____________side scripting language

a)

server

b)

browser

c)

client

8.

Which one of these variables has an illegal name?

a)

$my-Var

b)

$myVar

c)

$my_Var

9.

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");

10.

Which of the following is not true?

a)

PHP can be used to develop web applications.

b)

PHP makes a website dynamic

c)

PHP can not be embedded into html.

11.

Find the output

<?php

$x = 5;

{ $x = 10;

echo $x;

}

echo $x;

?>

a)

105

b)

510

c)

1010

12.

find the output

<?php

$x = 1;

$x += 1;


echo $x;

?>

a)

2

b)

1

c)

0

13.

_______ is a concatenation operator in php

a)

+ (plus)

b)

+=

c)

. (dot)

14.

The default file extension for PHP files is __________.

a)

.html

b)

.php

c)

.css

d)

.java

15.

The 2 basic ways to get output in PHP are __________.

a)

echo and cout

b)

echo and scan

c)

echo and print

16.

What will be the output of the following program?


<?php $var1 = "Hello"; $var2 = "World"; echo "$var1$var2"; ?>

a)

HelloWorld

b)

"$var1$var2"

c)

Hello World

d)

None of the above

17.

What is the step to create database?

a)

Open localhost/phpmyadmin/

b)

Open NetBeans/New Project/

c)

Open browser/Notepad++

18.

<?php $fruits = array ("apple", "orange", array ("pear", "mango"),"banana");

echo (count($fruits, 1)); ?>

What is the output of the php code?

a)

5

b)

4

c)

6

d)

3

19.

Who is the father of PHP?

a)

Drek Kolkevi

b)

Willam Makepiece

c)

List Barely

d)

Rasmus Lerdorf

20.

Choose the equivalent of the statement : $sub -= $sub.

a)

$sub = $sub - 1

b)

$sub = $sub - $sub

c)

$sub = $sub - $sub -1

d)

$sub = - $sub