Courseiva
Knowledge + Practice
CertificationsVendorsCareer RoadmapsLabs & ToolsStudy GuidesGlossaryPractice Questions
C
Courseiva

Free IT certification practice questions with explained answers for CCNA, CompTIA, AWS, Azure, Google Cloud, and more.

Certification Practice Questions

CCNA practice questionsSecurity+ SY0-701 practice questionsAWS SAA-C03 practice questionsAZ-104 practice questionsAZ-900 practice questionsCLF-C02 practice questionsA+ Core 1 practice questionsGoogle Cloud ACE practice questionsCySA+ CS0-003 practice questionsNetwork+ N10-009 practice questions
View all certifications →

Product

CertificationsCertification PathsExam TopicsPractice TestsExam Dumps vs Practice TestsStudy HubComparisons

Company

AboutContactEditorial PolicyQuestion Writing PolicyTrust Center

Legal

Privacy PolicyTerms of Service

Courseiva is a free IT certification practice platform offering original exam-style practice questions, detailed explanations, topic-based practice, mock exams, readiness tracking, and study analytics for Cisco, CompTIA, Microsoft, AWS, and other technology certifications.

© 2026 Courseiva. Courseiva is operated by JTNetSolutions Ltd. All rights reserved.

Courseiva is an independent certification practice platform and is not affiliated with, endorsed by, or sponsored by Cisco, Microsoft, AWS, CompTIA, Google, ISC2, ISACA, or any other certification vendor. Vendor names and certification marks are used only to identify the exams learners are preparing for.

← Object-Oriented Programming practice sets

1Z0-811 Object-Oriented Programming • Complete Question Bank

1Z0-811 Object-Oriented Programming — All Questions With Answers

Complete 1Z0-811 Object-Oriented Programming question bank — all 0 questions with answers and detailed explanations.

61
Questions
Free
No signup
Certifications/1Z0-811/Practice Test/Object-Oriented Programming/All Questions
Question 1mediummultiple choice
Read the full Object-Oriented Programming explanation →

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?

Question 2easymultiple choice
Read the full Object-Oriented Programming explanation →

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

Question 3hardmultiple choice
Read the full Object-Oriented Programming explanation →

A class 'Base' has a method 'public void display() throws IOException'. Subclass 'Derived' overrides display(). Which exception specifications are allowed in the overriding method?

Question 4mediummultiple choice
Read the full Object-Oriented Programming explanation →

Which design principle is violated by making all fields public in a class?

Question 5hardmultiple choice
Read the full Object-Oriented Programming explanation →

Given: abstract class Shape { abstract void draw(); } class Circle extends Shape { void draw() {} } Which is true?

Question 6easymultiple choice
Read the full Object-Oriented Programming explanation →

Which is the correct way to call a superclass constructor from a subclass constructor?

Question 7mediummultiple choice
Read the full Object-Oriented Programming explanation →

A developer wants to prevent a method from being overridden. Which modifier should be used?

Question 8hardmulti select
Read the full Object-Oriented Programming explanation →

Which TWO statements are true about interfaces in Java?

Question 9mediummulti select
Read the full Object-Oriented Programming explanation →

Which THREE are benefits of using inheritance?

Question 10easymultiple choice
Read the full Object-Oriented Programming explanation →

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

Exhibit

Refer to the exhibit.
public class Employee {
    private String name;
    public Employee(String name) { this.name = name; }
    public String getName() { return name; }
}
public class Manager extends Employee {
    private int teamSize;
    public Manager(String name, int teamSize) {
        super(name);
        this.teamSize = teamSize;
    }
}
Question 11hardmultiple choice
Read the full Object-Oriented Programming explanation →

What is the result of: new Document().print();

Exhibit

Refer to the exhibit.
interface Printable {
    default void print() { System.out.println("Printable"); }
}
interface Showable {
    default void print() { System.out.println("Showable"); }
}
class Document implements Printable, Showable {
    // no override
}
Question 12mediummultiple choice
Read the full Object-Oriented Programming explanation →

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

Question 13mediumdrag order
Read the full Object-Oriented Programming explanation →

Arrange the steps to implement an interface in a Java class in the correct order.

Drag steps to the numbered slots on the right, or tap a step then tap a slot.

Steps
Order
1Step 1
2Step 2
3Step 3
4Step 4
5Step 5
Question 14mediummatching
Read the full Object-Oriented Programming explanation →

Match each Java exception class to its category.

Drag a concept onto its matching description — or click a concept then click the description.

Concepts
Matches

Runtime exception (unchecked)

Checked exception

Runtime exception (unchecked)

Checked exception

Runtime exception (unchecked)

Question 15mediummultiple choice
Read the full NAT/PAT explanation →

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

Question 16easymultiple choice
Read the full Object-Oriented Programming explanation →

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

Question 17hardmultiple choice
Read the full Object-Oriented Programming explanation →

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

Question 18mediummultiple choice
Read the full Object-Oriented Programming explanation →

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

Question 19hardmultiple choice
Read the full Object-Oriented Programming explanation →

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

Question 20easymultiple choice
Read the full Object-Oriented Programming explanation →

A security-sensitive class should not be extended by any other class. Which modifier should be applied to the class declaration?

Question 21mediummultiple choice
Read the full Object-Oriented Programming explanation →

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

Question 22hardmultiple choice
Read the full Object-Oriented Programming explanation →

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

Question 23easymultiple choice
Read the full Object-Oriented Programming explanation →

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?

Question 24easymulti select
Read the full Object-Oriented Programming explanation →

Which two of the following are fundamental principles of Object-Oriented Programming? (Choose two.)

Question 25hardmulti select
Read the full Object-Oriented Programming explanation →

A developer wants to achieve loose coupling between components. Which two practices support loose coupling? (Choose two.)

Question 26mediummulti select
Read the full Object-Oriented Programming explanation →

Which three statements about constructors in Java are true? (Choose three.)

Question 27mediummultiple choice
Read the full Object-Oriented Programming explanation →

Refer to the exhibit. What is the output when the following code is executed? Vehicle v = new Car(); v.accelerate(); System.out.println(v.speed);

Exhibit

public class Vehicle { protected int speed; public Vehicle() { speed = 0; } public void accelerate() { speed += 10; } } public class Car extends Vehicle { public void accelerate() { speed += 20; } }
Question 28easymultiple choice
Read the full Object-Oriented Programming explanation →

Refer to the exhibit. Why does the code fail to compile?

Exhibit

public class Test { public static void main(String[] args) { Animal a = new Animal(); a.sound(); } } abstract class Animal { abstract void sound(); }
Question 29hardmultiple choice
Read the full Object-Oriented Programming explanation →

Refer to the exhibit. What is the potential issue with this singleton implementation in a multithreaded environment?

Exhibit

public class Singleton { private static Singleton instance; private Singleton() {} public static Singleton getInstance() { if (instance == null) { instance = new Singleton(); } return instance; } }
Question 30easymultiple choice
Read the full Object-Oriented Programming explanation →

A developer wants to ensure that a class cannot be subclassed. Which keyword should be used?

Question 31mediummultiple choice
Read the full Object-Oriented Programming explanation →

A class has a method that is marked as protected. Which statement is true about its accessibility?

Question 32hardmultiple choice
Read the full Object-Oriented Programming explanation →

Consider the following interface: public interface Drawable { void draw(); } A developer implements Drawable in class Circle. Which statement about the implementation is correct?

Question 33easymultiple choice
Read the full Object-Oriented Programming explanation →

Which access modifier allows a member to be accessed only within the same class?

Question 34mediummultiple choice
Read the full Object-Oriented Programming explanation →

A developer writes: Object obj = new String("Hello"); System.out.println(obj.length()); What will be the output?

Question 35hardmultiple choice
Read the full Object-Oriented Programming explanation →

Which of the following best demonstrates polymorphism in Java?

Question 36easymultiple choice
Read the full Object-Oriented Programming explanation →

A class that does not define any constructor has:

Question 37mediummultiple choice
Read the full Object-Oriented Programming explanation →
class 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?

Question 38hardmultiple choice
Read the full Object-Oriented Programming explanation →

Which statement about abstract classes and interfaces is true in Java?

Question 39easymulti select
Read the full Object-Oriented Programming explanation →

Which TWO access modifiers allow access from a subclass in a different package?

Question 40mediummulti select
Read the full Object-Oriented Programming explanation →

Which THREE are true about Java constructors?

Question 41hardmulti select
Read the full Object-Oriented Programming explanation →

Which TWO statements about interfaces in Java are true?

Question 42mediummultiple choice
Read the full Object-Oriented Programming explanation →

Refer to the exhibit.

What is the output?

Exhibit

class Vehicle {
    String type = "Vehicle";
}
class Car extends Vehicle {
    String type = "Car";
}
public class Test {
    public static void main(String[] args) {
        Vehicle v = new Car();
        System.out.println(v.type);
    }
}
Question 43hardmultiple choice
Read the full Object-Oriented Programming explanation →

Refer to the exhibit.

What is the output?

Exhibit

interface Printable {
    void print();
}
class Document implements Printable {
    public void print() { System.out.println("Document"); }
}
class Photo extends Document {
    public void print() { System.out.println("Photo"); }
}
public class Test {
    public static void main(String[] args) {
        Document d = new Photo();
        d.print();
    }
}
Question 44easymultiple choice
Read the full Object-Oriented Programming explanation →

Refer to the exhibit.

What is the likely cause?

Exhibit

javac Test.java
Test.java:5: error: cannot find symbol
    System.out.println(value);
                        ^
  symbol:   variable value
  location: class Test
Question 45mediummultiple choice
Read the full Object-Oriented Programming explanation →

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

Question 46hardmultiple choice
Read the full Object-Oriented Programming explanation →

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

Question 47easymultiple choice
Read the full Object-Oriented Programming explanation →

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?

Question 48mediummultiple choice
Read the full NAT/PAT explanation →

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

Question 49easymultiple choice
Read the full Object-Oriented Programming explanation →

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:

Question 50hardmultiple choice
Read the full Object-Oriented Programming explanation →

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

Question 51mediummulti select
Read the full Object-Oriented Programming explanation →

Which TWO of the following are valid benefits of using inheritance in Java? (Choose two.)

Question 52hardmulti select
Read the full Object-Oriented Programming explanation →

Which THREE statements are true about interfaces in Java? (Choose three.)

Question 53easymulti select
Read the full Object-Oriented Programming explanation →

Which THREE are fundamental principles of Object-Oriented Programming? (Choose three.)

Question 54mediummultiple choice
Read the full Object-Oriented Programming explanation →

Refer to the exhibit. What is the problem with this class?

Exhibit

Consider the following Java class:

public class Employee {
    private String name;
    public Employee(String name) {
        name = name;
    }
    public String getName() {
        return name;
    }
}
Question 55hardmultiple choice
Read the full Object-Oriented Programming explanation →

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?

Question 56mediummultiple choice
Read the full Object-Oriented Programming explanation →

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

Question 57easymultiple choice
Read the full Object-Oriented Programming explanation →

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

Question 58mediummultiple choice
Read the full Object-Oriented Programming explanation →

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

Question 59mediummulti select
Read the full Object-Oriented Programming explanation →

Which TWO statements are true about the 'super' keyword in Java?

Question 60hardmultiple choice
Read the full Object-Oriented Programming explanation →

Refer to the exhibit. What is the output?

Exhibit

class Animal {
    public void sound() {
        System.out.println("Animal sound");
    }
}
class Dog extends Animal {
    public void sound() {
        System.out.println("Bark");
    }
    public void fetch() {
        System.out.println("Fetching");
    }
}
public class Test {
    public static void main(String[] args) {
        Animal a = new Dog();
        a.sound();
        ((Dog) a).fetch();
    }
}
Question 61easymultiple choice
Read the full Object-Oriented Programming explanation →

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

Practice tests

Scored 10-question sessions with instant feedback and explanations.

1Z0-811 Practice Test 1 — 10 Questions→1Z0-811 Practice Test 2 — 10 Questions→1Z0-811 Practice Test 3 — 10 Questions→1Z0-811 Practice Test 4 — 10 Questions→1Z0-811 Practice Test 5 — 10 Questions→1Z0-811 Practice Exam 1 — 20 Questions→1Z0-811 Practice Exam 2 — 20 Questions→1Z0-811 Practice Exam 3 — 20 Questions→1Z0-811 Practice Exam 4 — 20 Questions→Free 1Z0-811 Practice Test 1 — 30 Questions→Free 1Z0-811 Practice Test 2 — 30 Questions→Free 1Z0-811 Practice Test 3 — 30 Questions→1Z0-811 Practice Questions 1 — 50 Questions→1Z0-811 Practice Questions 2 — 50 Questions→1Z0-811 Exam Simulation 1 — 100 Questions→

Practice by domain

Each domain maps to a weighted exam section. Focus on the domain where you are weakest.

What is JavaJava Basics and SyntaxPrimitives, Strings and OperatorsControl Flow and LoopsArrays and MethodsObject-Oriented ProgrammingException Handling and Development Tools

Practice by scenario

Filter questions by type — troubleshooting, exhibit, drag-and-drop, PBQ, ACLs, OSPF, and more.

Browse scenarios→

Continue studying

All Object-Oriented Programming setsAll Object-Oriented Programming questions1Z0-811 Practice Hub