Lists
Loops
Vocab/Traversals
Miscellaneous
100

What number represents the first index in a list in Javascript?

0

100

What is the purpose of a loop?

Loops are used in programming to repeat code efficiently.

100

An ordered collection of elements

List

100

What is the smallest prime number?

2

200

A common method for referencing the elements in a list or string using numbers

Index

200

What are the two types of loops we have learned?

Describe the differences of how they are written

For and while loops


For loop is more condensed on one line, while the while loop is separated into multiple lines.

200

An individual value in a list that is assigned a unique index

Element

200

What is the newest NFL team?

Houston Texans

300
Name the two list functions that will increase the size of a list by either adding elements or inserting them

appendItem() and insertItem()

300
how would you access 5 from the following list:

var list = [ 2, 3, 4, 5 ];

list[3]

300

Occurs when the ending condition will never evaluate to true.

Infinite loop

300

What is the chemical symbol for gold?

Au

400

What is the final value of sum after this code runs?

var nums = [2, 4, 6];
var sum = 0;
for (var i = 0; i < nums.length; i++) { 
 sum = sum + nums[i]; 
}



12

400

What are the 3 parts of a for loop?

1. counter variable , usually called i 

2. condition for loop to break

3. increment such as i++

400

A repetitive portion of an algorithm which repeats a specified number of times or until a given condition is met.

Iteration

400

Which mountain range is home to the Earth's five highest volcanoes?

The Andes

500

var data = ["A", "B", "C", "D"];


Which index accesses the last element, regardless of list size?

data.length - 1

500

What is the result of this loop?

var count = 1;

while (count >= 1) {

  console.log(count);

  count = count + 1;

}

Infinite loop

500

In your own words, describe what a traversal is and how you would create one in JavaScript.

Traversal refers to the process of visiting and accessing each element in a data structure, such as a list in a specific order. Utilizing .length in a for loop can help accomplish this task.

500

'avoir faim' what does this mean in English?

to have hunger

600

Describe two ways you access the last element in this list:

var animalsList = ["tiger", "lion", "frog"];

1st way: [animalsList.length-1]

2nd way: animalsList[2]

600

What is the final value of result after this code runs?

var nums = [1, 2, 3, 4];
var result = 0;
for (var i = nums.length - 1; i >= 0; i--) { 
 if (nums[i] % 2 == 0) { 
   result += nums[i];  
}


6

600

A list contains 100 numbers. A loop checks every number and updates a variable only when a value meets a condition.
Which two key computer science concepts are being used together?


What are iteration and selection?

600

What is the longest river in Asia?

Yangtze River

700


A program is designed to determine the minimum value in a list of positive numbers called List. The following program was written

var minimum = <MISSING CODE> 

for(var i = 0; i < List.length; i++){ 

 if (List[i] < minimum){   

 minimum = List[i]; 

 } 

}
console.log(“The minimum is” + minimum);

What should be put to replace <MISSING CODE> so that the program works as intended for every possible list of positive numbers? 

List[0]

700

var arr = [2,4,6,8];

var sum = 0;

for (var i = 0; i < arr.length; i++) {

  sum += arr[i] * i+1;

}

What does this print?

console.log(sum);

60

700

var arr = [3, 6, 9, 12];

for (var i = 0; i < arr.length; i++) {

  arr[i] = arr[i] / 3;

}

console.log(arr);

What is printed?

[1, 2, 3, 4]

700

What is anemology?

The study of wind