AP CS A Exam Exam Overview
AP CS A Exam Exam Overview
Free Response
5) If part (b) references a method written in part (a), you will likely need to use this method. If it is not clear to
you how, stop and think before you write.
6) Pay attention to the return type. If it is not void, be sure to include a return statement!
7) If a method comment says /* Implementation not shown */. You do not to implement the method. But
you'll likely need to use the method in your code at least once.
8) Write down some code for every question! Leave Nothing Blank! Get partial credit if not full credit!
Ö does it need a loop?
Ö an if statement?
Ö return statement or assignment statement?
Example 1:
public double funMethod(){
double result;
…
return result;
}
More Examples
More Examples
Question 1 of the FRQ will likely ask you to write methods that utilize control structures(for vs while loops,
conditionals).
You are given (usually static) methods with parameters and will be asked to write a method that calls one of
the given methods in its implementation.
If a method comment says /* Implementation not shown */. You do not to implement the method. But you'll
likely need to use the method in your code at least once.
Likely you will need to use for loops and if-else if-else conditionals.
Likely your method will return some value. See its return type in its header.
Using Strings and its methods can be required here in this question(or Question 2).
See for example 2017 #3 for a String question that fits "Methods and Control Structures" question.
You should know how to use substring(int beg, int end), substring(int beg), indexOf, equals, length and
compareTo methods. See the College Board reference sheet.
String methods
substring(index1, index2) Returns the characters in this string from index1 (inclusive)
or to index2 (exclusive);
substring(index1) if index2 is omitted, grabs till end of string
boolean equals(String other) Returns true if this is equal to other; returns false otherwise
// index 0123456789012345678
String s1 = ”programming in java";
System.out.println(s1.length());
// 19
System.out.println(s1.indexOf(“i")); // 8
System.out.println(s1.indexOf(“gram")); // 3
System.out.println(s1.indexOf(“hi")); // -1
indexOf Example
}
return answer;
}
Answer: aia
Do Problem 2018 #2
Also do the following 2018 #1, 2019 #1, 2017 #3, 2021 #1 to prepare for Question 1.