AP CSA 2014 FRQ 4 Trio

FRQ Archive2014 FRQs › FRQ 4: Trio
2014 AP CSA • Interface Implementation

AP CSA 2014 FRQ 4: Trio

Classic Exam Note: This FRQ requires implementing a Trio interface. Interface implementation with implements is no longer tested on the current AP CSA exam.

Complete solution, scoring rubric, and walkthrough — verified from the official College Board PDF

9 Points Hard Interface Implementation Classic Format (Pre-2019)
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

Download Full 2014 FRQ 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
Timer 22:00

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).

Drag corner to expand ▽

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());
    }
}
Use the accessor methods (getFirst() etc.) rather than accessing fields directly — this is especially important in sameTrio() where the parameter is typed as Trio (the interface), not the concrete class.

Common Mistakes to Avoid

Using == instead of .equals() for String comparison

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.

Accessing fields directly in sameTrio() instead of using accessors

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

Note: Interface implementation is no longer on the current AP CSA exam. The accessor method pattern (getFirst/getSecond/getThird) remains directly relevant.
When implementing an interface, use the interface's method signatures exactly as declared — same name, same parameter types, same return type.

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.

Typically responds within 24 hours

Message Sent!

Thanks for reaching out. I'll get back to you within 24 hours.

🏫 Welcome, fellow educator!

I offer curriculum resources, practice materials, and study guides designed for AP CS teachers. Let me know what you're looking for — whether it's classroom materials, a guest speaker, or Teachers Pay Teachers resources.

Email

[email protected]

📚

Courses

AP CSA, CSP, & Cybersecurity

Response Time

Within 24 hours

Prefer email? Reach me directly at [email protected]