OOPS Fourth Unit — Important Questions & Answers (JNTUA Class Work Model): 20 MCQs
All 20 multiple-choice questions from this kit, free and with no sign-up.
Warm-up · 10 questions
Q1. Which keyword is used in Java to inherit from a class?
BeginnerAnswers and explanations are in the Veda app.
Q2. Inheritance in Java models which kind of relationship?
BeginnerAnswers and explanations are in the Veda app.
Q3. Which type of inheritance is NOT allowed through Java classes?
BeginnerAnswers and explanations are in the Veda app.
Q4. A class in Java can implement how many interfaces?
BeginnerAnswers and explanations are in the Veda app.
Q5. Which statement about constructors in inheritance is correct?
BeginnerAnswers and explanations are in the Veda app.
Q6. What must be the first statement in a subclass constructor?
BeginnerAnswers and explanations are in the Veda app.
Q7. Which methods cannot be overridden in Java?
BeginnerAnswers and explanations are in the Veda app.
Q8. Method overloading is resolved at which time?
BeginnerAnswers and explanations are in the Veda app.
Q9. Dynamic method dispatch selects the overridden method based on which type?
BeginnerAnswers and explanations are in the Veda app.
Q10. Java resolves overridden instance methods at runtime using the actual object type (dynamic method dispatch), while overloaded methods are resolved at compile time using the reference's static type.
BeginnerAnswers and explanations are in the Veda app.
Building up · 5 questions
Q11. Interface fields are implicitly which of the following?
IntermediateAnswers and explanations are in the Veda app.
Q12. Since Java 8, which method types may an interface contain?
IntermediateAnswers and explanations are in the Veda app.
Q13. You need unrelated classes to share a capability such as sorting. Which construct fits best?
IntermediateAnswers and explanations are in the Veda app.
Q14. An overriding method cannot do which of the following?
IntermediateAnswers and explanations are in the Veda app.
Q15. Which access modifier order is correct from narrowest to widest?
IntermediateAnswers and explanations are in the Veda app.
Topper level · 5 questions
Q16. A subclass in a different package inherits a `protected` method. How may it access that method?
AdvancedAnswers and explanations are in the Veda app.
Q17. Given the following classes, what will be the output of the code snippet when executed? ```java class Animal { void sound() { System.out.println("Animal sound"); } } class Dog extends Animal { void sound() { System.out.println("Bark"); } } class Cat extends Animal { void sound() { System.out.println("Meow"); } } public class Test { public static void main(String[] args) { Animal a = new Dog(); a.sound(); a = new Cat(); a.sound(); } } ```
AdvancedAnswers and explanations are in the Veda app.
Q18. Consider the following code snippet: ```java abstract class Vehicle { abstract void start(); void stop() { System.out.println("Vehicle stopped"); } } class Car extends Vehicle { void start() { System.out.println("Car started"); } } class Truck extends Vehicle { void start() { System.out.println("Truck started"); } } public class Main { public static void main(String[] args) { Vehicle v = new Car(); v.start(); v.stop(); v = new Truck(); v.start(); } } ```
AdvancedAnswers and explanations are in the Veda app.
Q19. What will happen if you try to compile the following code? ```java class Parent { void display() { System.out.println("Parent display"); } } class Child extends Parent { private void display() { System.out.println("Child display"); } } public class Test { public static void main(String[] args) { Parent p = new Child(); p.display(); } } ```
AdvancedAnswers and explanations are in the Veda app.
Q20. Evaluate the following code snippet and determine its output: ```java interface Animal { void eat(); } interface Mammal extends Animal { void walk(); } class Dog implements Mammal { public void eat() { System.out.println("Dog eats"); } public void walk() { System.out.println("Dog walks"); } } public class Test { public static void main(String[] args) { Mammal m = new Dog(); m.eat(); m.walk(); } } ```
AdvancedAnswers and explanations are in the Veda app.
Your notes can be a kit like these
Every kit here was made from real study material. Point Veda at a chapter, a PDF, a photo or a link and get notes, flashcards, practice MCQs, games and a scored test — free to start, in more than 40 languages.
- Chapter notes
- Flashcards
- Practice MCQs
- Scored tests
- Paper Solver
Get Veda free See what students get
Free to start · Android app and web · More than 40 languages