Skip to main content
Logo image

Section 15.4 FRQ 1B - Strings - Part 1

From the 2025 Course and Exam Description:
Free-Response Question 1: Methods and Control Structures. Students will write two methods or one constructor and one method of a given class based on the provided specifications and examples. In Part A (4 points), the method or constructor will require students to write iterative or conditional statements, or both, as well as statements that call methods in the specified class.
In Part B (3 points), the method or constructor will require calling String methods.
FRQ 1B requires the following skills:
Teacher Insights
  • You do not need to include import statements. You can assume that any standard Java class is already imported.
  • You will NEVER print. If you think you need to print, you probably need to return something.
  • You will NOT need to write a main.

Subsection 15.4.1 String Methods

The following methods are on the quick reference, which you can view on the College Board Website.
Figure 15.4.1.
There are other methods in the String class that may also be helpful while writing FRQs, but it is important to remember that all FRQs can be solved using just the methods in the Quick Reference. If you use a method that is not on the Quick Reference, you must use it correctly to earn points.
The following activities can all be solved with just the methods in the Quick Reference.

Subsection 15.4.2 String Method - EmailParser

Activity 15.4.1.

Write the getDomain method for the EmailParser class. This method is intended to isolate the server information from a full email address.
The getDomain method takes one parameter, a String called email. The method should identify the location of the "at-symbol" (@) and return only the portion of the string that appears after that symbol.

Subsection 15.4.3 String Method - Phone Processor

Activity 15.4.2.

Write a method called getAreaCode that extracts the 3-digit area code from a formatted phone number. The area code will be the three digits between the parentheses.

Subsection 15.4.4 String Method - Letter Identifier

Activity 15.4.3.

Write a method called isVowel that checks if a given String represents a single vowel. If the letter does not have a length of 1, the method should return false.

Subsection 15.4.5 String Method - Create User Name

Activity 15.4.4.

This class creates a username by taking the first letter of the first name and the first five letters of the last name. It uses an if statement to handle cases where the last name is shorter than five characters.

Subsection 15.4.6 String Method - Tag Parser

Activity 15.4.5.

A common task is extracting text between two delimiters (like HTML tags). Uses indexOf to find the start and end and substring to grab what’s in the middle. Return "not found" if the the tags are not found, not balanced, or backwards

Subsection 15.4.7 String Method - Swap Strings

Activity 15.4.6.

This class takes a two-word string (separated by a space) and returns a new string where the words are swapped. Use indexOf to find the pivot point and length() to ensure there is actually a second word.
You have attempted of activities on this page.