FRQ workshop: the 4 question types · FRQワークショップ:4つの問題タイプ
The free-response section
- The AP CSA exam has two parts. Part 1 is multiple choice. Part 2 is free response (you write Java by hand).
- There are always 4 free-response questions (FRQs), and they come in the same 4 types every year.
- This lesson is a quick map of the 4 types. Knowing the pattern makes the exam much less scary. You can do this!
フリーリスポンスセクション
- AP CSA試験には2つのパートがある。パート1は多肢選択式である。パート2はフリーリスポンス(手書きでJavaを記述する)である。
- 常に4個のフリーリスポンス問題(FRQs)があり、毎年同じ4種類の形式で出題される。
- このレッスンは、4種類の形式の簡易マップです。パターンを理解すれば、試験はそれほど恐ろしくありません。あなたならできます!
Type 1: Methods and Control Structures
- You write one or two methods using loops,
if, and simple math onint,double,boolean, andString. - No class to design — the class is given. You just fill in the method body.
- This is the most "plain coding" question. Lessons 1–8 cover everything you need.
タイプ1: メソッドと制御構造
- ループ、
if、そしてint、double、boolean、Stringを用いた簡単な数学計算を使って、1つまたは2つのメソッドを記述する。 - クラスを設計する必要はない——クラスは既に与えられている。メソッド本体を埋めるだけである。
- これは最も「純粋なコーディング」の問題です。レッスン1–8で必要なすべてを網羅しています。
public class Grades {
// Count the scores that are 60 or more.
public static int countPassing(int[] scores) {
int count = 0;
for (int s : scores) {
if (s >= 60) {
count = count + 1;
}
}
return count;
}
public static void main(String[] args) {
int[] scores = {72, 40, 95, 60, 33};
System.out.println(countPassing(scores)); // 3
}
}
Type 2: Class Design
- You are given a description of a class and must write the whole class.
- That means: instance variables, a constructor, and the methods they ask for.
- Remember
privatefields, the constructor with the same name as the class, andthis.field = field. Lesson 6 covers this.
タイプ2: クラス設計
- クラスの説明が与えられ、クラス全体を記述する必要がある。
- つまり、インスタンス変数、コンストラクタ、および要求されたメソッドのことである。
privateフィールド、クラスと同じ名前のコンストラクタ、およびthis.field = fieldを思い出すこと。レッスン6でこれらを解説している。
public class Student {
private String name;
private int score;
public Student(String name, int score) {
this.name = name;
this.score = score;
}
public int getScore() {
return score;
}
}
Type 3: Array / ArrayList
- You work with an
ArrayList(or sometimes an array) and write code that traverses it. - Common jobs: find a value, count items, remove items, or build a new list.
- Watch the index carefully when you remove while looping. Lessons 9–11 cover this.
タイプ3: 配列 / ArrayList
ArrayList(あるいは場合によっては配列)を操作し、それを走査するコードを記述する。- 一般的なタスク:値の探索、アイテムのカウント、アイテムの削除、または新しいリストの作成。
- ループしながら削除する際はインデックスに注意すること。レッスン9–11でこれを解説している。
// Count the Strings longer than 3 letters.
int count = 0;
for (int i = 0; i < words.size(); i++) {
if (words.get(i).length() > 3) {
count++;
}
}
return count;
Type 4: 2-D Array
- You work with a 2-D array (a grid of rows and columns).
- You use nested loops: an outer loop for rows, an inner loop for columns.
- Common jobs: sum a row, sum a column, find the largest value, or count matches. Lesson 12 covers this.
タイプ 4: 2次元配列
- 2次元配列(行と列のグリッド)を扱います。
- ネストループを使用します: 行用の外側ループと、列用の内側ループです。
- 一般的なタスク: 行の合計を計算、列の合計を計算、最大値を見つける、または一致数を数える。Lesson 12 でこれらを扱います。
// Add up every value in the grid.
int total = 0;
for (int r = 0; r < grid.length; r++) {
for (int c = 0; c < grid[r].length; c++) {
total += grid[r][c];
}
}
return total;
Exam strategy: read carefully
- Read the whole question first. Underline what the method must return and what its parameters are.
- Look at the example table they give. It shows exactly what your code should produce.
- Copy the method header they give you. Do not change its name, parameters, or return type.
試験戦略:注意深く読む
- まず問題文全体を読んでください。メソッドが返す値とパラメータをアンダーラインで引いて確認します。
- 提供されている例表を確認します。これがコードが生成すべき出力を正確に示しています。
- 与えられたメソッドヘッダーをそのままコピーします。名前、パラメータ、返り値の型は変更しないでください。
Exam strategy: write methods that work
- Write the base of a loop first, then fill in the body. Get it running in your head step by step.
- Traverse correctly: start the index at
0, stop atlength(orsize()); check the edges. - Use
returnwith the right type. If the header saysint, return anint.
試験戦略:機能するメソッドを書く
- まずループの基本構造书写し、次に本体を埋めます。ステップバイステップで頭の中で動作させます。
- 正しくトラバースする:インデックスを
0から始め、length(またはsize())で停止します。境界条件もチェックします。 - 正しい型で
returnを使用します。ヘッダーにintとある場合、intを返してください。
Exam strategy: small wins add up
- You get points for parts that work, even if the whole method is not perfect. Always write something.
- Use only Java you know from this course. Simple, correct code beats clever code.
- Check your work with the example values from the question before you move on.
試験戦略:小さな成功が積み重なる
- メソッド全体が完璧でなくても、部分が機能していれば点数が得られます。必ず何らかの回答を書き出してください。
- このコースで学んだJavaのみを使用します。シンプルで正しいコードは、巧妙なコードより優れています。
- 次の問題に進む前に、問題文の例値を使って自分のコードを確認してください。
You are ready
- The 4 types never change: methods, class design, array/ArrayList, and 2-D array.
- Every skill you need for these four FRQ types is in lessons 1–12. Practice each type a few times and the pattern becomes familiar.
- Stay calm, read carefully, and write the code you know. Good luck on the exam!
準備完了です
- 4 のタイプは変化しません:メソッド、クラス設計、配列/ArrayList、そして 2次元配列 です。
- これら4つのFRQタイプに必要なスキルは全部で Lesson 1–12 にあります。各タイプを数回練習すればパターンが見えてきます。
- 落ち着いて、注意深く読み、知っているコードを書きましょう。試験頑張ってください!
Common mistakes
- Match the method header exactly: the return type and the parameters.
- Read the whole prompt before you start coding.
よくあるミス
- 返り値の型とパラメータを正確に一致させる: メソッドヘッダー.
- コーディングを開始する前に、問題文全体を読む.
Now you try
- Try one FRQ-style method yourself — the same shape as Type 1 above.
- Press Check answer to compile and run it on the server.
あなたも試してみよう
- Type 1 上記と同じ形状を持つFRQ形式のメソッドを1つ試してみよう.
- Check answer を押してコンパイルし、サーバー上で実行してください。
FRQ practice — Type 1 (Methods). Complete countAtLeast(int[] scores, int limit) so it returns how many values in scores are at least limit (greater than or equal). Use a loop and an if, like the worked example above. · FRQ練習 — Type 1 (メソッド)。countAtLeast(int[] scores, int limit)を完成させて、scoresの中で少なくともlimit以上(等しい場合を含む)の値がいくつあるかを返してください。上記のワークドエグザンプルと同様に、ループとifを使用してください。
Click Run to see the output here. · 実行ボタンをクリックして出力を確認してください。
FRQ practice — Type 2 (Class design). Complete the Rectangle class: store width and height from the constructor, and finish area() so it returns width × height. This is exactly what a Type 2 FRQ asks for. · FRQ練習 — Type 2 (クラス設計)。Rectangleクラスを完成させてください:构造函数からのwidthとheightを保存し、area()を完了させてwidth × heightを返すようにしてください。これはType 2 FRQが求める内容そのものです。
Click Run to see the output here. · 実行ボタンをクリックして出力を確認してください。