This guide organizes advice from past students who got 4s and 5s on their exams. We hope it gives you some new ideas and tools for your study sessions. But remember, everyone's different—what works for one student might not work for you. If you've got a study method that's doing the trick, stick with it. Think of this as extra help, not a must-do overhaul.
- Students are asked to write code about methods and control structures, classes, array lists, and 2D arrays
- 50% of Exam Score
- 90 min, or 22 minutes per question
- 4 questions
- FRQ 1 – Methods and Control Structures
- FRQ 2 – Classes
- FRQ 3 – Array/ArrayList
- FRQ 4 – 2D Array
Tips on mindset, strategy, structure, time management, and any other high level things to know
- Even if you have NO IDEA what to do on the FRQ, make sure to copy the method header EXACTLY as it appears in the question as this will usually get you a point!
- It's perfectly fine to make minor mistakes! You won’t be penalized for tiny things like forgetting brackets where indentation is clear, using = instead of ==, missing parentheses around if and while conditions, or missing semicolons. Don’t worry if you forget!
- Always name your variables in a way that reflects their purpose; this will help the graders understand them. Avoid using single characters to name your variables unless it’s in a loop.
- While efficiency is good, if shortcuts and certain algorithms confuse you, don’t use them. Unless you somehow rewrite a built in function, you will not lose points for using the strategy that is easiest for you. (for vs. enhanced for loops etc.)
- Keep track of time, and don’t spend too much time on one question. If you’re stuck, try going on and coming back to your code later.
- If on one of the free-response questions, you just don’t know what to write (as in the actual algorithm to write), try to write a general outline of it even if it isn’t working code at all. While you definitely won’t get all the points, there are still quite a few points for traversing correctly, initializing variables correctly, and returning the correct value (for example), so even an outline is better than nothing.
- You don’t need to get all the points at all! You can miss a couple points but still get a 5! It’s You just need ~80%, not a full score!
- Go through all the past papers FRQ on the college board website - especially the years 2018- 2023. They cover all types of questions in all possible formats. They also have the scoring guidelines and the mistakes that students have made. It’s super helpful!
- Do the last FRQ first (or at least look at it and think about it) since It takes a long time, and missing it will cost you more than missing part of another one.
- Class types, through loops, and asking for an output are big on the test, so make sure you know how to follow a loop/nested loop.
What should a student do in the first few minutes, before they start writing?
- Always always ALWAYS make sure you know exactly what the question is asking. Read over the question, and write down what kind of things they are looking for.
- Read through what methods/variables/classes you have to work with and what they do, and try to work through how they will tie in with the finished code.
- Make sure to know what the question is asking you to return.
- A lot of people lose points either because they return the wrong thing, don't return anything when they should, or return something from what should be a void method.
- It might be helpful to make a list of what you need to do or write out pseudocode before starting the FRQ.
- Check your "cheat sheet" of methods and make sure you're familiar with it. you can use any of those methods on your FRQs, and you probably will need to multiple times.
- If there are already methods defined, make sure to use those instead of writing your own!
- Pay attention to for / while loop limits, and avoid using break or continue.
- Pay close attention to if/what is meant to be returned, and make sure your variable types match!
- In addition to the points above, each sub-part in the question will mention something like “To get full credit for this method you must use the method xyz”. Watch out for these phrases in EACH sub-part. This is true for FRQs 3 and 4 as well!!
- These can be of two types - a single-class question (AP 2018, 2019, 2021, 2023 Question 1) or a multi-class question (AP 2022 Question 1). All questions in question 1 generally touch upon the basic concepts of Conditional statements (if and if-else), loops (while, for, nested loops), and/or Strings.
- If you are required to call another method - if that method is in the same class, you will call the method directly. In a multi-class question, if you are required to call the method of another class then use the appropriate instance to call the method of that class or the class name if the method is static.
- Be careful of when you return - especially when loops are involved. Note that when you return inside a loop, the loop and the method terminate.
- The commonly asked algorithms in question 1 are searching (linear search), finding the maximum and or minimum, counting certain types of occurrences, etc.
- It is super easy to get lost in long class definitions and question prompts! Take your time, read thoroughly, and, if necessary, write down your understanding of the prompt in easy to understand bullet points of scratch paper. Make sure you understand how all aspects of a class work together before you start writing.
- Pay attention to whether variables and methods are static or not, or private or public. Also pay attention to child/parent dynamics, including overloading methods and variables.
- Class creation questions have been so far of generally 3 types. There are no sub-parts in this question, unlike the other FRQs.
- Single Class question - Only one class in the entire question which they have told you to create. Refer AP 2019 Question 2, AP 2023 Question 2, AP 2010 Question 2
- Multi-Class question - One of the classes is created for you. They tell you to create another class which usually has instance variables based on the class given to you. Refer AP 2021 Question 2 for reference
- Inheritance-based question - The base class is given to you, you need to create the derived class. Refer AP 2022 Question 2 for reference
- For questions of type 1 and 2 above, always do the following in your test booklet. Just doing these itself correctly, gives you almost 50% of the score.
- Underline the class name to be created.
- See the like where they create the object/s. This will give you information about the constructor/s in the class.
- Note down all the method calls being made. In doing so, check the parameter types and the type of value being returned and write the method headers.
- Based on the constructor and the methods, you will create the instance variables. DO NOT forget to make them private
- For inheritance-type questions, they’ll tell you to create the derived class. In addition to the above points for question types 1 and 2, make note of the following while creating it.
- Under the class name to be created. This class will extend the base class given. Make sure you use the extends keyword
- DO NOT create instance variables for the information that is already present in the base class.
- Inside the constructor of the derived class, you will call the base class constructor using super
- If you are told to OVERRIDE a method, pay attention to the description if it requires to call the base class method inside it. Again the keyword super will be needed for the same.
- To access any member of the base class, you will use the methods available in it and call those methods directly.
- Remember the basics here: it’s not NEARLY as important to do something such as define your Array(List) correctly as it is to get the for loop that iterates through it correctly.
- However, be sure that your array(list) is of the correct type: sometimes people either autopilot in the moment or forget altogether to specify the arraylist < TYPE >.
- Make sure not to confuse ArrayLists and arrays! Use the appropriate access and setting.
- Make sure you understand the difference with the methods/functions associated with Arrays vs ArrayLists, and how using them is different! Look at the reference sheet!
- If you are being told to write the constructor of the class in question, you might have to create the memory for the array or ArrayList using new. Make sure you read the instructions for the same.
- You can get ArrayList/Array questions of three types
-
String-based (AP 2019 question 3 for reference): Just be careful of the difference between array and ArrayList.
Accessing - in arrays we use [], and in ArrayLists we use the get() method
Modifying a value - in arrays, we do arr[position] = value, whereas in ArrayLists we do nameofthearrayList.add(value)
-
Primitive datatype (int or double) - Note the same things as in bullet point 1 above, but note that for ArrayList you need to use the wrapper classes Integer (for int) and Double (for double).
-
Objects of another class (Multiclass question) - If you are going through an array of objects be careful to do the null check to avoid NullPinterException.
Array Example:
class Student {
public Student(String name) {
……..
}
public String getName() {
……
}
class School {
private Student[] students;
public void performAction(){
// Below is an example to access the name of the first object in the array
String name = students[0].getName();
// Below is an example to add an object to a position
students[0] = new Student(“Ron”);
// To go through an array of objects
for(int i = 0 ; i < students.length; i++) {
if(students[i] != null) {
System.out.println( students[i].getName());
}
}
ArrayList example:
class Student {
public Student(String name) {
……..
}
public String getName() {
……
}
class School {
private ArrayList<Student> students;
public void performAction(){
// Below is an example to access the name of the first object in the array
String name = students.get(0).getName();
// Below is an example to add an object to a position
students. add(new Student(“Ron”));
// To go through an array of objects
for(int i = 0 ; i < students.size(); i++) {
System.out.println( students.get(i).getName());
}
- In ArrayList, be careful of the remove method. Run the loop from the last element so that you don’t skip some elements because the indexes of all subsequent elements change by one when a list element is removed.
If you run the loop from position 0, you need to take i one position back as in the example below:
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);
i - -;
}
}
return myList;
}
- With 2D arrays, it can be very easy to mix up rows and columns, make sure you are always working with the assumption of row-major order!
- Don’t get overwhelmed by the fact that it has two layers, you will use the same skills you use for normal arrays.
- Similar to 1D arrays, if the question is about a 2D array of objects, be sure to do the null check as you go through the 2D array.
- You will need a single for loop if you have to go through a specific row or column of a 2D array.
- You will need a nested loop to go through all the elements of the 2D array.
- To get a row of a 2D array called mat, you need to write mat[rownumber]
- Similar to in question 3, if you are told to make the constructor, be careful of allocating memory using new.
- Common question types are as follows:
-
2D array creation (AP 2021 Qn 4 Part B, AP 2019 Qn 4 Part A, AP 2022 Qn 4 Part A)
-
Going through a certain row/column (AP 2021 Qn 4 Part A, AP 2019 Qn 4 Part B, AP 2023 Qn 4 Part A)
-
Go through the entire 2D array
i. Row by Row - Row Major order ( AP 2023 Qn 4 Part B)
ii. Column by Column - Column Major order (AP 2022 Qn 4 Part B)
iii. Row major alternated (AP 2013 Qn 4 Part A)
- Do not define variables that are in function calls! It can be easy to forget, but those are already defined, use the names in the function.
- In array, String, or ArrayList-based questions it is common to write code that generates an IndexOutOfBoundsException. Be careful of your loop conditions to avoid this.
- Searching is very commonly asked. A common mistake is to write code in this wa
for(int i =,..........) {
if(.....//Searching condition ){
return true;
} else {
return false;
}
}
- This code will immediately return true or false after checking the first value of the data structure you are going through. The correct thing will be to do the following:
for(int i =,..........) {
if(.....//Searching condition ){
return true;
}
return false;
}
- String comparison needs to be made using the equals method and not using “==”.
- Math.random is tested quite often. Many mistakes are made in this. Know its proper usage to generate a random integer between a range.