Ap17 SG Comp Sci A
Ap17 SG Comp Sci A
AP Computer Science A
Scoring Guidelines
© 2017 The College Board. College Board, Advanced Placement Program, AP, AP Central, and the acorn logo
are registered trademarks of the College Board. Visit the College Board on the Web: www.collegeboard.org.
AP Central is the official online home for the AP Program: apcentral.collegeboard.org
AP® COMPUTER SCIENCE A
2017 GENERAL SCORING GUIDELINES
Apply the question assessment rubric first, which always takes precedence. Penalty points can only be
deducted in a part of the question that has earned credit via the question rubric. No part of a question
(a, b, c) may have a negative point total. A given penalty can be assessed only once for a question, even if
it occurs multiple times or in multiple parts of that question. A maximum of 3 penalty points may be
assessed per question.
1-Point Penalty
v) Array/collection access confusion ([] get)
w) Extraneous code that causes side-effect (e.g., printing to output, incorrect precondition check)
x) Local variables used but none declared
y) Destruction of persistent data (e.g., changing value referenced by parameter)
z) Void method or constructor that returns a value
No Penalty
o Extraneous code with no side-effect (e.g., valid precondition check, no-op)
o Spelling/case discrepancies where there is no ambiguity*
o Local variable not declared provided other variables are declared in some part
o private or public qualifier on a local variable
o Missing public qualifier on class or constructor header
o Keyword used as an identifier
o Common mathematical symbols used for operators (× • ÷ < > <> ≠)
o [] vs. () vs. <>
o = instead of == and vice versa
o length/size confusion for array, String, List, or ArrayList; with or without ( )
o Extraneous [] when referencing entire array
o [i,j] instead of [i][j]
o Extraneous size in array declaration, e.g., int[size] nums = new int[size];
o Missing ; where structure clearly conveys intent
o Missing { } where indentation clearly conveys intent
o Missing ( ) on parameter-less method or constructor invocations
o Missing ( ) around if or while conditions
*Spelling and case discrepancies for identifiers fall under the “No Penalty” category only if the correction
can be un am biguousl y inferred from context, for example, “ArayList” instead of “ArrayList.” As a
counterexample, note that if the code declares “int G=99, g=0;”, then uses “while (G < 10)”
instead of “while (g < 10)”, the context does n ot allow for the reader to assume the use of the lower
case variable.
Question 1: Digits
+1 Constructs digitList
+1 On exit: digitList contains all and only digits of num in the correct order
+1 Returns true iff all consecutive pairs of elements are in order; returns false otherwise
Question-Specific Penalties
Question 1: Digits
Part (a)
if (num == 0)
{
digitList.add(new Integer(0));
}
Part (b)
Note: The solutions shown above were written in compliance with the AP Java subset methods listed for
Integer objects. Students were allowed to use the automatic "boxing" and "unboxing" of Integer
objects in their solutions, which eliminates the need to use "new Integer(...)" in part (a) and
"intValue()" in part (b).
These canonical solutions serve an expository role, depicting general approaches to solution. Each reflects only one instance from the
infinite set of valid solutions. The solutions are presented in a coding style chosen to enhance readability and facilitate understanding.
Question 2: MultPractice
+2 Constructor
+3 getProblem method
+2 nextProblem method
Question 2: MultPractice
These canonical solutions serve an expository role, depicting general approaches to solution. Each reflects only one instance from the
infinite set of valid solutions. The solutions are presented in a coding style chosen to enhance readability and facilitate understanding.
Question 3: PhraseEditor
+1 Increments (or decrements) the value used as n when finding nth occurrence
Question-Specific Penalties
Question 3: PhraseEditor
Part (a)
if (loc != -1)
{
currentPhrase = currentPhrase.substring(0, loc) + repl +
currentPhrase.substring(loc + str.length());
}
}
Part (b)
These canonical solutions serve an expository role, depicting general approaches to solution. Each reflects only one instance from the
infinite set of valid solutions. The solutions are presented in a coding style chosen to enhance readability and facilitate understanding.
+1 Constructs Position object with same row and column as identified intArr element
+1 Selects constructed object when intArr element identified; null when not
+1 Determines the successor Position of an intArr element accessed by row and column
(in context of intArr traversal)
+1 Assigns all necessary locations in successor array with corresponding position object or null
(no bounds errors)
Question-Specific Penalties
Part (a)
Part (b)
These canonical solutions serve an expository role, depicting general approaches to solution. Each reflects only one instance from the
infinite set of valid solutions. The solutions are presented in a coding style chosen to enhance readability and facilitate understanding.