Get premium membership and access revision papers, questions with answers as well as video lessons.

Ins 323: Object - Oriented Technology Question Paper

Ins 323: Object - Oriented Technology 

Course:Bachelor Of Science In Information Science

Institution: Moi University question papers

Exam Year:2015



MOI UNIVERSITY
OFFICE OF THE CHIEF ACADEMIC OFFICER
UNIVERSITY EXAMINATIONS
2014/2015 ACADEMIC YEAR
THIRD YEAR FIRST SEMESTER EXAMINATION
FOR THE DEGREE OF
BACHELOR OF SCIENCE
IN
INFORMATION SCIENCES
COURSE CODE: INS 321
COURSE TITLE: OBJECT - ORIENTED TECHNOLOGY
DATE: 13TH APRIL, 2015 TIME: 2.00 P.M. – 4.15 P.M.

INSTRUCTION TO CANDIDATES
• SEE INSIDE



THIS PAPER CONSISTS OF (2) PRINTED PAGES PLEASE TURN OVER
MOI UNIVERSITY
SCHOOL OF INFORMATION SCIENCES
DEPARTMENT OF INFORMATION TECHNOLOGY
FIRST SEMESTER 2014/2015 ACADEMIC YEAR EXAMINATIONS
COURSE CODE: INS 321
COURSE TITLE: OBJECT - ORIENTED TECHNOLOGY TIME: 2 Hrs 15 Mins
==============================================================================
INSTRUCTIONS TO CANDIDATES:
• Answer question ONE and any other TWO questions
• If required to write program code, use your favorite programming language

Question 1 Compulsory (20 Marks)
1. Which of the following type class allows only one object of it to be created?
A. Virtual class
B. Abstract class
C. Singleton class
D. Friend class
2. Which of the following statements is correct?
A. Base class pointer cannot point to derived class object
B. Derived class pointer cannot point to base class object
C. Pointer to derived class cannot be created
D. Pointer to base class cannot be created
3. The cod outside a class should not have access to certain members of the class. Which OOP concept is this?
A. Encapsulation
B. Information hiding
C. Abstraction
D. Implementation hiding
4. Which of the following statements is correct?
A. A constructor is called at the time of declaration of an object
B. A constructor is called at the time of use of an object
C. A constructor is called at the time of declaration of a class
D. A constructor is called at the time of use of a class
5. Which of the following concepts means wrapping data and functions together?
A. Abstraction
B. Encapsulation
C. Inheritance
D. Polymorphism
6. Which of the following concepts means waiting until runtime to determine which member function to call?
A. Late binding
B. Lazy binding
C. Dynamic binding
D. Runtime binding
7. What happens if the base and derived class contains definition of a function with same prototype?
A. Only base class function will get called irrespective of object
B. Only derived class function with get called irrespective of object
C. Base class object will only call base class function
D. Derived class object will only call derived class function
8. Which one of the following is the correct way to declare a pure virtual function?
A. virtual void Display (void) (0);
B. virtual void Display = 0;
C. virtual void Display (void) = 0;
D. void Display(void) = 0;
9. Which inheritance type is used in the class given below?
Class A : public X, public Y
{}
A. Multilevel inheritance
B. Multiple inheritance
C. Hybrid inheritance
D. Hierarchical inheritance
10. Which of the following is used to make an abstract class?
A. Declaring it abstract using static keyword
B. Declaring it abstract using virtual keyword
C. Making at least one member function as virtual function
D. Making at least one member function as pure virtual function
11. What happens when we try to compile the class definition in the following code snippet?
class Birds {};
class Peacock : protected Birds ();
A. It will not compile because class body of Birds is not defined
B. It will not compile because class body of Peacock is not defined
C. It will not compile because a class cannot be protectedly inherited from other class
D. It will compile successfully
12. Which of the following two entities (reading from Left to Right) can be connected by the dot operator?
A. A class and a class member of the class
B. An object and an instance member of the class the object belongs to
C. A class and an instance member of the class
D. An object and a class member of the class the object belongs to
13. Which of the following statements is correct when a class is inherited privately?
A. Public members of the class become protected members of derived class
B. Public members of the base class become private members of derived class
C. Private members of the base class become private members of derived class
D. Public members of the base class become public members of derived class
14. Which of the following can access private data members or members functions of a class?
A. Any function in the program
B. All global functions in the program
C. Any member function of that class
D. Only public member functions of that class
15. Which of the following type of data member can be shared by all instances of its class?
A. Public
B. Inherited
C. Static
D. Friend
16. Which of the following concepts means “The use of an object of one class in definition of another class”?
A. Encapsulation
B. Abstraction
C. Inheritance
D. Composition
17. Which of the following statements are correct for a static member function?
1.It can access only other static members of its class
2.It can be called using the class name, instead of objects
A. Only 1 is correct
B. Only 2 is correct
C. Both 1 and 2 are correct
D. Both 1 and 2 are incorrect
18. For automatic objects, constructors and destructors are called each time the objects
A. Enter and leave scope
B. Inherit parent class
C. Are constructed
D. Are destroyed
19. How many times is a constructor called in the life-time of an object?
A. Only once
B. Twice
C. Thrice
D. Depends on the way of creation of object
20. Which of the following statements is NOT correct?
A. A destructor has the same name as the class in which it is present
B. A destructor has a different name than the class in which it is present
C. A destructor always returns an integer
D. A destructor can be overloaded


Question 2 (20 Marks)
a) Many services that implement a client-server architecture require that users log in using their user name and a password. Write a class with two instance variables to store a predefined username and password. The two variables are initialized by a two-parameter constructor. [5 marks]
b) To the class in part a) above, add a member function that receives the two user inputs and responds appropriately, allowing at most three wrong attempts. [5 marks]
c) Write a modified version of the function in part b) above that tells the user whichever is wrong of the input parameters each time the user makes a wrong entry. [10 marks]
Question 3 (20 Marks)
a) A class that represents a student has four data members, one to store the student’s admission number and the other three to store values of marks in three subjects for the student.
i. Write the class [5 marks]
ii. Add a member function that returns the average marks of the student [5 marks]
iii. Add a member function that returns the grade of the student based on the following criteria: [5 marks]
Marks Grade
0 – 39 F
40 – 49 D
50 – 59 C
60 – 69 B
70 – 100 A

b) Write a function that receives an array of objects of the class in a) above and returns the admission number of the student with the highest average mark. [5 marks]
Question 4 (20 Marks)
a) A class represents s person who belongs to a SACCO has three data members, one to store the account number of the member and the other two store values of the two loans the person owes the SACCO. These are initialized by a three-parameter constructor.
i. Write the class [5 marks]
ii. Add a member function that reduces the amount of the first loan by the value of the single argument passed to it. [5 marks]
iii. Add a member function that returns the sum of money that the member this object refers to owes the SACCO. [5 marks]
b) Write a function that receives an array of objects of the class in a) above and returns the total amount of loan stored in those objects. [5 marks]


Question 5 (20 Marks)
A class that represents a voter at the August 4, 2010 referendum on the New Constitution has three data members, the first to store the voter’s ID number, the second to store the voter’s voter registration number and the third to store the voter’s choice( i.e YES or NO).
a) Write the class [5 marks]
b) Add a parameterized constructor that initializes all the data members using the three values passed as arguments [5 marks]
c) Write a function that receives an array of voters as an argument and prints a table of three columns where each row id the information stored in the three data members [5 marks]
d) Modify the function in the previous exercise to also print the total amount of voters voting “YES” and the total of those voting “NO” at the end of the table. [5 marks]






More Question Papers


Popular Exams



Return to Question Papers