RICHFIELD GRADUATE INSTITUTE OF TECHNOLOGY (PTY) LTD
HIGHER EDUCATION AND TRAINING
FACULTY OF INFORMATION TECHNOLOGY
DIPLOMA IN INFORMATION TECHNOLOGY
PROGRAMMING 512B
Q
FINAL EXAMINATION 2023
DATE: 24 November 2023 DURATION: 3 Hours
EXAMINER: Nyasha Tamuka MODERATOR: Amishka Bharuth
STRUCTURE: QUESTION PAPER
NUMBERS QUESTIONS MARKS TIME IN MINUTES
SECTION A: SHORT QUESTIONS (COMPULSORY)
Question 1 20
SECTION B: LONG QUESTIONS (COMPULSORY)
Question 2 25
Question 3 25
Question 4 30
TOTAL 100 180
SECTION A: SHORT QUESTIONS (COMPULSORY) (20 MARKS)
Question 1 (20 marks):
1.1. Provide the Python code to create a dictionary with at least four key-value pairs.
Demonstrate how to access the second key-value pair and update its value. [10]
1.2. What is the significance of the mainloop() function in a Tkinter application? [5]
1.1. Explain the purpose of the IndexError exception. Provide an example in your
explanation. [5]
SECTION B: LONG/ESSAY- TYPED QUESTIONS (80 MARKS)
Question 2 (25 marks):
Write a Python program that creates the registration form shown below.
Question 3 (25 marks):
EmployeeNumber Name Age Gender
224145 Andiswa 22 Female
220022 Fiona 28 Female
201122 Rodney 29 Male
214120 Sipho 24 Female
230005 Ivana 30 Female
• Write a Python program to create a table called Employees (shown above). [5]
• Insert the records shown above into the table. [5]
• Display the employees who are at least 20 years old. [5]
• Update the Gender of the employee named Sipho to Male. [5]
• Delete the records of all male employees. [5]
Question 4 (30 marks):
• Create a superclass called BankAccount with attributes account_number, account_holder,
and balance. Implement methods called deposit and withdraw for adding and subtracting
funds, respectively. Ensure the withdraw method checks if the withdrawal amount is
within the available balance.
• Create a subclass called SavingsAccount. Add an attribute named interest_rate and
override the withdraw method to deduct a penalty of 5% every time the amount
withdrawn exceeds R10000.
• Create instances of the BankAccount and SavingsAccount classes and demonstrate the
use of the deposit and withdraw methods.
END OF QUESTION PAPER