0% found this document useful (0 votes)
39 views

Bit3202 Internet Programming Regular Reg Supp

This document contains instructions and questions for a university examination in Internet Programming. It covers topics like: - PHP scripting language capabilities and how it connects to MySQL databases. - Using PHP and MySQL to create, read, update and delete data from database tables. - Differences between dynamic and static web pages. - PHP control structures like loops and conditional statements. - PHP functions for working with databases, sending emails, variable scopes and more. - Best practices for PHP variables, arrays, user authentication and more. Students are instructed to attempt Question 1 and any two other questions. The questions involve writing PHP code segments, explaining concepts and demonstrating skills in PHP and MySQL.

Uploaded by

ashleykiki.ke
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views

Bit3202 Internet Programming Regular Reg Supp

This document contains instructions and questions for a university examination in Internet Programming. It covers topics like: - PHP scripting language capabilities and how it connects to MySQL databases. - Using PHP and MySQL to create, read, update and delete data from database tables. - Differences between dynamic and static web pages. - PHP control structures like loops and conditional statements. - PHP functions for working with databases, sending emails, variable scopes and more. - Best practices for PHP variables, arrays, user authentication and more. Students are instructed to attempt Question 1 and any two other questions. The questions involve writing PHP code segments, explaining concepts and demonstrating skills in PHP and MySQL.

Uploaded by

ashleykiki.ke
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

UNIVERSITY EXAMINATION 2017/2018

SCHOOL OF COMPUTING AND INFORMATICS


DEPARTMENT OF INFORMATION TECHNOLOGY

BBIT/BIT
REGULAR

UNIT CODE: BIT3202 UNIT TITLE: INTERNET


PROGRAMMING

DATE:AUGUST, 2018 SUPP/SPECIAL EXAM TIME: 2 HOURS


INSTRUCTIONS:
 Attempt question One and any other Two Questions.

Question 1 (20 Marks) - COMPULSORY

a) “PHP is server side scripting language”. Explain the statement. (2 Marks)

b) Explain four capabilities of PHP language. (4 Marks)

c) Write code segment to demonstrate how PHP based application is connected to


MySQL database server. (5 Marks)

d) Explain five reasons why MySQL is popularly used with web applications as the
database server. (5 Marks)

e) Consider the table below created on MySQL database server


Table: contacts

ID Surname Address
112 Mwere Nairobi
231 Owino Thika
313 Torich Mombasa

Library copy Page 1


401 Twere Eldoret

i. Write the web form code that can be used to capture the above records. Draw
the graphical view of the form. (4 Marks)

ii. Write the PHP code that can be used receive the data from the form and
insert into the table. (6 Marks)

iii. Write PHP based code for deleting Torich record from the table. (4 Marks)

Question 2 (20 Marks)


a) Using example differentiate between dynamic and static web page. (4 Marks)

b) Consider the loop program given below:


<?php
$i=0, $sum=0;
while ($i<=9)
{
echo $i.”<br>”;
$i++;
$sum+=i;
}
echo “sum=”.$sum.”<br>”;
}
?>
(i) Explain what the program does and write the output of the program. (4 Marks)

(ii) Rewrite the program using for loop. (4 Marks)

c) Using PHP based sample code, show how mysql UPDATE statement is
implemented. (5 Marks)

d) Consider the code given below:

$fname=”John”;
$county=”Nairobi”;
Write an output statement that prints out given below. (3 Marks)

My first Name is John and Nairobi is my home county

Library copy Page 2


Question 3 (20 Marks)

a) Consider the table given below:

Course Name Course Code


Bachelor of Education BED
Bachelor of Information Technology BIT
Bachelor of Commerce BCOM
Bachelor of Arts BA

(i) Using switch case write a program that that assigns Course names given
the course code. E.g if the course code is BA then it prints - Bachelor of
Arts. (6 Marks)

(ii) Re-write the program using IF statement. (6 Marks)

b) Define the term function. (2 Marks)

c) Explain the use of the following functions and show how they are used.
(6 Marks)
i. mysqli_select_db ( )
ii. mysqli_fetch_array()

Question 4 (20 Marks)

a) PHP has the capability to process and send email to mail server using mail( )
function.
i. Explain the various mail( ) function arguments. (4 Marks)

ii. Using example code, demonstrate how mail() function works. (6 Marks)

b) (i) Explain the term variable scope. (2 Marks)

ii. Using sample program code, explain two major types of variable scopes
supported by PHP. (6 Marks)

c) Explain the role of web server in web applications. (2 Marks)

Library copy Page 3


Question 5 (20 Marks)

a) Write a PHP function program that accepts three arguments of type integer then
compute the product of the arguments. The program returns the results to the
calling point of the program. (6 Marks)

b) Write sample PHP code to check if the user name and password entered by the
user on login form is correct. The user log in details are stored in MySQL table
name tbl_users (6 Marks)

c) State four rules for naming variables in PHP. (4 Marks)

d) Using sample code, demonstrate how to declare and initialize array in PHP.
(4 Marks)

Library copy Page 4

You might also like