wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Pemrograman Web Lanjut

Total questions: 30

Worksheet time: 14mins

Name
Class
Date
1.

Apa singkatan dari PHP?

a)

PHP: Hypertext Preprocessor

b)

Preprocessed Hypertext Page

c)

Hypertext Markup Language

d)

Hypertext Transfer Protocol

2.

Mendeklarasikan variabel dalam PHP dimulai dengan simbol apa?

a)

&

b)

!

c)

$

d)

@

3.

Cara membuat koneksi dengan database bernama "login_db" yang tepat adalah

a)

mysqli_fetch("localhost, "root", "", "login_db")

b)

mysqli_connect("localhost", "root", "", "login_db")

c)

mysqli_connect("root", "localhost", "", "login_db")

d)

mysqli_query("localhost", "root", "", "login_db")

4.

Tipe data Boolean hanya memiliki nilai true dan false..

a)

Benar

b)

Salah

c)

Jawaban a dan b benar

d)

Tidak diketahui

5.

What are the two types of array in php

a)

Indexed, sequence

b)

Associative, sequence

c)

Indexed, associative

d)

None

6.

Manakah yang termasuk sifat dari constant?

a)

Valuenya dapat berubah pada saat program berjalan

b)

membutuhkan tanda $ saat deklarasi

c)

memperhatikan scope

d)

dideklarasikan dengan function define()

7.

Penulisan komentar pada PHP ditandai dengan

a)

<!-- -->

b)

/* */

c)

<? ?>

d)

\ /

8.

Cara membuat function pada PHP

a)

function nama_fungsi(){..}

b)

function nama_fungsi():

c)

function nama_fungsi():

d)

function $nama_fungsi(){..}

9.

$a=array("Timmy","Jimmy");

Is an example of

a)

Indexed array

b)

Associative array

c)

Sequence array

d)

None

10.

Kode PHP diawali dan di akhiri dengan tanda?

a)

<script> … </script>

b)

<?php … ?>

c)

<?php … </?php>

d)

<php … /?>

11.

<?php

$kondisi="kering";

if($kondisi=="hujan"){

echo "kondisi sekarang sedang hujan";

} else {

echo "kondisi tidak hujan";

}

?>

a)

kondisi tidak hujan

b)

kondisi sekarang hujan

c)

kondisi cerah

d)

kondisi kering

12.

"syntax error, unexpected variable "$aksi" in C:\xampp\htdocs\praktikumbci\crud-login\modul\admin\admin.php on line 15."

Jika dilihat dari pesan error diatas, apa kemungkinan penyebab tersebut ?

a)

Error query

b)

Error kurang titik koma

c)

Programmernya ngantuk

d)

Di sekitar baris ke 15, variable $aksi terpanggil namun tidak pernah di deklarasi

13.

Create a cookie named "username".

a)

setcookie = ("username", "John", time() + (86400 * 30), "/");

b)

setcookie("username", "John", time() + (86400 * 30), "/");

c)

session("username", "John", time() + (86400 * 30), "/");

d)

setsession("username", "John", time() + (86400 * 30), "/");

14.

Create a session variable named "favcolor".

a)

$session["favcolor"] = "green";

b)

$_SESSION["favcolor"] = "green";

c)

$_SESSION["favcolor"] ["green"];

d)

$SESSION["favcolor"] ="green";

15.

Bagaimana cara membuat cookie di PHP?

a)

makecookie()

b)

createcookie

c)

cookie_start()

d)

setcookie()

16.

Berikut ini yang BUKAN merupakan penyebab dari error pada gambar disamping adalah

a)

Typo dalam pemanggilan function

b)

Function belum di deklarasi

c)

Kurang titik koma

17.

$a=array(10=>"Jimmy",20=>"mummy");

Is an example of

a)

Sequence array

b)

Indexed array

c)

Associative array

d)

None

18.

Perhatikan script PHP berikut, berfungsi untuk ...

<?php

$link=mysql_connect('localhost', 'root', ' ' ) ;

?>

a)

Tampil data

b)

Ubah data

c)

Simpan data

d)

Hapus data

e)

Koneksi ke database

19.

<?php

function add()

{

global $a=10;

echo $a;

}

add();

$a+=10;

?>

Output is

a)

10

b)

15

c)

20

d)

30

20.

Atribut yang wajib disertakan untuk membuat upload file

a)

method="POST"

b)

action=""

c)

class="uploading_file"

d)

enctype="multipart/form-data"

21.

Apa output dari code tersebut?

a)

No output

b)

True

c)

1

d)

Nyerah deh

22.

Script PHP berikut merupakan perintah untuk ...

<?php

$result=mysql_query('SELECT * FROM BUKU');

$row=mysql_fetch_row($result);

echo "$row[0] $row[1] $row[2] $row[3] $row[4]";

?>

a)

Tampil data

b)

Ubah data

c)

Simpan data

d)

Hapus data

e)

Koneksi ke database

23.

Apa fungsi dari die(...) pada code disamping

a)

Jika ada file "mytestfile.txt" maka akan mengeluarkan string error

b)

Mengeluarkan nilai boolean

c)

Menghentikan program jika mytestfile.txt tidak ada

d)

tidak berguna

24.

Apa output code tersebut?

a)

Element found at position 6

b)

Element not found

c)

Element found at position 5

d)

Element found at position 7

e)

Gatau deh

25.

Apa output dari code tersebut?

a)

Mantu idaman

b)

Tidak direstui

26.

Apa output dari code tersebut?

a)

0

b)

false

c)

1

d)

gatau deh

27.

Apa output code tersebut?

a)

90

b)

43

c)

32

d)

54

28.

Apa outputnya

a)

1

b)

20

c)

9

d)

10

29.

Apa output dari code tersebut?

a)

true

b)

false

c)

pusing

30.

Apa output dari code tersebut?

a)

Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => 5 )

b)

15

c)

5

d)

1