Loops
Maps
Sets
Arrays
Combos
100

What are the two kinds of loops we have spoken about in class?

For loops and while loops

100

Fill in the blanks. Maps store _____:_____ pairs.

key and value

100

If I were to print set.size in the console, what would appear, if I have added 5, 11, 13, 11, 7, 9, and 32 to the set?

6

100

What index is the number 3 in the array? x = [2, 4, 3, 5, 9, 11]

2

100

True or False: An array of arrays is immutable.

False

200

Which variable in the code below is the "iterative variable?"

var x = 5

for(var z = 0; z < x; z = z + 1){

          var g = await readLineAsync("Gimme a #:")

          var y = 10

}

z

200

What appears in the console from the code below?

var my_first_map = {Anna: "Volleyball", Darcey: "Soccer",Joey: "Swimming"}

print(my_first_map["Darcey"])

Soccer

200

True or False: If I add 3, 9, and 17 to a set, I can access the number 9 by printing set[1]

False, sets are unordered
200

Write the code to remove the last number in an array called peanuts.

peanuts.pop()

200

arr = [[1, 2], [4, 9], [7, 8, 9], [2, 1]]

Write the code to access the second 9 in the array.

arr[2][2]

300

True or False: A for loop can be turned into a while loop, but a while loop cannot always be turned into a for loop.

True

300

What appears in the console from the code below?

var my_first_map = {Anna: "Volleyball", Darcey: "Soccer",Joey: "Swimming"}

print(my_first_map[0])

Error/undefined

300

Write the code to put a new value, "PC", into a set called computers.

computers.add("PC")

300

Write the code to put a value, "PC", into an array called computers.

computers.append["PC"]

300

What do I print to see what grade Joey is getting in his 3rd class?

var grades = {Anna: [97, 95, 82], Darcey: [88, 92, 75, 81], Joey: [85, 91, 99, 80]}

grades["Joey"][2]
400

How many times will the following loop print(1)?


for (var i = 1; i < 8, i = i + 3){

      print(1)

}

3

400
Write the code to print all the keys in a map called pro.

for(var key in pro){

       print(pro[key])

}

400

Write how to make an empty set called ss.

var ss = new Set()
400

The array below is super long. How would you figure out where the number 10 is in the array?

var arr = [3, 9, ..........., 67, 10, 32, ........, 11]

arr.indexOf(10)

400

Write an example of a map where the keys are letters in the alphabet and the values are words that start with that letter. Have 2 keys and 3 words for each.

{a:[apple, aardvark, antelope], b:[banana, brick, brownie]}

500

Write the while loop that is the same as the for loop below.

for(var i = 0; i < 11; i++){

}

var i = 0

while(i<11){

        i++

}

500

Write the 3 characteristics of a map? (mixedness, orderliness, and uniqueness) Be specific.

Keys must be unique, but values are non-unique.

Keys act as positional values, keys are to maps as indices are to arrays.

All keys will become strings, but values can be of any variable type.

500
You have set called Joes_classes and a set called Toms_classes. You want to see if they have any classes in common. Write the code to do so.

Joes_classes.intersect(Toms_classes)

Toms_classes.intersect(Joes_classes)

500

Write the code to add the number 3 to an array called "z" 5 times.

var z = []

for(var i = 0; i<5; i++){

          z.append(3)

}

500

Josie is working on a project to log the pressure, temperature, and humidity in her room what data structure/structures should she use to store that data in a single variable.

an array of arrays