AP
®
Computer Science A 2021 Scoring Commentary
© 2021 College Board.
Visit College Board on the web: collegeboard.org.
Question 3
Overview
This question tested the student’s ability to:
• Write program code to create objects of a class and call methods.
• Write program code to satisfy methods using expressions, conditional statements, and iterative
statements.
• Write program code to create, traverse, and manipulate elements in 1D array or ArrayList objects.
This question involved the manipulation of both a one-dimensional array containing String values and an
Arra
yList containing MemberInfo objects. Students were expected to write two methods in the enclosing
ClubMembers class, making use of its ArrayList instance variable as well as two methods from the
MemberInfo class.
In part (a) students were expected to write a loop to access each element of an array parameter. Inside the loop,
students were expected to: (1) Construct a MemberInfo object using the new keyword and three parameters: a
name from the array, gradYear, and true, in that order; (2) Add the constructed MemberInfo object to the
ClubMembers instance variable memberList.
In part (b) students were asked to develop an algorithm to: (1) Identify club members who have graduated and are
in good standing and add those club members to an ArrayList to be returned; (2) Remove from memberList
those club members who have graduated, regardless of whether or not they are in good standing; and (3) Leave
club members who have not yet graduated in memberList. Students had to create an ArrayList of
MemberInfo objects to be returned and write a loop to access each element of the given ArrayList instance
variable. Inside the loop, students had to call getGradYear and correctly compare the int return value to the
year parameter. They also had to call inGoodStanding and use the boolean return value appropriately.
Sample: 3A
Score: 8
In part (a) poi
nt 1 was earned by accessing all elements of names with no bounds errors. The response uses a
traditional for loop with correct lower and upper bounds. Within the context of the loop, the response
accesses names[j]. Point 2 was earned by instantiating a MemberInfo object by using the keyword new
and the correct parameters. Point 3 was earned by adding MemberInfo objects to memberList in the
context of a loop. The response correctly calls the add method for memberList with the parameter of an
instantiated MemberInfo object that has been assigned to a separate variable.
In part (b) point 4 was earned by correctly declaring and initializing an ArrayList of MemberInfo objects.
P
oint 5 was not earned because the response calls the remove method within an enhanced for loop, which
causes an exception to be thrown. Point 6 was earned because there are correct calls to both the
getGradYear and inGoodStanding methods. Omitting the () on each method call falls into the "No
Penalty" category. Point 7 was earned because the response distinguishes three cases, based on graduation
status and standing. The three identified cases are: (1) members who have graduated in good standing;
(2) members who have graduated but are not in good standing; and (3) members who have not yet graduated.
Point 8 was earned by identifying graduating members. The response correctly identifies graduating members
by checking if the graduation year returned by the method call is less than or equal to the method’s year
parameter. Point 9 was earned because the response first correctly identifies graduating members in good
standing and adds them to the ArrayList to be returned, then identifies graduating members and removes
them from memberList. Members who have not yet graduated remain in memberList. Note that the