Class Test 2 - Sec B

You might also like

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. Define and Explain Static Nested Class with example.


7. Design an abstract class named as Bank which will have following features –
• Declare a public String variable named as bankName.
• Add a method declaration and implementation named as prepareCheque which will
take the accountNumber and amount as input and will return the cheque number.
• Add a method declaration and implementation named as getBranches which will return
the list of branches the bank have in the country.
• Add a method declaration only named as getInterestRate that will calculate the interest
of a bank and return it.
Now, create a class named as BUPBank that will inherit the above abstract class and override
the necessary information. Also write down the Runner class to show how the methods can be
called.

You might also like