You are on page 1of 1

HCSCI132 Assignment 1 [50 Marks] Due Date 01/10/2022

NB: Create a write up using Microsoft Word and save as a .docx or .doc file. Attempt all
questions in groups of not more than four individuals and show all student details (i.e. full
names, programme and registration number). For questions which need source code make
sure you attach the source code from your Python Notebook or any integrated development
environment (IDE) used as a .ipyb or .py file showing all relevant comments and timestamp
on the IDE. Upload document to google classroom or email before the due date.
1) Define the following terms and mention suitable examples:
a) Interpreter [2]
b) Exception handling [2]
c) Class [2]
d) Algorithm [2]
e) Data Structure [2]
2) Differentiate protected and private access modifiers as used in classes. [4]
3) Distinguish for and if statements. [4]
4) Write a program which stores the following keys (id_no, employee_name, dept,
hours_worked and grade) to a dictionary named EMP. Go on to add 5 employee details
of your choice and show the output of the values in the dictionary. [6]
5) Write a program which calculates the factorial of a number and validate the input
captured to numbers only.
[6]
6) Given the string variable names = “my name is: ”. Write a code snippet which prompts
to add your name and append it to variable names, remove “my name ” and replace with
“MY FULL NAME ”, change ‘is’ to uppercase. Also show how you search for the
substring “your_name” and count the length of resulting string.
[10]
7) Describe the concepts of encapsulation and inheritance using suitable examples. [10]

You might also like