Test 3 Form 5
Test 3 Form 5
i. State the number of fields and records in the EMPLOYEE table (0.5 mark)
ii. What do you understand by the terms: primary key, Foreign key ? (2 marks)
iii. What is the most appropriate key for each of the three tables (1.5 marks)
iv. With the keys chosen above, if the company has another employee whose FNAME, LNAME,
DEPTCODE and SALCODE are the same as for john Doe, how can the database management system
distinguish between these two employees? (1 mark)
v. Would it be possible to add another employee called johnny Walker whose ID is 6? Explain your
answer. (1 mark)
vi. Explain the problem that will arise if you try to add an employee whose SALCODE is S10,
without making any other change in the database. What change would you make so that this
employee’s data can be stored in the database? (2 marks)
Question 3: (4 marks)
The following algorithm is intended to read three numbers and determine their product.
Start
1. Set Count = 1
2. While Product = 1
3. While (Count <= 3) Do
4. Get a Number, N
5. Set Product = Product * N
6. Set Count = Count + 1
7. Print Product
8. Endwhile
END
Assume that the three numbers that are read in line 4 are 2,3 and 5
i. Determine the output that is printed on line 7 each time the loop instructions are executed. (2 marks)
ii. Draw a flow chart for the algorithm (2 marks)