1D & 2D Arrays
Functions & Methods
Recursion
Searches & Sorts
Trace the Output
100

On the TExES 241, the first element of any array is found at this index number.

What is 0 (zero)?

100

This kind of named code block performs a task but does NOT return a value (example: printing numbers).

What is a procedure?

100

Recursion is similar to this control structure because both repeat portions of a program (but recursion differs in HOW it repeats).

What is a loop?

100

This search starts at one end of an array and checks every location until the target is found or all locations are checked.

What is linear search?

100

Given nums = {3, 6, 9, 12, 15}, a loop adds each value where (nums[i] mod 2 == 0). This value is printed.

What is 18 (the even values 6 + 12)?

200

In a 2D array, these two things are organized by the outer loop and the inner loop, respectively.

What are rows (outer loop) and columns (inner loop)?

200

Unlike a procedure, this kind of code block returns a value back to where it was called.

What is a function?

200

This is how you know a method is recursive: it contains a call to this.

What is itself (the method calls itself)?

200

This sort repeatedly finds the smallest unsorted value and swaps it to the front of the unsorted portion.

What is selection sort?

200

For the jagged array grid = {{1,2,3}, {4,5}, {6,7,8,9}}, nested loops add every element. This total is printed.

What is 45?

300

This is the name for a 2D array whose rows do NOT all have the same length.

What is a ragged (jagged) array?

300

A function or procedure associated with an object or class in OOP is called this.

What is a method?

300

Like a loop, recursion has these four parts.

What are Start, Check, Action, and Step?

300

This sort takes the next element and shifts it left into its correct position among the already-sorted elements.

What is insertion sort?

300

For matrix = {{2,4,6}, {1,3,5}, {0,8,9}}, summing matrix[i][i] across the main diagonal prints this value.

What is 14 (2 + 3 + 9)?

400

This programming structure, a loop placed inside another loop, is used to visit every element of a 2D array.

What are nested loops?

400

This part of a method, of the form return_type identifier(parameters), is also called the signature.

What is the method header?

400

These are the two types of recursive methods.

What are return methods and void methods?

400

These are the four sorts you must know for the TExES 241.

What are selection sort, insertion sort, merge sort, and quicksort?

400

linearSearch(array, target, size) scans an array of the given size from index 0 and returns the index of the FIRST element equal to target (or -1 if not found). Given nums = {4, 9, 15, 6, 9, 2}, the call linearSearch(nums, 9, 6) searches all 6 elements for the value 9. What index value is returned and printed?

What is 1 (the index of the first 9)?

500

These are the four common array patterns taught in the Day 1 review.

What are search, reverse, sum, and swap?

500

When a copy of the argument is sent so changes inside the method do NOT affect the original variable, the parameter is passed this way.

What is pass by value (passing by value)?

500

Recursion uses lots of memory, so too many calls can cause this error and crash everything.

What is a stack overflow?

500

Quicksort recursively sorts the numbers around this chosen reference value.

What is a pivot?

500

searchCount(array, target, size) scans an array of the given size from index 0 and counts how many elements it examines (inclusive) up to and including the first element equal to target. Given nums = {8, 3, 11, 7, 5}, the call searchCount(nums, 7, 5) searches for the value 7. How many elements are examined before (and including) finding the target?

What is 4?