wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Web Development

Total questions: 20

Worksheet time: 10mins

Name
Class
Date
1.

Which of the looping statements is/are supported by PHP?

i) for loop

ii) while loop

iii) do-while loop

iv) foreach loop

a)

(i) and (ii)

b)

(i), (ii) and (iii)

c)

All of the mentioned

d)

None of the mentioned

2.

Which of the following is/are a PHP code editor? ditor?

i) Notepad

ii) Notepad++

iii) Adobe Dreamweaver

iv) PDT

a)

Only (iv)

b)

All of the mentioned.

c)

(i), (ii) and (iii)

d)

Only (iii)

3.

Which of the following must be installed on your computer so as to run PHP script?

i) Adobe Dreamweaver

ii) PHP

iii) Apache

iv) IIS

a)

All of the mentioned

b)

Only (ii)

c)

(ii) and (iii)

d)

(ii), (iii) and (iv)

4.

Which of the below symbols is a newline character?

a)

\r

b)

\n

c)

/n

d)

/r

5.

If $a = 12 what will be returned when ($a == 12) ? 5 : 1 is executed?

a)

12

b)

1

c)

Error

d)

5

6.

Which of the following PHP statements will output Hello World on the screen?

(i) echo (“Hello World”);

(ii) print (“Hello World”);

(iii) printf (“Hello World”);

(iv) sprintf (“Hello World”);

a)

(i) and (ii)

b)

(i), (ii) and (iii)

c)

(i), (ii) and (iv)

d)

All of the mentioned

7.

< ?php

$color = "maroon";

$var = $color[2];

echo "$var" ;

?>

a)

a

b)

error

c)

$var

d)

r

8.

< ?php

$total = "25 students";

$more = 10;

$total = $total + $more;

echo "$total" ;

?>

a)

Error

b)

35 students

c)

25 students

d)

35

9.

What will be the output of the following PHP code?

< ?php

$score = 1234;

$scoreboard = (array) $score;

echo $scoreboard[0];

?>

a)

1

b)

Error

c)

1234

d)

2

10.

Which statement will output $x on the screen?

a)

echo “\$x”;

b)

echo “$$x”;

c)

echo “/$x”;

d)

echo “$x;

11.

Which of the below statements is equivalent to $add += $add ?

a)

$add = $add

b)

$add = $add +$add

c)

$add = $add + 1

d)

$add = $add + $add + 1

12.

What will be the output of the following PHP code?

< ?php

$team = "arsenal";

switch ($team) {

case "manu":

echo "I love man u";

case "arsenal":

echo "I love arsenal";

case "manc":

echo "I love manc"; }

?>

a)

I love arsenal

b)

I love arsenalI love manc

c)

Error

d)

I love arsenalI love mancI love manu

13.

What will be the output of the following PHP code?

< ?php

$num = 10;

echo 'What is her age? \n She is $num years old';

?>

a)

What is her age? \n She is $num years old

b)

What is her age? She is 10 years old

c)

What is her age?

She is $num years old

d)

What is her age?

She is 10 years old

14.

What will be the output of the following PHP code?

< ?php

$a = "clue";

$a .= "get";

echo "$a";

?>

a)

get

b)

true

c)

False

d)

Clueget

15.

11. Which of the following php statement/statements will store 111 in variable num?

i) int $num = 111;

ii) int mum = 111;

iii) $num = 111;

iv) 111 = $num;

a)

Both (i) and (ii)

b)

All of the Mentioned

c)

only (iii)

d)

only (i)

16.

What will be the output of the following php code?

< ?php

$num = "1";

$num1 = "2";

print $num+$num1 ;

?>

a)

3

b)

1+2

c)

error

d)

12

17.

Which of following variables can be assigned a value to it?

(i) $3hello

(ii) $_hello

(iii) $this

(iv) $This

a)

All of the mentioned

b)

Only (ii)

c)

(ii), (iii) and (iv)

d)

(ii) and (iv)

18.

What will be the output of the following code

< ?php

$foo = 'Bob';

$bar = &$foo;

$bar = "My name is $bar";

echo $bar;

echo $foo;

?>

a)

Error

b)

My name is BobBob

c)

My name is BobMy name is Bob

d)

My name is Bob Bob

19.

< ?php

function track() {

static $count = 0;

$count++;

echo $count ;

}

track();

track();

track();

?>

a)

123

b)

111

c)

000

d)

011

20.

Which of the following attribute is needed for file upload via form?

a)

enctype='multipart/form-data'

b)

enctype='singlepart/data'

c)

enctype='file'

d)

enctype='form-data/file'