APCSP.CodeHS with JS.Unit 7-Basic Data Structures v2

0%Big Idea 2 Mastery
0%Exam Mastery
Build your Mastery score
multiple choiceAP Practice
Supplemental Materials
call kaiCall Kai
Card Sorting

1/22

Last updated 1:04 PM on 9/16/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat
Add student to class section state
Add studentsNo students in these sections. Invite them to track progress!

23 Terms

1
New cards

What is an array?

An ordered collection used to store multiple values of the same type in a single data structure. Also called a "list"

2
New cards

An array is created like:

var arrayName = [12, 15, 19, 13];

<p>var arrayName = [12, 15, 19, 13];</p>
3
New cards

An array's outer bounds are defined by:

square brackets

<p>square brackets</p>
4
New cards

Each element in an array is separated by:

commas

<p>commas</p>
5
New cards

Do arrays maintain order?

Yes. Arrays have numerical indexes. Indexes in arrays will ALWAYS start with 0.

<p>Yes. Arrays have numerical indexes. Indexes in arrays will ALWAYS start with 0.</p>
6
New cards

An index in an array starts with the number

0

<p>0</p>
7
New cards

To assign "Sarah" to element 1 in an array would look like:

names[1] = 'Sarah';

<p>names[1] = 'Sarah';</p>
8
New cards

What will the .length property of an array do?

The number of items in the array.

<p>The number of items in the array.</p>
9
New cards

What does the arrays push( ) method do?

Adds a new item to the end of an array. To do this, add ".push" after the name of the array and inside parentheses, enter the name of the item you want to add.

We can add as many items as we want to an array using push. We can add them to in separate push method statements or the same statement.

<p>Adds a new item to the end of an array. To do this, add ".push" after the name of the array and inside parentheses, enter the name of the item you want to add. </p><p>We can add as many items as we want to an array using push. We can add them to in separate push method statements or the same statement.</p>
10
New cards

What does the array pop( ) method do?

It removes the last element of an array. Write the name of the array and add .pop( );

<p>It removes the last element of an array. Write the name of the array and add .pop( );</p>
11
New cards

What is an "object"?

A set of attributes (or characteristics) describing a construct.

12
New cards

What does AP Pseudocode array index start at?

1

13
New cards

Which of the following will, in AP Pseudocode, create an empty list?

aList

14
New cards

What method can we use to find the index of a particular element in an array?

.indexOf

15
New cards

var groceries = ["milk", "eggs", "bread", "cheese", "yogurt", "sugar"];

Given the above, what will be the result of groceries.indexOf("cake"); ?

-1

16
New cards

Consider the following AP Pseudocode segment:

arrList ← [17, "Karel", false, true, "hello"]

Which element can be found at index 2?

Karel

17
New cards

Traversing (or looping) through an array means to:

loop through an array and access each of the elements. Caution must be taken to avoid looping beyond the valid index values

18
New cards

heuristic

an approach to a problem that produces a solution that is not guaranteed to be optimal but may be used when techniques that are guaranteed to always find an optimal solution are impractical.

aka “rule of thumb”

19
New cards

splice() method

changes the contents of an array by removing or replacing existing elements and/or adding new elements.

20
New cards

algorithm efficiency

an estimation of the number of computational resources used by an algorithm. Efficiency is typically expressed as a function of the size of the input.

21
New cards

said to run in a “reasonable” amount of time:

Algorithms with a polynomial efficiency or slower (constant, linear, square, cube, etc.)

22
New cards

models

physical or virtual representations of an object.

23
New cards

simulations

test a hypothesis of a situation using a model.