0% found this document useful (0 votes)
5 views3 pages

AP CS A Exam Exam Overview

The document provides strategies for tackling free response questions (FRQs) in the AP CS A exam, emphasizing the importance of reading questions first and focusing on clear code. It outlines specific coding practices, such as using provided methods and instance variables without re-declaring them, and highlights the significance of understanding string methods. Additionally, it suggests reviewing past FRQs to prepare for questions related to methods and control structures.
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)
5 views3 pages

AP CS A Exam Exam Overview

The document provides strategies for tackling free response questions (FRQs) in the AP CS A exam, emphasizing the importance of reading questions first and focusing on clear code. It outlines specific coding practices, such as using provided methods and instance variables without re-declaring them, and highlights the significance of understanding string methods. Additionally, it suggests reviewing past FRQs to prepare for questions related to methods and control structures.
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/ 3

AP CS A Exam Exam Overview

Free Response

General Strategies for FRQS:


1) Read the questions before you read the code! This will help you focus.
2) Unless a question specifically addresses efficiency, focus on clear, simple code rather than complicated,
efficient code.
3) Comments are not necessary. Use only to organize your thoughts.
4) Pay attention to the code they give you:
Ö Do you have more than one class? Use it!
Ö Did they give you methods? You will need them!
Ö Are there instance variables that you should use? If so, use them. Do not re-declare.
Ö Only use accessor and mutator methods to access private instance variables.
Ö Do not re-write or change method headers.
Ö Use parameters (names and types) as given

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

Leave Nothing Blank! Get partial credit if not full credit!


public int[] funMethod(int length){
int[] list = new int[length];

return list;
}
public ArrayList<Bug> funMethod(){
ArrayList<Bug> buggies = new ArrayList<Bug>();

return buggies;
}

More Examples

Leave Nothing Blank! Get partial credit if not full credit!


Public boolean funMethod(int something){

if(something > somethingElse)
return true;
// must have a default return; every return can’t be // locked in
an if
return false;
}
Question 1: Methods and Control Structures
See previous years’ similar FRQs:
2018 #1, 2019 #1, 2017 #3, 2018 #2, 2021#1
Methods and Control Structures

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.

AVOID using arrays/arraylists for this problem.

2019 #1 is a good example of this problem.

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

Method name Description

String(String str) Constructs a new String object that represents


the same sequence of characters as str
int length() Returns number of characters in this string

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

Returns a value < 0 if this is less than other; returns


int compareTo(String other) zero if this is equal to other; returns a value > 0
if this is greater than other
Returns index where the start of the given string appears
indexOf(str)
in this string (-1 if not found)
String method examples

// 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

System.out.println(s1.substring(7, 10)); // ”min"


System.out.println(s1.substring(12)); // ”in java”
System.out.println(s1.substring(2,3));// ”o”

String s2 = s1.substring(10, 17); // ”g in ja”

indexOf Example

indexOf can be confusing. Here’s an example.

public static mystery(String str){


String answer = "";
for(int i = 0; i < str.length(); i++){
String currentLetter = str.substring(i, i+1);
if("aeiou".indexOf(currentLetter) != -1)
answer += current;

}
return answer;
}

What is the output?


System.out.println(mystery("cat in hat"));

Answer: aia

Do Problem 2018 #2

Complete 2018 #2.


This is a good problem that uses 1D array, Arraylist, and Strings and is a good Question 1(Methods/Control
Structures) type of problem.

Also do the following 2018 #1, 2019 #1, 2017 #3, 2021 #1 to prepare for Question 1.

You might also like