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?

Beginner
A `super`
B `inherits`
C `implements`
D `extends`

Answers and explanations are in the Veda app.

Q2. Inheritance in Java models which kind of relationship?

Beginner
A A has-a relationship
B A uses-a relationship
C An is-a relationship
D A part-of relationship

Answers and explanations are in the Veda app.

Q3. Which type of inheritance is NOT allowed through Java classes?

Beginner
A Single inheritance
B Multilevel inheritance
C Multiple inheritance
D Hierarchical inheritance

Answers and explanations are in the Veda app.

Q4. A class in Java can implement how many interfaces?

Beginner
A Only interfaces in the same package
B At most two
C Any number of interfaces
D Only one

Answers and explanations are in the Veda app.

Q5. Which statement about constructors in inheritance is correct?

Beginner
A Constructors are inherited only if they are `public`
B Constructors are inherited by subclasses
C Subclass constructors run before superclass constructors
D Constructors are not inherited but are always invoked, superclass first

Answers and explanations are in the Veda app.

Q6. What must be the first statement in a subclass constructor?

Beginner
A A `print` statement
B A field declaration
C A `return` statement
D `this()` or `super()`

Answers and explanations are in the Veda app.

Q7. Which methods cannot be overridden in Java?

Beginner
A `static`, `final`, and `private` methods
B Methods with a `void` return type
C Instance methods
D Methods with parameters

Answers and explanations are in the Veda app.

Q8. Method overloading is resolved at which time?

Beginner
A Compile time, using the reference's static type
B After the first call
C Runtime, using the actual object type
D Link time

Answers and explanations are in the Veda app.

Q9. Dynamic method dispatch selects the overridden method based on which type?

Beginner
A The declared return type
B The access modifier
C The actual object type
D The reference type

Answers 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.

Beginner
A True
B False

Answers and explanations are in the Veda app.

Building up · 5 questions

Q11. Interface fields are implicitly which of the following?

Intermediate
A `protected static`
B `private final`
C `public static final`
D `public abstract`

Answers and explanations are in the Veda app.

Q12. Since Java 8, which method types may an interface contain?

Intermediate
A Only `private` methods
B Constructors and final methods
C Only abstract methods
D `default` and `static` methods

Answers and explanations are in the Veda app.

Q13. You need unrelated classes to share a capability such as sorting. Which construct fits best?

Intermediate
A An abstract class with a shared field
B An interface such as `Comparable`
C A `final` superclass
D A package-private class

Answers and explanations are in the Veda app.

Q14. An overriding method cannot do which of the following?

Intermediate
A Return a subtype of the parent's return type
B Call `super.method()`
C Reduce the visibility of the parent method
D Have the same parameter list

Answers and explanations are in the Veda app.

Q15. Which access modifier order is correct from narrowest to widest?

Intermediate
A default → `private` → `public` → `protected`
B `private` → `protected` → default → `public`
C `private` → default → `protected` → `public`
D `public` → `protected` → default → `private`

Answers 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?

Advanced
A Through any parent reference
B It cannot access it at all
C Only through `this` or a subclass reference
D Only after making it `public`

Answers 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(); } } ```

Advanced
A Animal sound Bark
B Animal sound Meow
C Bark Meow
D Bark Animal sound

Answers 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(); } } ```

Advanced
A Vehicle stopped Car started Truck started
B Vehicle stopped Truck started Car started
C Car started Truck started Vehicle stopped
D Car started Vehicle stopped Truck started

Answers 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(); } } ```

Advanced
A It will compile and print 'Parent display'
B It will compile and print 'Child display'
C It will compile but throw a runtime exception
D It will not compile due to access modifier conflict

Answers 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(); } } ```

Advanced
A It will not compile due to interface conflict
B Dog eats Dog walks
C Dog walks Dog eats
D Animal eats Mammal walks

Answers and explanations are in the Veda app.

Make your own

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