wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

PHP Quiz

Total questions: 10

Worksheet time: 50mins

Name
Class
Date
1.

What will appear in the browser when run? 17, "Anto" => 25, "Budi" => 20); rsort($arr); print_r($arr);

a)

Array ( [Toni] => 17 [Budi] => 20 [Anto] => 25 )

b)

Array ( [0] => 17 [1] => 20 [2] => 25 )

c)

Array ( [Anto] => 25 [Budi] => 20 [Toni] => 17 )

d)

Array ( [0] => 25 [1] => 20 [2] => 17 )

2.

<?php

$a = 0100;

$b = 7;

$c = $a + $b;

echo "Nilai C adalah $c";

What will appear in the browser when run?

a)

Nilai C adalah 107

b)

Nilai C adalah 11

c)

Nilai C adalah 71

d)

Nilai C adalah 7100

3.

What is the acronym of PHP ?

a)

Personal Home Page

b)

PHP: Hypertext Preprocessor

c)

Pretext Hyper Preprocessor

d)

No Answer

4.

Which is the PHP Framework

a)

Laravel

b)

Spring

c)

Codeigniter

d)

Flask

5.

When using the POST method will the data be displayed in the URL ?

a)

True

b)

False

6.

What is correct way to create function in PHP ?

a)

function MyFunction() {}

b)

new MyFunction() {}

c)

MyFunction() {}

d)

create MyFunction() {}

7.

What are the predefined variable in PHP to get data sent via URL ?

a)

$_POST

b)

$_GET

c)

$_SERVER

d)

$GLOBALS

8.

<?php

function test(int ...$a) {

return $a[2] + $a[4];

}

$func = "test";

$result = $func(2,4,6,8,9);

echo "Result = $result";

What will appear in the browser when run?

What will appear in the browser when run?

a)

12

b)

17

c)

15

d)

8

9.

How to make cookie in PHP ?

a)

createCookie()

b)

setCookie()

c)

makeCookie()

d)

cookie()

10.

<?php

$int = -1;

$bool = (boolean)$int;

echo "Boolean value is $bool";

What will appear in the browser when run?

a)

Boolean value is 1

b)

Boolean value is True

c)

Boolean value is 0

d)

Boolean value is False