AP CSA 2014 FRQ 4 Trio
AP CSA 2014 FRQ 4: Trio
implements is no longer tested on the current AP CSA exam.Complete solution, scoring rubric, and walkthrough — verified from the official College Board PDF
| Question Type | Interface Implementation |
| Key Skills | Write the Trio class implementing the NumberGroup-style Trio interface: stores three strings, provides getFirst/getSecon |
| Difficulty | Hard |
| AP CSA Units | Unit 3: Class Creation (interface implementation, accessor methods) and Unit 1 (String comparison with .equals()). |
What This Problem Asks
Write the Trio class implementing the NumberGroup-style Trio interface: stores three strings, provides getFirst/getSecond/getThird accessors, and implements sameTrio() which checks if three Trio objects contain the same three strings in the same order.
Official Question & PDF
PDF cannot display here. Open PDF directly →
Provided Code
public interface Trio
{
String getFirst();
String getSecond();
String getThird();
}
// Write a class implementing Trio that also has:
// sameTrio(Trio other) — returns true if this and other have the same three values
// static sameTrio(Trio t1, Trio t2, Trio t3) — true if all three Trios match
Entire Trio Implementation (9 Points)
Write a class that implements Trio: store three strings, provide the three accessors, and implement both sameTrio() methods (instance version comparing two Trios, and static version comparing three Trios).
Scoring Rubric
| +1 | Declares class with implements Trio |
| +1 | Constructor stores three String fields |
| +1 | getFirst() returns first value |
| +1 | getSecond() returns second value |
| +1 | getThird() returns third value |
| +1 | Instance sameTrio() compares all three values with other using .equals() |
| +1 | Static sameTrio() calls instance sameTrio() or equivalent |
| +1 | All comparisons use .equals() (not ==) |
| +1 | Algorithm: both sameTrio methods return correct boolean |
Solution
public class BaseTrio implements Trio
{
private String first;
private String second;
private String third;
public BaseTrio(String a, String b, String c)
{
first = a;
second = b;
third = c;
}
public String getFirst() {
return first;
}
public String getSecond() {
return second;
}
public String getThird() {
return third;
}
public boolean sameTrio(Trio other)
{
return getFirst().equals(other.getFirst())
&& getSecond().equals(other.getSecond())
&& getThird().equals(other.getThird());
}
public static boolean sameTrio(Trio t1, Trio t2, Trio t3)
{
return t1.getFirst().equals(t2.getFirst())
&& t1.getFirst().equals(t3.getFirst())
&& t1.getSecond().equals(t2.getSecond())
&& t1.getSecond().equals(t3.getSecond())
&& t1.getThird().equals(t2.getThird())
&& t1.getThird().equals(t3.getThird());
}
}
Common Mistakes to Avoid
Wrong
if (getFirst() == other.getFirst()) // reference comparison — unreliable
Correct
if (getFirst().equals(other.getFirst())) // content comparison — correct
String comparison with == checks if both variables point to the same object in memory. Two Strings with the same content may be different objects. Always use .equals() for String value comparison.
Wrong
return first.equals(other.first) // error: other is typed as Trio interface, has no .first field
Correct
return getFirst().equals(other.getFirst()) // use interface methods
The parameter type is Trio (the interface). Interfaces don't have fields — only methods. You must use the accessor methods.
Exam Tips
Frequently Asked Questions
What does 2014 AP CSA FRQ 4 Trio ask?
It asks students to write a class implementing the Trio interface with a constructor storing three strings, three accessor methods, and two sameTrio() methods: an instance version comparing two Trios, and a static version comparing three.
Is Trio interface implementation still tested on the current AP CSA exam?
No. Interface implementation with implements was removed from the AP CSA curriculum in the 2019 redesign. The accessor method pattern (getFirst/getSecond/getThird) and String comparison with .equals() are still tested, but the interface keyword itself is not.
See All 2014 AP CSA FRQs
View the complete 2014 exam hub with solutions, difficulty analysis, and scoring for all four questions.
View 2014 FRQ Hub →Get in Touch
Whether you're a student, parent, or teacher — I'd love to hear from you.
Just want free AP CS resources?
Enter your email below and check the subscribe box — no message needed. Students get daily practice questions and study tips. Teachers get curriculum resources and teaching strategies.
Message Sent!
Thanks for reaching out. I'll get back to you within 24 hours.
Prefer email? Reach me directly at [email protected]