0% found this document useful (0 votes)
269 views

SCO202 Event Driven Prog

The document contains instructions for a computer science exam at Machakos University College in Kenya. It lists 5 questions related to event driven programming, .NET framework, Windows forms, and object-oriented programming concepts. Students are asked to write C# code to solve business problems related to billing, data entry, employee payroll, and university grading systems. They are expected to use concepts like loops, methods, controls, object binding and OOP principles in their solutions.

Uploaded by

Caleb kipkorir
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
269 views

SCO202 Event Driven Prog

The document contains instructions for a computer science exam at Machakos University College in Kenya. It lists 5 questions related to event driven programming, .NET framework, Windows forms, and object-oriented programming concepts. Students are asked to write C# code to solve business problems related to billing, data entry, employee payroll, and university grading systems. They are expected to use concepts like loops, methods, controls, object binding and OOP principles in their solutions.

Uploaded by

Caleb kipkorir
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

MACHAKOS UNIVERSITY COLLEGE

(A Constituent College of Kenyatta University)


University Examinations for 2015/2016 Academic Year

SCHOOL OF ENGINEERING AND TECHNOLOGY

DEPARTMENT OF COMPUTING AND INFORMATION TECHNOLOGY

SECOND SEMESTER EXAMINATION FOR DEGREE IN BACHELOR OF


SCIENCE IN COMPUTER SCIENCE

SCO 202: EVENT DRIVEN PROGRAMMING


Date: 3/8/2016 Time: 8:30 – 10:30 AM
INSTRUCTIONS

Answer question ONE and any other TWO questions

QUESTION ONE
a) Explain the role of the following visual studio IDE components
i. Solution explorer (1 mark)
ii. Tool box (1 mark)
iii. Object browser (1 mark)
b) Critically discus the approaches adopted by the .NET framework to support multiple
languages (4 marks)
c) You have been hired by KPLC to design a windows form based application to assist
its clients in billing operation. The application shall capture the current and previous
meter reading then calculate the unit as follows
Units=current reading-previous reading
Based on the units, the application is supposed to calculate customer bill. The bill is
based on the following category

Examination Irregularity is punishable by expulsion Page 1 of 5


Category Units Rate per unit
(Ksh.)
01 0-52 2.50
02 53-100 11.50
03 Over 100 22.00
The customer bill is calculated by multiplying the rate with the number of units. All
bills are subjected to 16% tax. Finally, the tax amount is added to the customer bill
amount to get the final bill amount

The application should display the customer bill information on a data gridview
control upon the click of a button as follows

Units consumed Rate Bill tax Tax Bill

Required:
i. Sketch appropriate user Interface to implement the above scenario. (2 marks)
ii. Write appropriate C# code to implement the above business logic. (10 marks)

d) Explain what is meant by the term ‘event driven programming’ (1 mark)


e) Write appropriate C# code to capture information about n clients. The information
includes Tenant ID, Tenant Name, Gender, Mobile No, Address and city. The details
of the n client shall be displayed on a datagrid view control in the following format.
Use a do… while loop to implement the program

# Tenant ID Tenant Name Gender Mobile No Address City


1 0001 Joe M 75256 4 Nrb
2 0002 Peter M 6957 62 Ksm
3 0003 Anne F 6677 92 Msa

(10 marks)

Examination Irregularity is punishable by expulsion Page 2 of 5


QUESTION TWO

a) With respect to .NET framework, explain how the source of a .NET compliant language
is compiled into machine code. Use a diagram to support your arguments. (7 marks)
b) A windows forms application is supposed to enable users to capture information about a
product i.e. product code, name, price and category ID. Based on Category ID, the
program should display category Name and the description on data grid view control.
Assume the following categories exists. Use switch case to make your decisions

Category ID Category Name Description


001 Food Contains different foods
002 Electronics Contains different electronics
003 Automobile Category on different vehicles
(7 marks)
c) Explain the role of the following windows forms control
i. Timer control (1 mark)
ii. Context Menu strip control (1 mark)
d) with examples, discuss the two various mechanisms used by C# to implement type
casting (4 marks)

QUESTION THREE

a) Compare and contrast .NET and J2EE architectures from the following perspectives
i. Execution engine (3 marks)
ii. Tools support (2 marks)
iii. Language support (2 marks)
b) The salary earned by staff of a company named XYZ is based on three major components
i.e. basic salary, commuter allowance and housing allowance. All employees who work
for overtime hours are paid overtime amount based on the following criteria
Overtime hours Rate in (Ksh)
0-10 1500.00
Over 10 2000.00

Examination Irregularity is punishable by expulsion Page 3 of 5


The overtime amount is added to basic salary, commuter allowance and housing
allowance to get employee gross salary. The gross salary is used to calculate employee
PAYE (Paye As You Earn) as shown below

Gross salary PAYE


0-5,000 5%
5001-10,000 7%
10,001-20,000 9%
20,001-30,000 12%
Above 30,000 15%

The net salary is calculated as follows


Net salary=gross-PAYE
Required:
Write a C# program to implement the above business logic. The program should accept
employee basic salary, commuter allowance, housing allowance and overtime hours worked
(if any) then display the following information on appropriate control (s).
Gross salary PAYE amount Net salary Overtime amount

(13 marks)
QUESTION FOUR
a) Differentiate between Single Document Interface (SDI) and Multiple Document Interface
(MDI) applications (4 marks)
b) Explain the role played by the two major components of the .Net Framework
(4 marks)
c) Write appropriate C# code to
i. Load an image sleeted using an openFileDialog to a pictureBox known as
‘picsample’ (3 marks)
ii. Run a form known as ‘FrmCustomer’ to the current MDIform (3 marks)
d) Discus any two repetitive control structures supported by C# and how they are
implemented. Use an example for each to demonstrate how it is implemented by the
language (6 marks)

Examination Irregularity is punishable by expulsion Page 4 of 5


QUESTION FIVE
a. Critically discuss the rationale behind the two stages of compilation exhibited by .NET
framework (4 marks)
b. Explain the role of the following ADO.NET class objects
i. SQL connection (1 mark)
ii. SQL command (1 mark)
iii. Data reader (1 mark)
c. The following case study relates to Taji College grading cretatia
A student is supposed to sit for 7 subjects in a given semester. During the semester, a
student sits for a cat (out of 20 marks), project (out of 30 marks) and end of semester
exam (out of 50 marks). The three are added together to get the final mark of the student
(out of 100 marks). Based on the final mark, grading is done on the following criteria

70-100 A Excellent

60-69 B Good

50-69 C Fair

40-49 D Pass

0-39 F Fail

Required:
Write appropriate C# code to implement the above business logic. The program shall accept
the unit name, unit code, semester (1,2,3) academic year, cat marks, project marks and exam
marks. The final mark shall be passed to a method known as grade ( ) which calculates and
returns the grade of the student. The programs produce output in the following format

Final mark Grade Remarks

(13 marks)

Examination Irregularity is punishable by expulsion Page 5 of 5

You might also like