Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Course: ICE 1201 Object Oriented Design and Programming

Class Test 2
Name: Id: Date:

1. Which of the following is false for interface -

a) It can have b) It can have c) It can have d) It can not be


abstract constructor static instantiated
method variable
2. If Car is the parent class with a variable name and method run(), which of the following can
be used by its child class, BMW to call the parent class constructor-
a) super.run() b) super.name c) Car.super() d) super()
3. Java interface does not provide -
a) Complete b) Loose coupling c) Tight d) Easy
abstraction coupling extension of
code
4. Multi level inheritance refers -
a) Multiple b) Multiple parents in c) Multiple d) None
parents in same level / parallel childs in
sequential same level /
parallel
5. If Car is the superclass and Audi and BMW are two child classes, then which is incorrect -
a) Audi a = new Audi()
b) Car c = new BMW()
c) BMW b = new Audi()
d) Car c = new Car()

6. Explain how multiple inheritance is supported by java interface.


7. Design an interface named as HostipalManagement. The interface will have following features-
• A public string variable named as will offeredBy and having value “XYX company”
• A method declaration named as receiptionService which prints the receiption details.
• A method declaration named as makeAppointment which takes a patientName and
doctorName as input to set appointment and returns the appointment date.
• A method declaration named as getDoctors which will return the list of doctors
available at the hospital.
Now, create a consumer class named as BUPMedicalCenter which use the above designed
interface. Also write down the Runner class to show how the services can be called.

You might also like