FRQ Type 1: Methods and Control Structures

methods and control

Part of: Exam Workshop: FRQ Strategies

What This FRQ Asks The first FRQ usually hands you a described method and asks you to write its body. The rubric rewards the plumbing of control flow: setting up a loop, testing a condition, updating a running value, and returning the right answer. No classes to design, just one focused method. The Standard Pattern Most of these methods follow a count or accumulate shape. You set up a result variable, walk over a range or a String, update the result when a condition holds, and return it. Notice the AP subset String tools: length(), substring(i, i + 1) to pull one character, and equals to compare. The exam does not use charAt in its official subset, so substring is the safe way to read one character. Reading the Prompt for Clues The prompt tells you the return type and the parameters. Match them exactly. If it says the method returns a boolean, your method header and every return must produce a boolean. A frequent point comes from the header itself, so copy the given signature precisely. Here the early return true exits as soon as the answer is known, and the return false at the end covers the case where no digit was found. Both returns matter for the rubric. Key points: - Set up a

Challenge: Count Values Divisible by Three