To implement an interface called: Car, for a class called: Truck, do you have to implement all empty methods listed in the interface? you found the newly implemented class does not contain all the require methods, can you write additional methods in the new class? ANS: Cycle Yes No ANS: Cycle Yes No Can a class implement more than one interface? ANS Can a class extends more than one super class? ANS ANS ANS; circle Yes or No ANS: circle Yes or No When you implement an interface, can you skip any methods in the interface that you have no use in the implemented class? When you implement an interface, can you add more methods in the implemented class? ANS; circle Yes or No ANS; circle Yes or No Refer to book chapter 8, which of the following lines are legal and which are illegal? The class Undergraduate is a derived class of Student, and derived class of Person. 30.1 Person p = new Student(); ANS: (circle one: Legal or Illegal) 30.2 Person p2 = new Undergraduate(); ANS: (circle one: Legal or Illegal) 30.3 Student s2 = new Person(); ANS: (circle one: Legal or Illegal) 30.4 Student s2 = new Undergraduate (); ANS: (circle one: Legal or Illegal) 30.5 Undergraduate ug1 = new Person(); ANS: (circle one: Legal or Illegal) 30.6 Undergraduate ug2 = new Student(); ANS: (circle one: Legal or Illegal) 30.7 Object obj = new Student(); ANS: (circle one: Legal or Illegal) 30.8 Student s3 = new Object(); ANS: (circle one: Legal or Illegal) Does a derived class (subclass, children class) inherit any constructors from the base class (super class, parent class)? ANS: circle Yes or No
36)
1)Ans)yes
Reason:
Its mandatory to implement all the methods of the interface in its implementation classes.But in ncase of abstract classes its not mandatory to implement all the methods of the abstract class in its subclasses.If any of the method are not implemented they can be declared as abstract.
2)Ans)yes
We can add additional methods to the newly implemented class from an interface
37)
1)Ans)yes
We can implement more than one interface from one java class.java suports multiple implementations.
2)Ans)No
But we cannot extends multiple super classes .Java doesnt supports multiple inheritance
38)
1)ans)No
Its mandatory we have to implement all the methods in the interface in its implementation classes.
2)ans)yes
We can add more methods in implementation classes of an interface
39)
30.1) is legal
30.2)is legal
30.3) is illegal
30.4)is Legal
30.5)is illegal
30.6)is illegal
30.7)is legal
30.8)is illegal
40)
Ans)No
Reason:
all members of the super class can be inherited by the sub class.when coming to the constructors of super class,as they are not members they are not inherited by the sub classes.
But we can invoke the super class contsrutor from then subclss by using the keyword \"super\".
___________________Thank You