FRQ workshop: the 4 question types
This page needs a recent browser (with SharedArrayBuffer support). Please update Chrome, Edge, Firefox or Safari to the latest version. · Эта страница требует современного браузера (с поддержкой SharedArrayBuffer). Пожалуйста, обновите Chrome, Edge, Firefox или Safari до последней версии.
English
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 состоит из двух частей. Часть 1 — тест с множественным выбором. Часть 2 — развёрнутые ответы (вы пишете код Java вручную).
- Всегда есть 4 развёрнутых вопроса (FRQ), и они относятся к тем же 4 типам каждый год.
- Этот урок — краткая карта этих 4 типов. Знание шаблона делает экзамен гораздо менее пугающим. У вас получится!
English
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-условия,
ifи простую математику поint,double,booleanиString. - Класс не нужно проектировать — он уже дан. Вам нужно только заполнить тело метода.
- Это вопрос самого «чистого программирования». Уроки 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
}
}
English
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;
}
}
English
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;
English
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-D массив
- Вы работаете с 2-мерным массивом (сеткой строк и столбцов).
- Используются вложенные циклы: внешний цикл для строк, внутренний для столбцов.
- Распространённые задачи: просуммировать строку, просуммировать столбец, найти наибольшее значение или подсчитать совпадения. Об этом говорит Урок 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;
English
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.
Русский
Стратегия экзамена: читайте внимательно
- Прочитайте весь вопрос целиком. Подчеркните, что метод должен возвращать, и каковы его параметры.
- Посмотрите на пример таблицы, которую они дают. Она показывает, какой именно результат должен дать ваш код.
- Скопируйте заголовок метода, который вам предоставлен. Не изменяйте его имя, параметры или тип возврата.
English
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.
English
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, которую знаете из этого курса. Простой, правильный код лучше хитрого кода.
- Проверьте свою работу примерными значениями из условия перед тем, как переходить дальше.
English
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-D массив.
- Все навыки, необходимые для этих четырёх типов развёрнутых вопросов, содержатся в уроках 1–12. Потренируйтесь на каждом типе несколько раз, и шаблон станет привычным.
- Сохраняйте спокойствие, читайте внимательно и пишите знакомый код. Удачи на экзамене!
English
Common mistakes
- Match the method header exactly: the return type and the parameters.
- Read the whole prompt before you start coding.
Русский
Распространенные ошибки
- Точно соответствуйте заголовку метода: типу возврата и параметрам.
- Прочитайте всё задание целиком перед началом написания кода.
English
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.
Русский
Теперь попробуйте сами
- Попробуйте написать метод в стиле 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.
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.
Click Run to see the output here. · Нажмите Запустить, чтобы увидеть результат здесь.