• Skip to main content
  • Skip to secondary menu
  • Skip to primary sidebar

JavaTutorOnline

1-on-1 Online Java Training by a Senior Software Engineer

  • Home
  • AP CSA
    • FRQ Practice
      • Arrays
      • ArrayList
      • Strings
      • 2D Arrays
  • Courses
  • Tutorials
    • Java
    • Servlets
    • Struts
    • Spring
    • Webservice
  • FAQ
  • Testimonials
  • Blog
  • CONTACT US

Inheritance & Polymorphism FRQs: AP CSA Practice | JavaTutorOnline

AP Computer Science A Inheritance and Polymorphism FRQ Practice banner with Java solutions

Polymorphism, Interfaces, and Inheritance are foundational Object-Oriented Programming (OOP) concepts. While these topics were historically a major part of the AP Computer Science A exam (frequently appearing in Question 2), the College Board officially removed the standalone inheritance unit and polymorphism from the required curriculum starting with the 2025-2026 syllabus. The new AP CSA course structure now prioritizes foundational class creation, algorithmic problem-solving, and real-world data processing like text file I/O.

However, these topics remain essential knowledge for introductory college programming courses and are highly recommended for enrichment. This master guide provides 15 high-quality Free Response Questions (FRQs) sequenced strictly from Easy (1–4) to Medium (5–10) to Hard (11–15). While no longer explicitly tested on the AP exam, working through these complete class definitions, step-by-step logic puzzles, and full Java solutions will drastically improve your object-oriented design skills.


AP CSA Interfaces & Polymorphism Quick Cheat Sheet

ConceptSyntax / KeywordKey AP Exam Rule
Defining an Interfacepublic interface NameInterfaces contain only method signatures. They cannot contain instance variables or method bodies.
Interface Methodsint getScore();Methods inside an interface are automatically public and abstract. Do not write method bodies { }.
Implementingpublic class Sub implements SuperA concrete class must provide an implementation (override) for every method defined in the interface.
InstantiationInterface obj = new Interface();ILLEGAL. You cannot instantiate an interface directly. You must instantiate a class that implements it.
PolymorphismList<Item> list = new ArrayList<>();An interface reference can hold any object of a class that implements that interface.



FRQ 1 — Defining a Standard Interface

Easy

Problem Description:
Write an interface named Scoreable. It should contain a single method named getScore that takes no parameters and returns an integer.

Step-by-Step Approach:

  • Use the interface keyword instead of class.
  • Define the method signature without curly braces { }.
  • End the method signature with a semicolon.

Java Solution:

public interface Scoreable {
    int getScore();
}

Common Scoring Mistakes:

  • Writing public abstract int getScore(); (while technically correct, the public abstract is redundant and generally omitted).
  • Attempting to write a method body like { return 0; } inside the interface.

FRQ 2 — Implementing an Interface

Easy

Problem Description:
Write a class Player that implements the Scoreable interface from FRQ 1. The class should have a private integer score, a constructor that accepts an initial score, and it must properly implement the interface method.

Java Solution:

public class Player implements Scoreable {
    private int score;

    public Player(int score) {
        this.score = score;
    }

    @Override
    public int getScore() {
        return score;
    }
}

Common Scoring Mistakes:

  • Using the word extends instead of implements.
  • Forgetting to declare the implemented method as public (interface methods are implicitly public, so reducing their visibility in the class causes an error).

FRQ 3 — Interface with Multiple Methods

Easy

Problem Description:
Design an interface named Measurable. It must contain two method signatures: getArea() and getPerimeter(). Both methods should return a double and accept no parameters.

Java Solution:

public interface Measurable {
    double getArea();
    double getPerimeter();
}

FRQ 4 — Implementing Multiple Methods

Easy

Problem Description:
Write a class Rectangle that implements Measurable. It must have private double variables width and height, a constructor, and correctly implement both interface methods.

Java Solution:

public class Rectangle implements Measurable {
    private double width;
    private double height;

    public Rectangle(double width, double height) {
        this.width = width;
        this.height = height;
    }

    @Override
    public double getArea() {
        return width * height;
    }

    @Override
    public double getPerimeter() {
        return 2.0 * (width + height);
    }
}

Common Scoring Mistakes:

  • Implementing getArea() but forgetting to implement getPerimeter(). A concrete class must implement all methods defined in the interface.



FRQ 5 — Polymorphic Array Traversal

Medium

Problem Description:
Given an array of Measurable interface references (which could contain Rectangle objects, Circle objects, etc.), write a method calculateTotalArea(Measurable[] shapes) that returns the sum of all areas in the array.

Java Solution:

public double calculateTotalArea(Measurable[] shapes) {
    double total = 0.0;
    for (Measurable m : shapes) {
        total += m.getArea();
    }
    return total;
}

Common Scoring Mistakes:

  • Attempting to cast m to a Rectangle. Polymorphism handles this automatically—the JVM will execute the correct getArea() method for whatever object is currently referenced by m.

FRQ 6 — Filtering a Polymorphic ArrayList

Medium

Problem Description:
Assume a Discountable interface exists with a double getPrice() method. Write a method getCheapItems(ArrayList<Discountable> cart, double maxPrice) that returns a new ArrayList<Discountable> containing only the items whose price is less than or equal to maxPrice.

Java Solution:

public ArrayList<Discountable> getCheapItems(ArrayList<Discountable> cart, double maxPrice) {
    ArrayList<Discountable> cheapItems = new ArrayList<>();
    for (Discountable item : cart) {
        if (item.getPrice() <= maxPrice) {
            cheapItems.add(item);
        }
    }
    return cheapItems;
}

FRQ 7 — Interface Parameters in Methods

Medium

Problem Description:
Write a method isWinner(Scoreable p1, Scoreable p2) that returns the Scoreable object with the strictly higher score. If there is a tie, return p1.

Java Solution:

public Scoreable isWinner(Scoreable p1, Scoreable p2) {
    if (p2.getScore() > p1.getScore()) {
        return p2;
    }
    return p1;
}

FRQ 8 — Tracking State in an Implementing Class

Medium

Problem Description:
The Clicker interface requires a void click() method and an int getCount() method. Write a class SafeClicker that implements Clicker. It should track clicks, but cap the maximum count at 100.

Java Solution:

public class SafeClicker implements Clicker {
    private int count;

    public SafeClicker() {
        this.count = 0;
    }

    @Override
    public void click() {
        if (count < 100) {
            count++;
        }
    }

    @Override
    public int getCount() {
        return count;
    }
}

Common Scoring Mistakes:

  • Forgetting to initialize count = 0 in the constructor (though Java defaults ints to 0, explicit initialization is best practice on the AP exam).

FRQ 9 — Interface for Condition Checking

Medium

Problem Description:
An interface Condition contains a method boolean test(int n). Write a class EvenCondition that implements Condition and returns true only if the integer passed to it is even.

Java Solution:

public class EvenCondition implements Condition {
    @Override
    public boolean test(int n) {
        return n % 2 == 0;
    }
}

FRQ 10 — Processing with an Interface Condition

Medium

Problem Description:
Using the Condition interface from FRQ 9, write a method removeFails(ArrayList<Integer> nums, Condition cond) that modifies the list by removing any number where cond.test(n) returns false.

Java Solution:

public void removeFails(ArrayList<Integer> nums, Condition cond) {
    for (int i = 0; i < nums.size(); i++) {
        if (!cond.test(nums.get(i))) {
            nums.remove(i);
            i--; // Adjust index after removal
        }
    }
}

Common Scoring Mistakes:

  • Forgetting to write i-- after removing an element, which skips the evaluation of the next adjacent element.



FRQ 11 — Finding the Maximum via Interface

Hard

Problem Description:
Write a method findLargest(ArrayList<Measurable> shapes) that returns the Measurable object with the largest area. If the list is empty, return null.

Java Solution:

public Measurable findLargest(ArrayList<Measurable> shapes) {
    if (shapes.size() == 0) {
        return null;
    }
    
    Measurable largest = shapes.get(0);
    for (Measurable m : shapes) {
        if (m.getArea() > largest.getArea()) {
            largest = m;
        }
    }
    return largest;
}

Common Scoring Mistakes:

  • Failing to handle the empty list condition before calling shapes.get(0), causing an IndexOutOfBoundsException.

FRQ 12 — The NumberGroup Interface (AP Exam Style)

Hard

Problem Description:
An interface NumberGroup contains a method boolean contains(int n). Write a class Range that implements NumberGroup. A Range represents a sequence of integers from a minimum value to a maximum value, inclusive.

Java Solution:

public class Range implements NumberGroup {
    private int min;
    private int max;

    public Range(int min, int max) {
        this.min = min;
        this.max = max;
    }

    @Override
    public boolean contains(int n) {
        return n >= min && n <= max;
    }
}

FRQ 13 — Classes that Contain Interface Collections

Hard

Problem Description:
Using the interface from FRQ 12, write a class MultipleGroups that also implements NumberGroup. It should contain a private ArrayList<NumberGroup> groupList. Implement contains(int n) to return true if any group in the list contains the number.

Java Solution:

public class MultipleGroups implements NumberGroup {
    private ArrayList<NumberGroup> groupList;

    public MultipleGroups(ArrayList<NumberGroup> list) {
        this.groupList = list;
    }

    @Override
    public boolean contains(int n) {
        for (NumberGroup group : groupList) {
            if (group.contains(n)) {
                return true;
            }
        }
        return false;
    }
}

Common Scoring Mistakes:

  • Writing an else { return false; } inside the loop. This will cause the method to exit early after checking only the very first group!

FRQ 14 — Interfaces in 2D Arrays

Hard

Problem Description:
An interface Drawable requires a void draw() method. A Canvas class contains a 2D array Drawable[][] grid. Write a method drawAll() that invokes draw() on every object in the grid, but avoids crashing if a grid space is empty (null).

Java Solution:

public void drawAll() {
    for (int r = 0; r < grid.length; r++) {
        for (int c = 0; c < grid[r].length; c++) {
            if (grid[r][c] != null) {
                grid[r][c].draw();
            }
        }
    }
}

FRQ 15 — Complex Interface State Accumulation

Hard

Problem Description:
A MenuItem interface has a double getPrice() method. Write a class ComboMeal that implements MenuItem. A combo meal contains an ArrayList<MenuItem>. Its total price is the sum of all items in the list, minus a flat $2.00 discount.

Java Solution:

public class ComboMeal implements MenuItem {
    private ArrayList<MenuItem> items;

    public ComboMeal() {
        items = new ArrayList<>();
    }

    public void addItem(MenuItem item) {
        items.add(item);
    }

    @Override
    public double getPrice() {
        double sum = 0.0;
        for (MenuItem item : items) {
            sum += item.getPrice();
        }
        return sum - 2.00;
    }
}

Frequently Asked Questions

Q: What is the difference between the declared type and the actual type in Java?
The declared type (the reference type on the left side of the equals sign) tells the compiler which methods you are allowed to call. The actual type (the specific object created with new on the right side) determines which version of the method actually executes at runtime.

Q: Can you instantiate an Interface?
No. You cannot create an object directly from an interface (e.g., List myList = new List(); will cause an error). You must instantiate a concrete class that implements the interface (e.g., List myList = new ArrayList();).

Q: Do I need to write public abstract in front of interface methods?
No. On the AP CSA exam, any method declared inside an interface is automatically assumed to be public and abstract, so you can just write the return type and method signature.


Related FRQ Practice Topics

  • Arrays FRQ Practice
  • ArrayList FRQ Practice
  • Strings FRQ Practice
  • Classes & Objects FRQ Practice
  • 2D Arrays FRQ Practice
  • Mixed Topic FRQs

Need Guided Help With AP Computer Science A?

Get personalized 1-on-1 AP CSA tutoring from an experienced Java teacher. Build solid programming fundamentals, master FRQs, and prepare to score a 5 on the AP Exam.

Book a Demo Session:
1-on-1 AP Computer Science A Tutoring Program
WhatsApp / Call: +91 9853166385

Primary Sidebar

Mr Chinmay

Chinmay Patel
Online Java Tutor-Demo Class

Phone & Whatsapp +919853166385
javatution@gmail.com

Recent Posts

  • Learn Java in One Day: 1-on-1 Private Crash Course
  • Constructor in Java and Overloaded Constructor Example Program
  • Important Interview Questions on Java Multithreading
  • React Spring Boot Web Services React Integration
  • Spring Boot RESTful Web Services Example
  • Top Spring MVC Interview Questions and Answers for Developers
  • Top Spring Core Interview Questions and Answers for Developers
  • Host Java Web Apps for Free on Mobile with Tomcat and Termux
  • How to Deploy Java Web Application on Aws EC2 with Elastic IP
  • Simple Jsp Servlet Jdbc User Registration using Tomcat Mysql and Eclipse

Additional Resources

  • AP Computer Science A Summer Prep
Copyright © 2026 JavaTutorOnline