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

Object Oriented Programming

Object oriented

Uploaded by

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

Object Oriented Programming

Object oriented

Uploaded by

emmanuelbro090
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 4
504429448 St Mount Kenya ) University UNIVERSITY EXAMINATION 2019/2020 ‘SCHOOL OF COMPUTING AND INFORMATICS DEPARTMENT OF INFORMATION TECHNOLOGY BACHELOR OF INFORMATION TECHNOLOGY REGULAR UNIT CODE: BIT3106 UNIT TITLE: OBJECT ORIENTED PROGRAMMING T DATE: DECEMBER, 2019 (MAIN EXAM ‘TIME: 2 HOURS INSTRUCTIONS: ANSWER ALL QUESTIONS IN SECTION A AND ANY OTHER TWO QUESTIONS IN SECTION B SECTION A QUESTION 1 (30 MARKS) Lar-Boplain how Object Oriented Programming iffer from Procedural Programming? (4 Marks) {oY Explain the types of vatlableas: (6 Marks) sed in C++ programming language ©) Using a C++ program, Show the two wa in which constants are declared (6 Marks) ) Write 2 C++ program that stores the integers 0 through 4 in an array. It then outputs the contents of the array elements ir reverse order. Use a for loop. (6 Marks) «) Explain the term class as used in Object Oriented Programming, (4 Marks) Paper One Pagel 4). Define the following terms as used in Object Oriented Programming: ’) Polymorphism ii) Inheritance (4 Marks) ‘QUESTION 2 (20 MARKS) 2) Give any five reasons for adopting Object Oriented Programming in program development. (5 Marks) b) With the use of appropriate sketches, demonstrate /nheritance as used in Object Oriented Programming, (5 Marks) ©) Using the loops and conditional statement write a java program to display the following (20 Marks) 10 UESTION 3 (20 MARKS) 2) Explain each of the following terms as used in Object Oriented Programming languages: i) Abstract class, (3 Marks) il) Size of (3 Marks) 'b) What is a control structure in programming? (4 Marks) i Design and writ a java program that allow the user o enter the mastn kg) and Height{ in metres), the program then comoute the body mass index (BMI) of Patient in hospital and output appropiate interpretation using the following table. (10 Marks) Pape On Page? Note The formulas mass(kg) BMI = (height(m)) [BMI RANGE-kg/m* interpretation loss than 15 seccianeensiaiiaa | Veryseverely underweight | I a butless than 160 | Severely underweight “Wom 160butTes than 385 idiimpn | ‘om 185 but ess than 25.0 Normal (healthy weight) [from 250 but less than 30.0 ‘Overweight [over30—— ee QUESTION 4 (20 MARKS) a) Define the term identifier and state any three rues to follow when naming an identifier (4 Marks) +b) Using appropriate examples differentiate between the following as used in object oriented programming i ii) Aclass and an objec ii) Alocal and a global variable (Marks) «) Asalesman for an insurance company earnsa basic salary, a house allowance and 2 commission of 59 for each policy sold. The basic salary is taxed at a rate of 30% ‘and the commission is taxed at a rate of 8.5%. Design an algorithm and write a C program that will accept the basic salary, the house allowance and the total policies sold by a salesman, the solution should determine and output the gross pay, total tax deductions and the net pay. (10 Marks) Page 3 QUESTION 5 (20 MARKS) a) Write a C++ program using for loop tha: descending order. ill display integers 1 through 20 in (10 Marks) ») Write @ C++ program that requests a stucent’s age from the user. The program should accept positive age only. Ifthe user enters a negative number, the program should throw an exception, and display a sting or message. (20 Marks) Paged \

You might also like