
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
| Concept | Syntax / Keyword | Key AP Exam Rule |
|---|---|---|
| Defining an Interface | public interface Name | Interfaces contain only method signatures. They cannot contain instance variables or method bodies. |
| Interface Methods | int getScore(); | Methods inside an interface are automatically public and abstract. Do not write method bodies { }. |
| Implementing | public class Sub implements Super | A concrete class must provide an implementation (override) for every method defined in the interface. |
| Instantiation | Interface obj = new Interface(); | ILLEGAL. You cannot instantiate an interface directly. You must instantiate a class that implements it. |
| Polymorphism | List<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
interfacekeyword instead ofclass. - 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, thepublic abstractis 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
extendsinstead ofimplements. - 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 implementgetPerimeter(). 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
mto aRectangle. Polymorphism handles this automatically—the JVM will execute the correctgetArea()method for whatever object is currently referenced bym.
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 = 0in 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 anIndexOutOfBoundsException.
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