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 يتكون من جزئين. الجزء 1 هو اختيار متعدد. الجزء 2 هو إجابة حرة (تكتب جافا يدوياً).
- هناك دائمًا 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–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 (شبكة من الصفوف والأعمدة).
- تستخدم حلقات متداخلة: حلقة خارجية للصفوف، وحلقة داخلية للأعمدة.
- المهام الشائعة: جمع صف، جمع عمود، إيجاد أكبر قيمة، أو عدّ المطابقات. درس 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.
استراتيجية الامتحان: المكاسب الصغيرة تتراكم
- تحصل على نقاط لأجزاء تعمل، حتى لو لم تكن الطريقة كاملة مثالية. اكتب دائمًا شيئًا.
- استخدم فقط جافا تعرفها من هذا الكورس. الكود البسيط والصحيح يتفوق على الكود الذكي.
- تحقق من عملك مع قيم المثال من السؤال قبل الانتقال.
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.
- كل مهارة تحتاجها لهذه الأنواع الأربعة موجودة في دروس 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.
الآن جرب بنفسك
- جرب طريقة بأسلوب 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 — النوع 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 — النوع 2 (تصميم الفئة). أتمم فئة Rectangle: احفظ width وheight من البناء، وأتمم area() لتُرجع العرض × الارتفاع. هذا بالضبط ما يسأل عنه نوع FRQ 2.
Click Run to see the output here. · اضغط تشغيل لرؤية المخرجات هنا.