0% found this document useful (0 votes)
13 views28 pages

AP Exam Review and Practice Resources

The document provides an overview of the AP Computer Science A (CSA) course and exam, detailing course content, exam format, and expectations. It emphasizes programming concepts, particularly in Java, and includes a breakdown of units and exam weightings. Additionally, it contains practice questions and a Java Quick Reference for accessible methods relevant to the exam.

Uploaded by

henryszuster
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views28 pages

AP Exam Review and Practice Resources

The document provides an overview of the AP Computer Science A (CSA) course and exam, detailing course content, exam format, and expectations. It emphasizes programming concepts, particularly in Java, and includes a breakdown of units and exam weightings. Additionally, it contains practice questions and a Java Quick Reference for accessible methods relevant to the exam.

Uploaded by

henryszuster
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 28

AP Exam Review and Practice

The AP CSA Exam


Resources
CSA Unit 9 Lesson 1

Name(s)_______________________________________________ Period ______ Date ___________________

AP CSA Course and Exam Description

The AP Computer Science A Course and Exam Description is the core document for an AP course. The Course and
Exam Description lays out course content and skills and describes the exam and AP Program in general.

AP Computer Science A introduces students to computer science through programming. Fundamental topics in this
course include the design of solutions to problems, the use of data structures to organize large sets of data, the
development and implementation of algorithms to process data and discover new information, the analysis of potential
solutions, and the ethical and social implications of computing systems. The course emphasizes object-oriented
programming and design using the Java programming language.

Course Framework
The AP Computer Science A course reflects what computer science teachers, professors, and researchers have
indicated are the main goals of an introductory, college-level computer science programming course:

● Program Design and Algorithm Development— Determine required code segments to produce a given output.
● Code Logic—Determine the output, value, or result of given program code given initial values.
● Code Implementation—Write and implement program code.
● Code Testing—Analyze program code for correctness, equivalence, and errors.
● Documentation—Describe the behavior and conditions that produce the specified results in a program.
● Ethical Computing—Understand the ethical and social implications of computer use.

Course Content
This curriculum is arranged to follow the AP CSA units and provides many interactive exercises in each unit.

Unit Title Exam Weight

Unit 1 Primitive Types 2.5–5%

Unit 2 Using Objects 5–7.5%

Unit 3 Boolean Expressions and if Statements 15–17.5%

Unit 4 Iteration 17.5–22.5%

Unit 5 Writing Classes 5-7.5%

Unit 6 Array 10–15%

Unit 7 ArrayList 2.5–7.5%

Unit 8 2D Array 7.5–10%

Unit 9 Inheritance 5-10%

Unit 10 Recursion 5–7.5%


Course Exam Format
The AP CSA exam is 3 hours long and has two sections — multiple choice and free-response.

You will be given 90 minutes for each part. The first part has 40 multiple-choice questions, and the second part has 4
free response questions (Methods and Control Structures, Classes, Array/ArrayList, and 2D Array) where you have to
write Java code by hand. Each part is worth 50% of your grade.

Generally, an AP score of 3 and above is considered passing.

2
CSA Unit 9 Lesson 1

Name(s)_______________________________________________ Period ______ Date ___________________

Activity Guide - Exploring Exam Expectations

Directions:
Answer the following questions. Use the Course Exam Description and Java Quick Reference handout to
assist you.

Exam Expectations

1. Consider the following code:

double numberB = 1.5;


System.out.println((int) numberB);

What topic would this code segment fall under, and what is the exam weight? ________________________________

2. How long is the CSA Exam? ________________________________

3. All free-response questions assess Computational Thinking Practice 3: Code Implementation. What are the four
main focuses?
______________________________________________________________________________________________

4. The course emphasizes __________________ and design using the ________________________________.

5. What percentage is each part of the exam worth? _______________

6. Is the Java Quick Reference permitted while you take the exam? _________________

7. What is the exam weight for Writing Classes? ________________________________

8. What is the explanation for int compareTo(String other)?

______________________________________________________________________________________________

9. Which method in the Math Class returns the value of the first parameter raised to the power of the second
parameter? ___________________________________________

10. What two methods are used in the Object class? _____________________________________________

11. What is the length of the exam for each section? ___________________

12. boolean add(E obj) appends _____________ to end of list; returns ________________

13. What is the difference between E get(int index) and E set(int index, E obj)?

_____________________________________________________________________________________________
14. Consider the following code:

public int countUp(int num)


{
if(num == 0) {
return 0;
}
else {
return num + countUp(num-1);
}
}

What topic would this code segment fall under, and what is the exam weight? ________________________________

15. What is the purpose of the Java Quick Reference Guide?

_____________________________________________________________________________________________

16. Consider the following code:

int[] testInts = new int[5];


System.out.print(testInts[2]);

What topic would this code segment fall under and what is the exam weight? ________________________________

17. What is the explanation for static double random()?


__________________________________________________

18. Fill out the following chart:

Class Constructor and Methods Explanation

Constructs a new Integer object that represents the specified int


value

Integer.MIN_VALUE

Returns the value of this Integer as an int

19. Consider the following code:

Painter picasso = new Painter(2, 3, "North", 4);

What topic would this code segment fall under, and what is the exam weight? ________________________________

2
Java Quick Reference
Accessible methods from the Java library that may be included in the exam
Class Constructors and Methods Explanation
String Class
String(String str) Constructs a new String object that represents the same sequence of
characters as str

int length() Returns the number of characters in a String object


String substring(int from, Returns the substring beginning at index from and ending at index to - 1
int to)
String substring(int from) Returns substring(from, length())
int indexOf(String str) Returns the index of the first occurrence of str; returns -1 if not found
boolean equals(String other) Returns true if this is equal to other; returns false otherwise
int compareTo(String other) Returns a value <0 if this is less than other; returns zero if this is
equal to other; returns a value >0 if this is greater than other
Integer Class
Integer(int value) Constructs a new Integer object that represents the specified int value
Integer.MIN_VALUE The minimum value represented by an int or Integer
Integer.MAX_VALUE The maximum value represented by an int or Integer
int intValue() Returns the value of this Integer as an int
Double Class
Double(double value) Constructs a new Double object that represents the specified double value
double doubleValue() Returns the value of this Double as a double
Math Class
int abs(int x) Returns the absolute value of an int value
double abs(double x) Returns the absolute value of a double value
double pow(double base, Returns the value of the first parameter raised to the power of the second
double exponent) parameter

double sqrt(double x) Returns the positive square root of a double value


double random() Returns a double value greater than or equal to 0.0 and less than 1.0
ArrayList Class
int size() Returns the number of elements in the list

boolean add(E obj) Appends obj to end of list; returns true


void add(int index, E obj) Inserts obj at position index (0 <= index <= size), moving
elements at position index and higher to the right (adds 1 to their indices) and
adds 1 to size

E get(int index) Returns the element at position index in the list


E set(int index, E obj) Replaces the element at position index with obj; returns the element
formerly at position index

E remove(int index) Removes element from position index, moving elements at position
index + 1 and higher to the left (subtracts 1 from their indices) and subtracts 1
from size; returns the element formerly at position index
Object Class
boolean equals(Object other)
String toString()

© 2019 College Board


AP Exam Review and Practice
MCQ Pre-Assessment
Resources
Java Quick Reference
Accessible methods from the Java library that may be included in the exam
Class Constructors and Methods Explanation
String Class
String(String str) Constructs a new String object that represents the same sequence of
characters as str

int length() Returns the number of characters in a String object


String substring(int from, Returns the substring beginning at index from and ending at index to - 1
int to)
String substring(int from) Returns substring(from, length())
int indexOf(String str) Returns the index of the first occurrence of str; returns -1 if not found
boolean equals(String other) Returns true if this is equal to other; returns false otherwise
int compareTo(String other) Returns a value <0 if this is less than other; returns zero if this is
equal to other; returns a value >0 if this is greater than other
Integer Class
Integer(int value) Constructs a new Integer object that represents the specified int value
Integer.MIN_VALUE The minimum value represented by an int or Integer
Integer.MAX_VALUE The maximum value represented by an int or Integer
int intValue() Returns the value of this Integer as an int
Double Class
Double(double value) Constructs a new Double object that represents the specified double value
double doubleValue() Returns the value of this Double as a double
Math Class
int abs(int x) Returns the absolute value of an int value
double abs(double x) Returns the absolute value of a double value
double pow(double base, Returns the value of the first parameter raised to the power of the second
double exponent) parameter

double sqrt(double x) Returns the positive square root of a double value


double random() Returns a double value greater than or equal to 0.0 and less than 1.0
ArrayList Class
int size() Returns the number of elements in the list

boolean add(E obj) Appends obj to end of list; returns true


void add(int index, E obj) Inserts obj at position index (0 <= index <= size), moving
elements at position index and higher to the right (adds 1 to their indices) and
adds 1 to size

E get(int index) Returns the element at position index in the list


E set(int index, E obj) Replaces the element at position index with obj; returns the element
formerly at position index

E remove(int index) Removes element from position index, moving elements at position
index + 1 and higher to the left (subtracts 1 from their indices) and subtracts 1
from size; returns the element formerly at position index
Object Class
boolean equals(Object other)
String toString()

© 2019 College Board


AP Exam Review and Practice
MCQ Practice – Day 1
Resources
CSA Unit 9 Lesson 4

Name(s)_______________________________________________ Period ______ Date ___________________

Activity Guide - MCQ Practice

Station A Station B Station C

Topic 1:

Topic 2:

Topic 3:

Reflection Questions:

1. How would you describe


this style of question?

2. What was challenging


about the style of question
in this station?

3. What strategies do you


have for this style?
1. Consider the following method, which is intended to return a list containing the elements of the parameter myList
with all even elements removed.

public static ArrayList<Integer> removeEvens(ArrayList<Integer> myList)


{
for (int i = 0; i < myList.size(); i++)
{
if (myList.get(i) % 2 == 0)
{
myList.remove(i);
}
}
return myList;
}

Which of the following best explains why the code segment does not work as intended?

(A) The code segment causes an IndexOutOfBoundsException for all lists because of an incorrect Boolean
expression in the for loop.
(B) The code segment causes an IndexOutOfBoundsException for lists with at least one even element because
the indexes of all subsequent elements change by one when a list element is removed.
(C) The code segment returns a list with fewer elements than intended because it fails to consider the last element
of myList.
(D) The code segment removes the wrong elements of myList because the condition in the if statement to test
whether an element is even is incorrect.
(E) The code segment skips some elements of myList because the indexes of all subsequent elements change by
one when a list element is removed.

2. Consider the following method, which is intended to return a list containing the elements of the parameter myList
with all even elements removed.

public static ArrayList<Integer> removeEvens(ArrayList<Integer> myList)


{
for (int i = 0; i < myList.size(); i++)
{
if (myList.get(i) % 2 == 0)
{
myList.remove(i);
}
}
return myList;
}

Which, if any, of the following changes to removeEvens is required so that the method works as intended?

(A) No change is required.


(B) Change the boolean expression in the if statement to i % 2 == 0
(C) Change the boolean expression in the if statement to myList.get(i) % 2 != 0
(D) Change the for loop header to for (int i = 0; i < myList.size() - 1; i++)

2
(E) Change the for loop header to for (int i = myList.size() - 1; i >= 0; i--)

3. Consider the following method,which is intended to return a list containing the elements of the parameter myList
with all even elements removed.

public static ArrayList<Integer> removeEvens(ArrayList<Integer> myList)


{
for (int i = 0; i < myList.size(); i++)
{
if (myList.get(i) % 2 == 0)
{
myList.remove(i);
}
}
return myList;
}

What is returned when removeEvens is called with an ArrayList<Integer> containing {1, 2, 4, 5, 8}?

(A) Nothing is returned because of an IndexOutOfBoundsException


(B) {1, 2, 4, 5, 8}
(C) {1, 5}
(D) {2, 5}
(E) {1, 4, 5}

3
AP Exam Review and Practice
FRQ Pre-Assessment
Resources
Name(s)_______________________________________________ Period ______ Date ___________________
Important: Completely fill in the circle that corresponds to Question 1 Question 2 Question 3 Question 4
the question that you are answering on this page.

Begin your response to each question at the top of a new page.

Use a pencil only. Do NOT write outside the box.


Java Quick Reference
Accessible methods from the Java library that may be included in the exam
Class Constructors and Methods Explanation
String Class
String(String str) Constructs a new String object that represents the same sequence of
characters as str

int length() Returns the number of characters in a String object


String substring(int from, Returns the substring beginning at index from and ending at index to - 1
int to)
String substring(int from) Returns substring(from, length())
int indexOf(String str) Returns the index of the first occurrence of str; returns -1 if not found
boolean equals(String other) Returns true if this is equal to other; returns false otherwise
int compareTo(String other) Returns a value <0 if this is less than other; returns zero if this is
equal to other; returns a value >0 if this is greater than other
Integer Class
Integer(int value) Constructs a new Integer object that represents the specified int value
Integer.MIN_VALUE The minimum value represented by an int or Integer
Integer.MAX_VALUE The maximum value represented by an int or Integer
int intValue() Returns the value of this Integer as an int
Double Class
Double(double value) Constructs a new Double object that represents the specified double value
double doubleValue() Returns the value of this Double as a double
Math Class
int abs(int x) Returns the absolute value of an int value
double abs(double x) Returns the absolute value of a double value
double pow(double base, Returns the value of the first parameter raised to the power of the second
double exponent) parameter

double sqrt(double x) Returns the positive square root of a double value


double random() Returns a double value greater than or equal to 0.0 and less than 1.0
ArrayList Class
int size() Returns the number of elements in the list

boolean add(E obj) Appends obj to end of list; returns true


void add(int index, E obj) Inserts obj at position index (0 <= index <= size), moving
elements at position index and higher to the right (adds 1 to their indices) and
adds 1 to size

E get(int index) Returns the element at position index in the list


E set(int index, E obj) Replaces the element at position index with obj; returns the element
formerly at position index

E remove(int index) Removes element from position index, moving elements at position
index + 1 and higher to the left (subtracts 1 from their indices) and subtracts 1
from size; returns the element formerly at position index
Object Class
boolean equals(Object other)
String toString()

© 2019 College Board


AP Exam Review and Practice
FRQ Practice – Day 2
Resources
CSA Unit 9 Lesson 9

Name(s)_______________________________________________ Period ______ Date ___________________

Activity Guide - FRQ Practice

Station A
Do This:
● Read through the common errors at the station. Make a mental note of which ones are penalized and which
are not.
● Look through the sample solution to the FRQ. In your guide, identify the common errors for which the response
is penalized.

Common Error: Point Penalty?

Total Points Penalized:

Station B
Do This: Create a checklist of items to complete for this FRQ. Checklist items may include:
● Variables you need to create
● Conditions to check
● Whether you will need to traverse a list
● Return requirements

Part A
Station C
Do This:
● Read through the FRQ prompt, then predict the types of things that the AP scorer will be looking for when
scoring this question.
● Create a rubric in the style of the AP scoring guide below.

Part (a) 5 points

Points Rubric Criteria Responses earn the point even if Responses will not earn the point if
they… they…

2
Station D
Do This:
● Trace the FRQ response below and read through the scoring guideline at the station.
● Annotate the line(s) with the errors, and rewrite them in the space provided to correct the response in order for
it to receive full credit.

This question involves manipulating a two-dimensional array of integers. You will write a static method of the
ArrayResizer class, which is shown below.

public class ArrayResizer


{
/** Returns true if and only if every value in row r of array2D is non-zero.
* Precondition: r is a valid row index in array2D.
* Postcondition: array2D is unchanged. */
public static boolean isNonZeroRow(int[][] array2D, int r)
{ /* to be implemented in part (a) */ }
}

(a) Write the method isNonZeroRow, which returns true if and only if all elements in row r of a two-dimensional array
array2D are not equal to zero.

For example, consider the following statement, which initializes a two-dimensional array.

int[][] arr = {{2, 1, 0},


{1, 3, 2},
{0, 0, 0},
{4, 5, 6}};

Sample calls to isNonZeroRow are shown below.

Call to isNonZeroRow Value Returned Explanation

ArrayResizer.isNonZeroRow(arr, 0) false At least one value in row 0 is zero

ArrayResizer.isNonZeroRow(arr, 1) true All values in row 1 are non-zero

ArrayResizer.isNonZeroRow(arr, 2) false At least one value in row 2 is zero

ArrayResizer.isNonZeroRow(arr, 3) true All values in row 3 are non-zero

3
Complete the isNonZeroRow method.

/** Returns true if and only if every value in row r of array2D is non-zero.
* Precondition: r is a valid row index in array2D.
* Postcondition: array2D is unchanged. */
public static boolean isNonZeroRow(int[][] array2D, int r)

for (int col = 0; col < array2D.length; col++) {


if (array2D[r][col] == 0) {
return false;
}
else {
return true;
}
}
return true;
}

Scoring Criteria Decision Rules

Compares an item from Responses will not earn the point if they fail to attempt the 1 point
array2D with 0 comparison, even if they access an item from array2D

Accesses every item Responses can still earn the point even if they return early 1 point
from row r of 2D array from an otherwise correctly-bounded loop
(no bounds errors)

Returns true if and only Responses can still earn the point even if they process a 1 point
if row contains no zeros column of the 2D array rather than a row

Responses will not earn the point if they fail to return a


value in some cases

4
AP Exam Review and Practice
Mock MCQ Exam – Day 1
Resources
Java Quick Reference
Accessible methods from the Java library that may be included in the exam
Class Constructors and Methods Explanation
String Class
String(String str) Constructs a new String object that represents the same sequence of
characters as str

int length() Returns the number of characters in a String object


String substring(int from, Returns the substring beginning at index from and ending at index to - 1
int to)
String substring(int from) Returns substring(from, length())
int indexOf(String str) Returns the index of the first occurrence of str; returns -1 if not found
boolean equals(String other) Returns true if this is equal to other; returns false otherwise
int compareTo(String other) Returns a value <0 if this is less than other; returns zero if this is
equal to other; returns a value >0 if this is greater than other
Integer Class
Integer(int value) Constructs a new Integer object that represents the specified int value
Integer.MIN_VALUE The minimum value represented by an int or Integer
Integer.MAX_VALUE The maximum value represented by an int or Integer
int intValue() Returns the value of this Integer as an int
Double Class
Double(double value) Constructs a new Double object that represents the specified double value
double doubleValue() Returns the value of this Double as a double
Math Class
int abs(int x) Returns the absolute value of an int value
double abs(double x) Returns the absolute value of a double value
double pow(double base, Returns the value of the first parameter raised to the power of the second
double exponent) parameter

double sqrt(double x) Returns the positive square root of a double value


double random() Returns a double value greater than or equal to 0.0 and less than 1.0
ArrayList Class
int size() Returns the number of elements in the list

boolean add(E obj) Appends obj to end of list; returns true


void add(int index, E obj) Inserts obj at position index (0 <= index <= size), moving
elements at position index and higher to the right (adds 1 to their indices) and
adds 1 to size

E get(int index) Returns the element at position index in the list


E set(int index, E obj) Replaces the element at position index with obj; returns the element
formerly at position index

E remove(int index) Removes element from position index, moving elements at position
index + 1 and higher to the left (subtracts 1 from their indices) and subtracts 1
from size; returns the element formerly at position index
Object Class
boolean equals(Object other)
String toString()

© 2019 College Board


AP Exam Review and Practice
Mock FRQ Exam – Day 1
Resources
Name(s)_______________________________________________ Period ______ Date ___________________
Important: Completely fill in the circle that corresponds to Question 1 Question 2 Question 3 Question 4
the question that you are answering on this page.

Begin your response to each question at the top of a new page.

Use a pencil only. Do NOT write outside the box.


Java Quick Reference
Accessible methods from the Java library that may be included in the exam
Class Constructors and Methods Explanation
String Class
String(String str) Constructs a new String object that represents the same sequence of
characters as str

int length() Returns the number of characters in a String object


String substring(int from, Returns the substring beginning at index from and ending at index to - 1
int to)
String substring(int from) Returns substring(from, length())
int indexOf(String str) Returns the index of the first occurrence of str; returns -1 if not found
boolean equals(String other) Returns true if this is equal to other; returns false otherwise
int compareTo(String other) Returns a value <0 if this is less than other; returns zero if this is
equal to other; returns a value >0 if this is greater than other
Integer Class
Integer(int value) Constructs a new Integer object that represents the specified int value
Integer.MIN_VALUE The minimum value represented by an int or Integer
Integer.MAX_VALUE The maximum value represented by an int or Integer
int intValue() Returns the value of this Integer as an int
Double Class
Double(double value) Constructs a new Double object that represents the specified double value
double doubleValue() Returns the value of this Double as a double
Math Class
int abs(int x) Returns the absolute value of an int value
double abs(double x) Returns the absolute value of a double value
double pow(double base, Returns the value of the first parameter raised to the power of the second
double exponent) parameter

double sqrt(double x) Returns the positive square root of a double value


double random() Returns a double value greater than or equal to 0.0 and less than 1.0
ArrayList Class
int size() Returns the number of elements in the list

boolean add(E obj) Appends obj to end of list; returns true


void add(int index, E obj) Inserts obj at position index (0 <= index <= size), moving
elements at position index and higher to the right (adds 1 to their indices) and
adds 1 to size

E get(int index) Returns the element at position index in the list


E set(int index, E obj) Replaces the element at position index with obj; returns the element
formerly at position index

E remove(int index) Removes element from position index, moving elements at position
index + 1 and higher to the left (subtracts 1 from their indices) and subtracts 1
from size; returns the element formerly at position index
Object Class
boolean equals(Object other)
String toString()

© 2019 College Board


AP Exam Review and Practice
Mock FRQ Exam – Day 2
Resources
Name(s)_______________________________________________ Period ______ Date ___________________
Important: Completely fill in the circle that corresponds to Question 1 Question 2 Question 3 Question 4
the question that you are answering on this page.

Begin your response to each question at the top of a new page.

Use a pencil only. Do NOT write outside the box.


Java Quick Reference
Accessible methods from the Java library that may be included in the exam
Class Constructors and Methods Explanation
String Class
String(String str) Constructs a new String object that represents the same sequence of
characters as str

int length() Returns the number of characters in a String object


String substring(int from, Returns the substring beginning at index from and ending at index to - 1
int to)
String substring(int from) Returns substring(from, length())
int indexOf(String str) Returns the index of the first occurrence of str; returns -1 if not found
boolean equals(String other) Returns true if this is equal to other; returns false otherwise
int compareTo(String other) Returns a value <0 if this is less than other; returns zero if this is
equal to other; returns a value >0 if this is greater than other
Integer Class
Integer(int value) Constructs a new Integer object that represents the specified int value
Integer.MIN_VALUE The minimum value represented by an int or Integer
Integer.MAX_VALUE The maximum value represented by an int or Integer
int intValue() Returns the value of this Integer as an int
Double Class
Double(double value) Constructs a new Double object that represents the specified double value
double doubleValue() Returns the value of this Double as a double
Math Class
int abs(int x) Returns the absolute value of an int value
double abs(double x) Returns the absolute value of a double value
double pow(double base, Returns the value of the first parameter raised to the power of the second
double exponent) parameter

double sqrt(double x) Returns the positive square root of a double value


double random() Returns a double value greater than or equal to 0.0 and less than 1.0
ArrayList Class
int size() Returns the number of elements in the list

boolean add(E obj) Appends obj to end of list; returns true


void add(int index, E obj) Inserts obj at position index (0 <= index <= size), moving
elements at position index and higher to the right (adds 1 to their indices) and
adds 1 to size

E get(int index) Returns the element at position index in the list


E set(int index, E obj) Replaces the element at position index with obj; returns the element
formerly at position index

E remove(int index) Removes element from position index, moving elements at position
index + 1 and higher to the left (subtracts 1 from their indices) and subtracts 1
from size; returns the element formerly at position index
Object Class
boolean equals(Object other)
String toString()

© 2019 College Board

You might also like