20+ practice questions focused on Object-Oriented Programming — one of the most tested topics on the Oracle Java Foundations 1Z0-811 exam. Each question includes a detailed explanation so you learn why the right answer is correct.
Start Object-Oriented Programming PracticeWhat is the result of: new Document().print();
Explanation: The code fails to compile because the class `Document` likely implements two interfaces, such as `Printable` and `Showable`, each declaring a default `print()` method. This creates a diamond problem where the compiler cannot determine which default method to use, resulting in a compilation error unless `Document` overrides `print()`. The error occurs at compile time, not runtime.
In a banking application, a class 'Account' has private field 'balance' and public methods 'getBalance()' and 'setBalance(double)'. This is an example of which OOP principle?
Explanation: Encapsulation hides internal data (the 'balance' field) and provides controlled access via public methods 'getBalance()' and 'setBalance(double)'. Option A is wrong because abstraction focuses on hiding implementation complexity rather than data protection; the example demonstrates data hiding which is encapsulation. Option B is wrong because inheritance involves a parent-child class relationship, which is not shown. Option C is wrong because polymorphism requires method overriding or overloading, which is not present here.
A team is developing a large-scale e-commerce platform using Java. They have a class hierarchy: Product (abstract), Electronics, Clothing, Food. Each product has a discount method that applies different logic. The team notices that whenever a new product type is added, they must modify the existing discount calculation logic in multiple places, leading to high maintenance costs. They want to refactor to follow the Open/Closed Principle. Which approach should they take?
Explanation: Defining an interface Discountable with a calculateDiscount() method and having each product class implement it allows adding new product types without modifying existing code. Option B is wrong because it violates OCP by requiring changes to if-else checks. Option C is wrong because it uses reflection unnecessarily and still requires modification when new types are added. Option D is wrong because it uses a switch statement in a utility class, which also requires modification when new product types are added, violating OCP.
A developer writes a class 'Vehicle' with a method 'move()' that prints 'Vehicle moves'. A subclass 'Car' overrides 'move()' to print 'Car moves'. Given: Vehicle v = new Car(); v.move(); What is the output?
Explanation: Java uses dynamic method dispatch (runtime polymorphism). Even though the reference variable is of type 'Vehicle', the actual object is a 'Car' instance. At runtime, the JVM calls the overridden 'move()' method of the 'Car' class, printing 'Car moves'.
In a banking application, a class 'Account' has a private field 'balance'. Which is the best way to allow subclasses to read but not directly modify 'balance'?
Explanation: It follows encapsulation: a public getBalance() method provides read-only access to the private balance field. Subclasses cannot directly modify balance because it is private. Option D (protected) is incorrect because protected access allows subclasses to directly read and write the field, which violates the requirement that subclasses should not be able to directly modify balance.
+15 more Object-Oriented Programming questions available
Practice all Object-Oriented Programming questions1. Baseline your knowledge
Start with 10 questions to gauge your current understanding of Object-Oriented Programming. This tells you whether you need a concept refresher or just practice.
2. Review every explanation
For each question — right or wrong — read the full explanation. Understanding why an answer is correct is more valuable than knowing the answer itself.
3. Focus on exam traps
Object-Oriented Programming questions on the 1Z0-811 frequently use trap wording. Look for subtle differences in answers that test your precision, not just general knowledge.
4. Reach 80% consistently
Do repeated sessions until you score 80%+ three times in a row. Then move to mixed-mode practice to test cross-topic recall under realistic conditions.
The exact number varies per candidate. Object-Oriented Programming is tested as part of the Oracle Java Foundations 1Z0-811 blueprint. Practicing with targeted Object-Oriented Programming questions ensures you can handle any format or difficulty that appears.
Yes. Courseiva provides free 1Z0-811 practice questions across all exam topics and domains. The platform includes topic-based practice, mock exams, missed-question review, bookmarked questions, and readiness tracking — no account required.
Difficulty is subjective, but Object-Oriented Programming is a high-priority exam concept tested in multiple ways — direct recall, scenario analysis, and command-output interpretation. Consistent practice is the best way to build confidence.
Launch a full Object-Oriented Programming practice session with instant scoring and detailed explanations.
Start Object-Oriented Programming Practice →