Академический Документы
Профессиональный Документы
Культура Документы
QUESTION 1
a) List TWO (2) features in PHP
b) Identify TWO (2) web server softwares.
c) Describe an anchor tag in HTML?
d) Write a HTML tag for unordered list by referring the output in Figure B1.
Figure B1
e) Answer the following questions.
i. List TWO (2) rules for naming the variable in PHP.
ii. State TWO (2) attributes of forms.
iii. State TWO (2) differences between GET and POST method.
QUESTION 2
a) Question i, ii, and iii are based on Figure B2.
<?php
$cars=array('Honda'=>'CRV','Toyota'=>'Vios',
'Proton'=>'Preve');
?>
<?php
$colours = array(grey,blue,black,white);
?>
Figure B2
1
Exercises (DFP3143)- Set 2
fopen("read.txt", "x+");
Figure B3
d) MySQL is the most popular database system used with PHP to manipulate data in the
databases. State the TWO (2) MySQL features.
e) Based on Table B1, write SQL syntax to update Alis salary to 3100.00 in table
STAFF.
Table B1: STAFF
Staff_ID Staff_Name Salary Address
1 Alex 4000.00 Johor
2 Ahmad 3000.30 Johor
3 Raju 2000.20 Perak
4 Ali Kedah
f) Based on Table B2, write a command to display all male students record in
STUDENT table by using mysql_query function.
Table B2 : STUDENT
Stu_ID Stu_Name Stu_Gender
01DIP15F2015 Zara Aisyah female
01DIP15F2020 Iskandar Zulkarnain male
01DIP15F2022 Stephanie female
01DIP15F2011 Nitya A/P Ramu female
2
Exercises (DFP3143)- Set 2
QUESTION 3
a) List THREE (3) vital components that are needed to be installed in the computer system to
create PHP environment page.
b) Web page, Browser, Hyperlink, Domain, URL, HTTP and IP Address are terminologies of
web server. Explain THREE (3) web terminologies that you have learned.
c) Write HTML syntax to allow user to choose one of the Gender by using radio button and key
in input data into text field component as shown in Figure B4.
Figure B4
<?php
$x = array(PHP, PERL, JAVA)
3
Exercises (DFP3143)- Set 2
QUESTION 4
a) Question i and ii are based on Figure B6.
Figure B6
i. Write a function to calculate total payment based on tax rate, quantity of item and price
input by user.
ii. Write a function to calculate total payment based on the quantity of item and the price
input by user. The tax rate is set to 5%.
b) Describe each of the file handling modes below:
i. r
ii. r+
iii. w
c) Write SQL command to create Students table to store students matric numbers,
name and addresses to the record. Set the suitable primary key.
d) Consider that the MySQL username is root and password is 1234, write a PHP code to
connect PHP files with myclass database.