Data Abstraction & Lists Concepts
Indexing and Length
List Operations
Loops & Boolean Expressions
Procedures and Return
Gomez Style Questions ( Worth triple)
100

This concept helps manage complexity by grouping related data into a single structure.

What is DATA ABSTRACTION?

100

Given primes ← [2, 3, 5, 7, 11], DISPLAY(primes[LENGTH(primes)]) shows this value.

What is 11?

100

This operation adds an element to the end of a list.

What is APPEND(list, value)?

100

This operator returns the remainder and is used to check odd/even numbers.

What is MOD?

100

This keyword sends a value back to the caller (HINT: think of the reporter block).

What is RETURN?

100

What will be displayed when this program runs?
primes <- [1, 5, 7, 11, 13]

DISPLAY(primes[LENGTH(primes)])

What is 5?

200

Using a list instead of separate variables makes this easier when processing data.

What is ITERATION?

200

 In AP CSP pseudocode, list indexing starts at this value.

What is 1?

200

 What is the result of INSERT(letters, 1, "A") when letters ← ["B", "C"]?

What is ["A", "B", "C"]?

200

Fill in the condition to test if n is odd: IF ( ______ ).

What is n MOD 2 = 1?

200

 In an average-calculating procedure, RETURN total/size belongs here.

What is after the loop but before the end of the procedure?

200

What change can be made so that the procedure will work?
PROCEDURE countNumOccurances(myList, val)
{

      FOR EACH item IN myLIST

      {

            count <- 10

            IF(item = val)

            {

                count <- count - 1

      }

    }

 RETURN(count)

}

What is change line 5 to be between line 2 and 3?

300

Two lists that store related data at matching indexes are called this.

What are PARALLEL LISTS?

300

 Fill in the stop condition: REPEAT UNTIL ( ______ ) to print all elements when index starts at 1.

What is index = LENGTH(list) + 1?

300

After REMOVE(folks, 1) and APPEND(folks, "Mary") on ["Peter","Paul","Mary"], what is folks?

What is ["Paul","Mary","Mary"]?

300

To count multiples of 3, fill in: IF ( ______ ).

What is number MOD 3 = 0?

300

 Placing RETURN sum inside the loop causes this incorrect behavior.

What is returning early after the first iteration?

300

This procedure calculates the overall average of all grades in a nested list of students and their scores. It requires two loops: one for students and one for their grades. What is the correct approach to compute the average?

What is summing all grades and dividing by the total count of grades using nested loops?

400

DAILY DOUBLE: You need to store each student’s name and all their quiz scores together. Name one valid list-based design.

What is a nested list or list of pairs?

400

DAILY DOUBLE: pets ← ["dog", "cat", "fish", "bird"]. What does DISPLAY(pets[LENGTH(pets) - 1]) show?

What is "fish"?

400

 DAILY DOUBLE: 

Avengers <- ["Captain America", "Hulk", "IronMan", "Black Widow", "Hawkeye"]

APPEND(Avengers, "Thor")

REMOVE(Avengers, 1)

INSERT(Avengers, 1, Spiderman)

Display(Avengers, 2)

What is "Hulk"?

400

 DAILY DOUBLE: To track the smallest value while traversing grades, complete: IF ( ______ ).

What is g < lowest?

400

DAILY DOUBLE: Given mystery([10,6,5,12],3,9), what is the returned list?

What is [30,9,15,9]?

400

This control structure is required when an algorithm must examine every element in a list and selectively add only those that meet a condition, such as students earning honor roll status.

What is a loop with a conditional (iteration + selection)?

500

Creating a reusable procedure like checkVitals(patient) is an example of this abstraction.

What is procedural abstraction?

500

For a list of length 8, a loop that increments i by 2 starting at 2 displays these positions.

What are 2, 4, 6, and 8?

500

Removing elements while looping forward through a list causes this bug.

What is skipping elements due to index shifting?

500

 Given nums ← [21, 4, 10, 15, 30, 7], counting number MOD 5 = 0 gives this result.

What is 3?

500

In findMaxNumber, when number > maximum, this assignment updates the tracker.

What is maximum ← number?

500

This expression correctly accesses the last element of a list in AP CSP pseudocode, regardless of the list's size.

What is list[length(list)]?