Professional Documents
Culture Documents
795 CSC 2022 PAPER 3 NAL MOCK 2024
795 CSC 2022 PAPER 3 NAL MOCK 2024
PAPER NUMBER 3
INSTRUCTIONS TO CANDIDATES:
1
MOCK/NAL/0795/3/2024/ Turn Over
NAL MOCK 2024, 795 COMPUTER SCIENCE PAPER 3
Part 1
A company sells furniture to customers of its store. The store does not keep furniture in stock.
Instead, a customer places an order at the store and the company then orders the furniture
required from its suppliers. When the ordered furniture arrives at the store a member of staff
telephones or emails the customer to inform him/her that it is ready for collection.
Customers often order more than one type of furniture on the same order, for example a sofa
and two chairs.
Details of the furniture, customer and orders are to be stored in a relational database using the
following relations:
The attribute for these relatiions and others used eventually , are detailed as fellows
i) Give an E-R daigram that shows the degree of the any three relationship that exist
between the above entities 3 marks
2
MOCK/NAL/0795/3/2024/ Turn Over
NAL MOCK 2024, 795 COMPUTER SCIENCE PAPER 3
ii) Using SQL statement do the following using your favorite DBMS
1. Create a database call sells 2 mark
2. Create the four table above. Write down the SQL statements 8 marks
3. Identify the primary, foreign and composite keys if any. Justify your answer. 6
marks
4. Write down the SQL statement to insert the value “389, T199, 02/02/2024” in the
CustomerOrder table. 2 marks
5. Write down the SQL statement to modify the value “OderID “389” to “550”, in
the CustomerOrder table. 2 marks
6. In the sells, create all the relationship given above 4 marks
3) a) Explain how the linear search algorithm works given an array of size N. (3 marks)
b) consider the psuedocode below and answer the questions that fellows
interger fact(int i)
Begin
if i=1 ; Then
return 1 ;
Else
return(i*fact(i-1)) ;
End
i) Write iterative version of the function factorial show above and implement it using either c or
Pascal. (10 marks)
ii) Using function write a c or Pascal that prompt the user to enter a an integer a print a
triangle using stars. (10 marks)
iii)
iv) Justify why programmers prefer the iterative function over the recursive function show in the
psuedocode above. (2 marks)
3
MOCK/NAL/0795/3/2024/ Turn Over