Courseiva
Object-Oriented ProgrammingeasyMultiple ChoiceObjective-mapped

1Z0-811 Object-Oriented Programming Practice Question

A class 'Animal' has a method 'makeSound()'. Subclasses 'Dog' and 'Cat' override it. When calling makeSound() on an Animal reference that actually holds a Dog object, the Dog's version is executed. This is an example of:

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

Dynamic binding

Dynamic binding. Dynamic binding (runtime polymorphism) resolves method calls based on the actual object type at runtime, not the reference type. Here, the Animal reference holds a Dog object, so the Dog's overridden makeSound() is invoked. A is wrong because static binding occurs at compile-time for methods that cannot be overridden (e.g., static, final, or private). B is wrong because encapsulation hides data, not method dispatch. D is wrong because method overloading is compile-time polymorphism based on method signature.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Static binding

    Why it's wrong here

    Static binding occurs for static, private, and final methods at compile time.

  • Encapsulation

    Why it's wrong here

    Encapsulation is about data hiding, not method resolution.

  • Dynamic binding

    Why this is correct

    Method call is determined at runtime based on the object's class.

  • Method overloading

    Why it's wrong here

    Overloading is based on method parameters, not inheritance.

Visual reference

Client Recursive Resolver Root DNS (13 root servers) TLD DNS (.com, .org, …) Authoritative example.com query IP addr answer

About these practice questions

This 1Z0-811 question is part of Courseiva's 481-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Same concept, more angles

2 more ways this is tested on 1Z0-811

These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.

Variation 1. What is the output of: System.out.println(new Manager("Alice", 5).getName());

easy
  • A.Runtime exception
  • B.Compilation fails
  • C.Alice
  • D.null

Why C: The code creates a new Manager object with the name "Alice" and a level of 5, then calls getName() on it. Assuming Manager extends a class (likely Employee) that has a constructor setting the name field via super(name), getName() returns the stored name "Alice". The code compiles and runs without exception, printing "Alice".

Variation 2. A developer writes a class 'Animal' with a method 'sound()'. The 'Cat' subclass overrides 'sound()'. If an Animal reference points to a Cat object, which method is called when sound() is invoked?

easy
  • A.Runtime error
  • B.Cat's sound()
  • C.Animal's sound()
  • D.Compilation error

Why B: Polymorphism ensures that the overridden method in the actual object's class is called at runtime, even if the reference is of the superclass type.

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This 1Z0-811 practice question is part of Courseiva's free Oracle certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the 1Z0-811 exam.