0% found this document useful (0 votes)
42 views4 pages

6-Develop Server-Side Web Applications Using PHP

The document is a written assessment for a Computer Programming Level 6 course focusing on developing server-side web applications using PHP. It consists of two sections, with Section A requiring answers to all questions and Section B allowing candidates to choose three questions to answer. The assessment covers various topics including PHP functions, error types, data validation, arrays, sessions, cookies, control structures, constants, and exception handling.
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)
42 views4 pages

6-Develop Server-Side Web Applications Using PHP

The document is a written assessment for a Computer Programming Level 6 course focusing on developing server-side web applications using PHP. It consists of two sections, with Section A requiring answers to all questions and Section B allowing candidates to choose three questions to answer. The assessment covers various topics including PHP functions, error types, data validation, arrays, sessions, cookies, control structures, constants, and exception handling.
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

©2023 TVET CDACC

061306T4CPM
COMPUTER PROGRAMMING LEVEL 6
IT/OS/CP/CR/09/6/A
DEVELOP SERVER-SIDE WEB APPLICATIONS USING PHP
NOV/DEC 2023

TVET CURRICULUM DEVELOPMENT, ASSESSMENT AND CERTIFICATION


COUNCIL (TVET CDACC)

WRITTEN ASSESSMENT

TIME: 3 Hours

INSTRUCTIONS TO CANDIDATE:
1. The paper consists of two sections: A and B

2. Answer ALL questions in Section A and any Three from section B

3. Marks for each question are indicated in the brackets

4. A separate answer booklet will be provided

5. Do not write on the question paper

Candidates should answer the questions in English

This paper consists of Four (4) printed pages.


Candidate should check the question paper to ascertain that all the pages are
printed as indicated and that no questions are missing.

Page 1 of 4
©2023 TVET CDACC

SECTION A (40 Marks)


(Answer ALL the questions in this section)

1. Explain the meaning of server-side application development and give TWO examples of

programming languages used. (4 Marks)

2. Outline the function of the following super-global functions as used in PHP programming

language.

i. $_SERVER (2 Marks)

ii. $_SESSION (2 Marks)

3. Explain any TWO types of errors that a PHP programmer is likely to encounter during

form creation. (4 Marks)

4. Mmena is an experienced web designer who prefers to use PHP for server-side scripting

over other languages. List FOUR reasons for his preference. (4 Marks)

5. Outline TWO PHP functions that can be used to escape html code on form. (4 Marks)

6. Peter wants to submit a form data to the database but he is not sure which method to use

between POST and GET. Contrast the two methods and advise him accordingly.

(4 Marks)

7. Write a PHP script that can be used to generate all even numbers between 0-100. Use for

loop. (6 Marks)

8. Outline FOUR rules of naming variables in PHP programming language. (4 Marks)

9. With the aid of a syntax, explain a ternary operator in PHP language. (4 Marks)

10. Outline TWO types of arrays as used in a sever side programming language. (2 Marks)

Page 2 of 4
©2023 TVET CDACC

SECTION B (60 Marks)


(Answer any THREE questions in this section)
11.
a) Validation is an important process used for data management across a sever side
programming language. Use this concept to answer the following questions.
i. Outline FOUR advantages of ensuring that user data is validated (4 Marks)

ii. Explain any THREE methods used to validate information from a text box
(6 Marks)
b) Arrays plays a vital role in PHP programming. Use the knowledge you have on arrays
to answer the following questions.
i. Explain TWO advantages of using arrays in PHP programming. (2 Marks)
ii. Assuming table 1 below is a representation of a database table, write a PHP code
snippet that will display the data as it appears. (8 Marks)

Name Gender Age


John Kamau Male 20
Mike Mmena Male 30
Ann Kamau Female 21
Damian Kalondu Female 24
Table 1
12.
a) Sessions and cookies are very important when it comes to website data security and
management. They can be used to enhance security or as a loophole to security
threats.
i. Explain TWO Differences between session and cookie (4 Marks)
ii. Using an example in each case, write a snippet that shows how a session is created
and destroyed (6 Marks)

b) Control structures help a program to control the execution of a program. Use the
knowledge on Control structures to answer the following questions.
i. Contrast while and do while loops as used in PHP (2 Marks)
ii. Use the if…else control structure to computer net salary of an employee whose
tax is calculated using the table 2 below. (8 Marks)
Hint: net salary=salary-tax

Salary Tax rate


<30000 25%
30001 to 50000 30%
ABOVE 50000 35%
Table 2

Page 3 of 4
©2023 TVET CDACC

13.

a) In PHP programming language, the use of constants is considered to be one of the best
practices.

i. Explain TWO reasons as to why this is true. (4 Marks)

ii. Write a PHP script that declares PI as a constant whose value is 3.142. The script
should be used to calculate the area of a circle whose radius is 7.4. (6 Marks)

b) i. With an aid of an example, explain the for each loop in PHP. (4 Marks)

ii. Explain any THREE types of data used in PHP programming language.
(6 Marks)
14.

a) i. Differentiate between break and continue statements as used in PHP. (4 Marks)

ii. Explain THREE types of scopes used in PHP programming language.

(6 Marks)

b) i. Differentiate between require and require once () functions as used in PHP.


(4 Marks)
ii. Explain the difference between runtime exception and compile time exception.
(6 Marks)

THIS IS THE LAST PRINTED PAGE

Page 4 of 4

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy