Ap Csa 2021 Frq 2 Combinedtable
AP CSA 2021 FRQ 2: CombinedTable
Complete solution, scoring rubric, and walkthrough — verified from the official College Board PDF
| Question Type | Class Writing |
| Skills Tested | Class design, object composition, method delegation, reference semantics |
| Difficulty | Medium |
| Recommended Time | 22 minutes |
What This Problem Asks
2021 AP CSA FRQ 2 CombinedTable asks students to write a class that combines two SingleTable objects. The class stores references to both tables, canSeat(n) checks whether the combined table (total seats minus 2) can accommodate n people, and getDesirability averages the view qualities and subtracts 10 if the heights differ.
What This FRQ Tests
This FRQ tests Unit 3: Class Creation (object composition, method delegation, reference semantics) and Unit 1 (calling methods on objects).
Official Question & PDF
PDF cannot display on this device. Open PDF directly →
Provided Code
public class SingleTable
{
public int getNumSeats() {
/* >= 4, not shown */
}
public int getHeight() { /* not shown */ }
public double getViewQuality() { /* not shown */ }
public void setViewQuality(double value) { /* not shown */ }
}
// Write the complete CombinedTable class:
// - Composed of two SingleTable objects
// - canSeat(int n): returns true if (total seats - 2) >= n
// - getDesirability(): average of view qualities; if heights differ, subtract 10
Part A — 9 Points
Write the complete CombinedTable class with a constructor taking two SingleTable parameters, canSeat(int numPeople), and getDesirability() methods.
Write Your Solution
Scoring Rubric — 9 Points
| +1 | Class header: public class CombinedTable
|
| +1 | Constructor stores references to both SingleTable objects in instance variables |
| +1 | Constructor header: CombinedTable(SingleTable, SingleTable) declared public
|
| +1 | Declares public method headers for canSeat and getDesirability
|
| +1 |
canSeat computes total seats and subtracts 2 |
| +1 |
canSeat returns correct boolean |
| +1 |
getDesirability computes average of the two view qualities |
| +1 |
getDesirability subtracts 10 when heights differ |
| +1 |
getDesirability returns the correct value (algorithm) |
Complete Solution
public class CombinedTable
{
private SingleTable table1;
private SingleTable table2;
public CombinedTable(SingleTable t1, SingleTable t2)
{
table1 = t1;
table2 = t2;
}
public boolean canSeat(int numPeople)
{
int totalSeats = table1.getNumSeats() + table2.getNumSeats() - 2;
return numPeople <= totalSeats;
}
public double getDesirability()
{
double avg = (table1.getViewQuality() + table2.getViewQuality()) / 2.0;
if (table1.getHeight() != table2.getHeight())
{
avg -= 10;
}
return avg;
}
}
t2.setViewQuality(80) is called externally, getDesirability() reflects the updated value. This is shown in the last row of the example table.Common Mistakes to Avoid
If you store viewQuality1 in the constructor, later changes to the SingleTable won’t be reflected. Store the objects themselves.
Wrong (stores copies)
private double viewQuality1;
public CombinedTable(SingleTable t1, SingleTable t2) {
viewQuality1 = t1.getViewQuality(); // cached, won't update!
}
Correct (stores references)
private SingleTable table1;
public CombinedTable(SingleTable t1, SingleTable t2) {
table1 = t1; // reference -- updates automatically
}
Exam Tips
Scoring Summary
| Part | Method | Points |
|---|---|---|
| Total (complete class) | 9 |
Want the Complete 2021 FRQ Solutions?
Browse all past AP CSA FRQs with full solutions and scoring breakdowns.
Related FRQs
Class Writing 2022 FRQ 2: Textbook — Subclass with inheritance Class Writing 2023 FRQ 2: Sign — Complete class with ceiling division and getLinesStudy the Concepts
Unit 3 Study Guide → Unit 1 Study Guide →
Struggling with FRQs? Get 1-on-1 Help
Work directly with Tanner — AP CS teacher with 11+ years experience and 1,845+ verified tutoring hours. 54.5% of students score 5s (vs. 25.5% national average).
5-session packages at $125/hr. Venmo, Zelle, PayPal, or credit card.
Frequently Asked Questions
What does 2021 AP CSA FRQ 2 CombinedTable test?
FRQ 2 tests writing a complete class that contains two object references. The class composes two SingleTable objects and provides methods to compute seating capacity and desirability based on those objects' data.
How many points is FRQ 2 worth?
9 points for the complete CombinedTable class.
Why must I store references to the SingleTable objects, not copies?
The example shows that when setViewQuality is called on one of the single tables, the getDesirability() of the CombinedTable changes too. This only works if you store references to the actual objects, not cached values.
Why divide by 2.0 instead of 2 in getDesirability?
Dividing two ints by 2 would use integer division. Using 2.0 forces a double result, preserving the decimal for the average.
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]