diff --git a/_notebooks/2023-04-27-frqpractice2017.ipynb b/_notebooks/2023-04-27-frqpractice2017.ipynb index 4569739..ab68ef3 100644 --- a/_notebooks/2023-04-27-frqpractice2017.ipynb +++ b/_notebooks/2023-04-27-frqpractice2017.ipynb @@ -103,10 +103,32 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ - "\"image\"\n" + "a)\n", + "\n", + "+1 Constructs digitList\n", + "\n", + "+1 Identifies a digit in num\n", + "\n", + "+1 Adds at least one identified digit to a list\n", + "\n", + "+1 Adds all identified digits to a list (must be in context of a loop)\n", + "\n", + "+1 On exit: digitList contains all and only digits of num in the correct order\n", + "\n", + "b)\n", + "\n", + "+1 Compares at least one identified consecutive pair of digitList elements\n", + "\n", + "+1 Determines if a consecutive pair of digitList is out of order (must be in context of a\n", + "digitList traversal)\n", + "\n", + "+1 Compares all necessary consecutive pairs of elements (no bounds errors)\n", + "\n", + "+1 Returns true iff all consecutive pairs of elements are in order; returns false otherwise" ] }, { @@ -214,7 +236,22 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "\"image\"\n" + "a)\n", + "+1 Declares header: public class MultPractice implements StudyPractice\n", + "\n", + "+1 Declares all necessary private instance variables\n", + "\n", + "+1 Initializes all instance variables using parameters\n", + "\n", + "+1 Declares header: public String getProblem()\n", + "\n", + "+1 Builds string with current values of instance variables\n", + "\n", + "+1 Returns constructed string\n", + "\n", + "+1 Declares header: public void nextProblem()\n", + "\n", + "+1 Updates instance variable(s) to reflect incremented second number" ] }, { @@ -318,7 +355,26 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "\"image\"\n" + "a)\n", + "+1 Calls findNthOccurrence to find the index of the nth occurrence\n", + "\n", + "+1 Preserves currentPhrase only if nth occurrence does not exist\n", + "\n", + "+1 Identifies components of currentPhrase to retain (uses substring to extract before/after)\n", + "\n", + "+1 Creates replacement string using identified components and repl\n", + "\n", + "+1 Assigns replacement string to instance variable (currentPhrase)\n", + "\n", + "b)\n", + "\n", + "+1 Calls findNthOccurrence to find the index of the nth occurrence\n", + "\n", + "+1 Increments (or decrements) the value used as n when finding nth occurrence\n", + "\n", + "+1 Returns the index of the last occurrence, if it exists\n", + "\n", + "+1 Returns -1 only when no occurrences exist" ] }, { @@ -509,7 +565,21 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "\"image\"" + "a)\n", + "\n", + "+1 Accesses all elements of arr, (no bounds errors on arr)\n", + "\n", + "+1 Initializes, computes, and returns sum of elements\n", + "\n", + "b)\n", + "\n", + "+1 Constructs correctly-sized 1D array of ints\n", + "\n", + "+1 Accesses all rows in arr2D (no bounds errors on arr2D)\n", + "\n", + "+1 Computes sum of row in arr2D using arraySum and assigns to element in 1D array\n", + "\n", + "+1 Returns 1D array where kth element is computed sum of corresponding row in 2D array for all rows" ] }, {