You are on page 1of 10

1) Composition is one of the fundamental concepts in object-oriented programming.

It describes
a class that references one or more objects of other classes in instance variables

I. Describe Composition using an example scenario. Draw a class diagram to support your
answer and provide the implementation using C#.Net.
II. Define the composite pattern by drawing a class diagram. The class diagram should
contains the Client class,Component class,Composite class and the Leaf class .
III. ABC Bank has a bank manager and three accountants and two cashiers. Below mentioned
the details of these employees,

Emp Id Name Position Salary


A001 Ben Bank Manager 5,000 $
A002 Mark Accountant 3,000 $
A003 Brayn Accountant 3,000 $
A004 Clef Accountant 3,000 $
A005 Cercy Cashier 1,000 $
A006 Lily Cashier 1,000 $

All the Accountants are working under the bank manager and Cercy(Cashier) is working under
the Mark(Accountant) and Lily(Cashier) is working under the Brayn(Accountat).
ABC bank is asking you to develop a system to display the details of all employees and your
system should display which employee is working under which employee clearly.
 Which design pattern is the most suitable one for the above mentioned scenario?
 Using the above mentioned Employee interface write the Java code to create the required
programme.
1. Which of following is shared structure of a set of similar objects

 Encapsulation

 A Class

 Inheritance

 None of Above

2. Which of following does not have a body

 An Interface

 A Class

 An Abstract Method

 none of above

3. Which of following is pure object oriented programming language?

 Java

 SmallTalk
 C++

 Kotlin

4. In oops public, private & protected are

 Classes

 Access Modifiers

 Interfaces

 Method signature

5. A private member of a class is visible to

 every where

 in sub class

 members to same package

 only members of same class

6. Which keyword is used to inherit a class or abstract class is

 extends
 extend

 implement

 inherit

7. Which of the following is an abstract data type?

 Double

 String

 Int

 Class

8. Can we overload constructor in derived class?

 Yes

 No

View Answer

9. Which of the following is not related to OOPS?

 Class and Object


 Constructor and Destructor

 Structure and Union

 Inheritance and Polymorphism

10. We can not create instance of

 Anonymous class

 Nested class

 Parent class

 Abstract class

11. Constructor can return a value

 True

 False

12. OOPs is invented by _______

 Andrea Ferro

 Dennis Ritchie
 Adele Goldberg

 Alan Kay

13. Which of the following is correct for copy constructor?

 The argument object is passed by reference

 It can be defined with zero arguments

 Used when an object is passed by value to a function

 Used when a function returns an object

14. Which Feature of OOP encourges the code reusability?

 Polymorphism

 Inheritance

 Abstraction

 Encapsulation

15. Which is correct syntax for creating an object of Class in Java?


 classname objectname= new() integer;

 classname objectname= new() classname()

 classname objectname= new classname;

 classname objectname= new classname()

16. Which language doesn't support single level inheritance?

 C lanaguage

 Java

 Kotlin

 C++

17. Which of the following is not the member of class?

 Static function

 Friend function

 Const function

 Virtual function

18. Which of the following is universal class for exception handling?


 Object

 Errors

 Exceptions

 Maths

19. Which among the following handles the undefined class exception in
program?

 ClassNotFound

 NoClassException

 ClassFoundException

 ClassNotFoundException handles the undefined class exception in program

20. How many catch blocks you can use with single Try block?

 Only 2

 Only 1

 Maximum 256

 As many as required
(MCQ 20 * 1 = 20 marks , 1 Eassy Question =30 marks)

You might also like