Rohin Notes

  • methods and Control Structures
  • Defining methods and return types
  • Control Structures
    • Conditionals and loops
  • Accessing variables
  • Recursion
    • recursive calls
  • Apply conditionals, define and call methods

2022 FRQ

  • GetPoints method returns score for recently played game (Bonus functionality)
    • Conditional checks for if the levels are reached and adds up points and uses multiplier
  • Play many times
    • Adds point values

0.85/1 because of very long presentation (about 5 minutes) 1/1 if length is acceptable

Vishnu Notes

2021 Problem 4

  • Method isNonZeroRow:
    • Parameters: array2D (a 2D integer array), r (an integer representing the row index)
    • Functionality:
      • Checks if a specific row (r) in the 2D array has any zero elements.
      • It iterates over the elements of the specified row and returns true if all elements are non-zero, and false otherwise.
  • Method resize:
    • Parameters: array2D (a 2D integer array)
    • Return Type: 2D integer array
    • Functionality:
      • Creates a new 2D array that contains only the rows from array2D that have all non-zero elements.
      • Calls numNonZeroRows to get the number of rows with all non-zero elements.
      • Creates a new 2D array resizedArray with the size of non-zero rows.
      • Iterates through array2D, checks each row using isNonZeroRow, and adds rows with all non-zero elements to resizedArray.
      • Returns the resulting resizedArray.

Feedback

  • Since me and Vishnu both went over 2d arrays, we decided to collabarate and give each other feedback
  • These are some questions Vishnu asked me to give me feedback: How does the representation of candies in a 2D array compare to real-world scenarios where grid-like structures are used, such as board games or seating arrangements? In the removeNextByFlavor method, the traversal starts from the last row. How would the method change if the traversal started from the first row? Further Exploration: How can the current implementation be extended to handle more complex scenarios, such as having multiple flavors or adding functionalities like sorting candies based on flavors?
    • The 2D array representation of candies resembles real-world scenarios because its simple showing a box of candy with rows and columns and pieces of candies within a square of the grid.
    • In the removeNextByFlavor method, if traversal started from the first row a different behavior in terms of which candy with the specified flavor is removed first, potentially prioritizing candies in the top rows.
    • Implement sorting algorithms like bubble sort, quicksort, or merge sort to rearrange the candies based on their flavors. Maybe allow the user to put all the types of certain candy in a certain row/column.
    • To add functionalities for more complex scenarios I could introduce a mapping of flavors to colors or types, adding more to the candy properties and sort based off of these properties as well
  • Here is some of the feedback I gave Vishnu: Your code is very close to the canonical solution, so there isn’t much to change. I would just add the functionalities such as using additional data types, not just integers. You could also add a method to resize the 2D array to contain only the rows with all elements that are in a certain order, such as ascending or descending order. You could also implement more user interaction, such as the user inputting their own 2D array, and then resizing it based on certain values they want to filter out. If you do that, a change to an existing methods that I would like to see is handling null or faulty inputs.

Akshat Notes

FRQ 2022 #2

  • Textbook Class (subclass of Book):
    • Inherits from the Book class.
    • Additional attribute: edition (int)
    • Constructor: Takes title, price, and edition as parameters, calls the superclass constructor, and initializes the edition.
    • Methods:
      • getEdition(): Returns the edition of the textbook.
      • getBookInfo(): Overrides the superclass method to include edition information.
      • canSubstituteFor(Textbook other): Compares title and edition to check if the current textbook can substitute another.
  • Main Method:
    • Creates instances of Textbook.
    • Calls methods to display book information and check if one textbook can substitute for another.

Vardaan Notes

FRQ 2023 3

  • Part A
    • The attempt starts the loop to iterate through the temperatures list but has a missing condition in the for loop declaration (the loop doesn’t have an increment statement).
    • The correct code iterates through the temperatures ArrayList in reverse order to safely remove elements while maintaining the order of remaining values.
    • It correctly checks if each temperature is outside the specified range [lower, upper].
  • Part B
    • The attempt starts with the correct approach of iterating through the temperatures list and counting consecutive days above the threshold.
    • However, the return statement is inside the loop, causing the method to return after the first day above the threshold, which is incorrect.
    • The correct code initializes and updates thevariables to keep track of the current heat wave length and the maximum observed heat wave length.
    • It iterates through the array of temperatures, incrementing the heat wave length for each day above the threshold and resetting it to zero for days below the threshold.