Practice 1Z0-811 Object-Oriented Programming questions with full explanations on every answer.
Start practicing
Object-Oriented Programming — choose a session length
Free · No account required
Click any question to see the full explanation and answer options, or start a focused practice session above.
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?
2In 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'?
3A class 'Base' has a method 'public void display() throws IOException'. Subclass 'Derived' overrides display(). Which exception specifications are allowed in the overriding method?
4Which design principle is violated by making all fields public in a class?
5Given: abstract class Shape { abstract void draw(); } class Circle extends Shape { void draw() {} } Which is true?
6Which is the correct way to call a superclass constructor from a subclass constructor?
7A developer wants to prevent a method from being overridden. Which modifier should be used?
8Which TWO statements are true about interfaces in Java?
9Which THREE are benefits of using inheritance?
10What is the output of: System.out.println(new Manager("Alice", 5).getName());
11What is the result of: new Document().print();
12A development team is building a library management system. The system has classes 'LibraryItem', 'Book', and 'DVD'. LibraryItem has a method 'getTitle()' that returns the title. Book and DVD extend LibraryItem. The team wants to ensure that when a LibraryItem is borrowed, a message specific to its type is displayed. They have a 'Borrower' class with a method 'borrow(LibraryItem item)', which currently calls 'item.getTitle()' and prints the title. Now they need to display 'Book borrowed' or 'DVD borrowed' based on the actual item type. They want to avoid using 'instanceof' checks in the 'borrow' method to keep it open for new item types. Which design should they use?
13Arrange the steps to implement an interface in a Java class in the correct order.
14Match each Java exception class to its category.
15A company is developing a configuration manager that must be shared across all components to ensure consistent settings. The manager should prevent direct instantiation and provide a single access point. Which design pattern and implementation should be used?
16A junior developer writes a method that attempts to modify a String: public void update() { String s = "Hello"; s.concat(" World"); System.out.println(s); } What will be printed when update() is called?
17A banking application has a base class 'Account' with a method 'withdraw()' marked as final. A subclass 'SavingsAccount' tries to override 'withdraw()'. What is the outcome?
18A company's HR system uses an Employee class with sensitive salary information. The team wants to allow other classes to read the salary but not modify it. Which approach best preserves encapsulation?
19A developer creates an interface 'Drawable' with a single abstract method 'draw()'. They then create a class 'Circle' that implements Drawable but forgets to provide the draw() method. Circle is not declared abstract. What will happen when compiling Circle?
20A security-sensitive class should not be extended by any other class. Which modifier should be applied to the class declaration?
21A logging utility class keeps track of the number of log entries using a static integer variable. The class is instantiated multiple times in the application. How does the count variable behave?
22A calculator class has two overloaded methods: add(int a, int b) and add(double a, double b). A call to add(3, 4) will invoke which method?
23A 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?
24Which two of the following are fundamental principles of Object-Oriented Programming? (Choose two.)
25A developer wants to achieve loose coupling between components. Which two practices support loose coupling? (Choose two.)
26Which three statements about constructors in Java are true? (Choose three.)
27Refer to the exhibit. What is the output when the following code is executed? Vehicle v = new Car(); v.accelerate(); System.out.println(v.speed);
28Refer to the exhibit. Why does the code fail to compile?
29Refer to the exhibit. What is the potential issue with this singleton implementation in a multithreaded environment?
30A developer wants to ensure that a class cannot be subclassed. Which keyword should be used?
31A class has a method that is marked as protected. Which statement is true about its accessibility?
32Consider the following interface: public interface Drawable { void draw(); } A developer implements Drawable in class Circle. Which statement about the implementation is correct?
33Which access modifier allows a member to be accessed only within the same class?
34A developer writes: Object obj = new String("Hello"); System.out.println(obj.length()); What will be the output?
35Which of the following best demonstrates polymorphism in Java?
36A class that does not define any constructor has:
37class Parent { void show() { System.out.print("Parent"); } } class Child extends Parent { void show() { System.out.print("Child"); } } public class Test { public static void main(String[] args) { Parent p = new Child(); p.show(); } } What is the output?
38Which statement about abstract classes and interfaces is true in Java?
39Which TWO access modifiers allow access from a subclass in a different package?
40Which THREE are true about Java constructors?
41Which TWO statements about interfaces in Java are true?
42Refer to the exhibit. What is the output?
43Refer to the exhibit. What is the output?
44Refer to the exhibit. What is the likely cause?
45A developer wants to create a class that can be used to represent different types of vehicles (e.g., Car, Truck, Motorcycle) and each vehicle type should be able to start its own engine in a specific way. Which OOP concept should be used to allow the vehicle class to define a common interface while letting subclasses provide specific implementations?
46A Java class named 'Helper' is defined in package 'utils'. Another class in a different package tries to access a public method of Helper but receives a compilation error. The Helper class is declared as 'class Helper' (without public modifier). What is the likely issue?
47In 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?
48A team is designing a system where a 'Report' class can be generated in different formats (PDF, Excel, HTML). They want to avoid modifying the Report class when adding new formats. Which OOP principle or pattern should they use?
49A 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:
50A Java application uses an interface 'Drawable' with a default method 'draw()'. A class 'Circle' implements Drawable but does not override draw(). Another class 'Square' implements Drawable and overrides draw(). Which statement is true about calling draw() on instances of Circle and Square?
51Which TWO of the following are valid benefits of using inheritance in Java? (Choose two.)
52Which THREE statements are true about interfaces in Java? (Choose three.)
53Which THREE are fundamental principles of Object-Oriented Programming? (Choose three.)
54Refer to the exhibit. What is the problem with this class?
55A 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?
56A developer is working on a Java application that processes sensor data. The code uses a class 'SensorDataProcessor' which directly instantiates specific sensor classes like 'TemperatureSensor' and 'PressureSensor' inside its methods. The team wants to make the system extensible to support new sensor types without modifying the processor class. Which design change best achieves this?
57A junior developer created a class 'BankAccount' with public fields for balance and account number. After deployment, users are able to set negative balances, causing issues. Which OOP principle should have been applied to prevent this?
58In a Java application, a class 'OrderProcessor' contains a method that processes orders. The method currently handles multiple responsibilities: validating order data, calculating totals, updating inventory, and sending notifications. The team wants to refactor this method to follow the Single Responsibility Principle. Which action should they take?
59Which TWO statements are true about the 'super' keyword in Java?
60Refer to the exhibit. What is the output?
61A company develops a payroll system in Java with a hierarchy: Employee, Manager (extends Employee), and Director (extends Manager). Each class overrides a method getDetails() that returns a string with employee information. Employee's getDetails() returns name and ID. Manager's getDetails() adds department. Director's getDetails() adds division. The system uses a single method printDetails(Employee e) that calls e.getDetails(). After a recent deployment, the system prints only the name and ID for all employees, even for managers and directors. The code review reveals that Employee's getDetails() is declared with default (package-private) access, while the overridden versions in Manager and Director are public. The printDetails method and the Manager/Director classes are in different packages. What is the most likely cause and the correct solution?
The Object-Oriented Programming domain covers the key concepts tested in this area of the 1Z0-811 exam blueprint published by Oracle. Courseiva provides free domain-focused practice, mock exams, missed-question review, and readiness tracking across all 1Z0-811 domains — no account required.
The Courseiva 1Z0-811 question bank contains 61 questions in the Object-Oriented Programming domain. Click any question to see the full explanation and answer breakdown.
Start with a 10-question focused session to identify your baseline accuracy in this domain. Read every explanation — even for questions you answer correctly — to understand the reasoning. Once you score consistently above 80%, move to a 20–30 question session to confirm depth before moving to the next domain.
Yes — the session launcher on this page draws questions exclusively from the Object-Oriented Programming domain. Choose 10, 20, 30, or 50 questions for a focused session, or click individual questions to review them one by one.
Save your results, see per-domain analytics, and get readiness scores — free, for every certification.
Sign Up FreeFree forever · Every certification included