Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

THE INTERNATIONAL UNIVERSITY OF MANAGEMENT

NAMIBIA

CE480UY
COMPUTER STUDIES 4B

FINAL EXAMINATION

NOVEMBER 2022

Instructions to Candidates:

1. Time Allowed: 3 Hours.

2. Answer all questions in Section A and chose one question in Section B.

3. Section A is to be answered on your computer and Section B using the


exams booklet.

4. Calculators are allowed provided they are not programmable.

5. No books, dictionaries, papers, cell phones or any other written


materials are allowed in this examination.

6. Candidates who break IUM examination regulations or commit any


malpractice will be disqualified from the examinations.

Total Marks: 100

Examiner: Mrs E. Nangolo


Internal Moderator:

1
Section A - Answer all Questions [Total Marks: 70]
 Create a folder on the desktop and name it CE42022-“Your Surname”
 All files for this exam should be saved in this folder.

Question 1

You have been called for a programming position interview by a local IT consultant
company. You are required to design a multiplication calculator consisting of two
textboxes, three labels and three buttons. The two textboxes are for the user to enter
two numbers, one label is to display the multiplication operator, the other label is to
display the equal sign and the last label is to display the answer. The three buttons
represent Calculate, Clear and Exit.

(i) Design a form and provide the code for the ‘calculate’, ‘clear’ and ‘exit’
buttons.

[Total 20 marks]

Question 2

Create a program called AdmissionSystem.


The program should allow a user to enter full names of prospective students, their
date of birth as well as their marks for the following subjects: English, Mathematics,
Physical Science and Biology. The system has to check that the marks obtained for
all subjects are either 50% or above. If a prospective student did not score 50% in
one or more subjects, the system should deny the admission by displaying a
message showing the full name of the student and that their application is
unsuccessful. If a prospective student has scored 50% or more in all the subjects,
the system will grant admission by displaying a message showing the full name of
the applicant, their birth date and that they have been granted admission.

2
[Total 25 Marks]

Question 3

Create a program called Payroll Master. The program should prompt the user to
enter the name of an employee and the number of hours an employee has worked
per week. A week has a total of 40 working hours and any extra hours worked
should be counted as overtime. Normal working hours are paid at N$15.00 per hour
while overtime hours are paid at N$20.00 per hour. The pay per hour for normal
working hours (N$15.00) and for overtime hours (N$20.00) should be stored into
constants and should not be entered by the user. The program should contain a
function called calculatePay with two parameters for employee name and hours
worked. This function uses the number of hours an employee has worked to
calculate the weekly wage of the employee and thereafter display the name of the
employee, and the weekly wage amount in a Message Box.

3
[Total 25 Marks]
Section B – Chose one Question [Total Marks: 30]

Question 4
a) Discuss the importance of “Hierarchy of Operations” (usually referred to as
“Order of Precedence”) and order the following accordingly: addition,
parentheses, raising to a power and multiplication. (5 marks)

b) Calculate the values of Y1, Y2, Y3, Y4 and Y5 in the statements below, taking
the variables K = 3, L = 4, M = 12, N = 20, O= 2 and P = 3. Show all your
calculations.

(i) Y1 = K + L * M - N / O+ P

(ii) Y2 = (K + L) * M - N/ O + P

(iii) Y3 = (K + L) * (M - N) / O + P

(iv) Y4 = (K + L) * (M - N) / (O + P)

(v) Y5 = (K + L) * M - N / (O + P) (3 marks each)

c) With examples distinguish between each of the following pairs of terms used
in Visual Basic:

(i) Arithmetic Operator and Relational Operator

(ii) Assignment Instruction and Input Instruction

(5 marks each)

[Total 30 marks]

Question 5
a) Many high level languages allow the programmer to use built-in functions and
to create user-defined functions, often with arguments (parameters).

(i) What are functions? Explain the parts of a function. (5 marks)


(ii) Explain the meaning of built-in function and argument. (5 marks)

4
b) Examine this piece of Visual Basic

Private Sub total (numbers (10) As Integer) As Integer


Dim sum As Intger
Dim count As Integer
Count = 0
Do While count < 10
Sum = sum + numbers (count)
Loop
Total = sum
End Sub
This function contains three errors. Identify each error. Explain what it is, state
the type of error, e.g. syntax, logical or run-time, and how it can be corrected.
(10 marks)

c) With examples distinguish between each of the following pairs of terms used
in Visual Basic:
(i) Constant and Variable
(ii) Numeric Type and String Type. (5 marks each)

[Total 30 marks]

You might also like