Lists
Conditionals
Loops
Procedures
100

_________ is the word we use to describe the items in a list, and ________ is the word we use to describe where the items are in that list.

What is element?

What is index?

100

This type of value can be in one of only two states. It is named after some guy.

What is a Boolean value?

100

Describe the condition that would need to be met for this for loop for terminate.

for (var i = 0; i < 100; i++)

{

doSomeStuff;

}

What is i becomes 100?

100

We might declare procedures in our program (which gives the procedure a name and describes what it does), but we have to do this to actually use the procedure.

What is call?

200

Consider the following program segment. What is the value of the elements in odds after it executes?

var odds = [1, 3, 5, 7, 9]

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

odds[i] = odds[i] + 1


What is [2, 4, 6, 8, 10]?

200

A NAND gate is a type of logic gate that produces an output of FALSE only when its two inputs are TRUE. Otherwise, the gate produces an output of TRUE. These two Boolean expressions correctly model a NAND gate with inputs P and Q. (You must give two equivalent Boolean expressions.)

What are "NOT (P AND Q)" and "(NOT P) OR (NOT Q)"?

200

What is this code doing?

value1 ← 0

value 2 ← 0

for EACH num in numbers

{

value1 ← value1 + num

value2 ← value2 + 1

}

value3 ← value 1 / value2

What is "calculating the average of the values in the list?"

200

Consider the following procedure:

function calculateGrade(studentGrade);

{

studentGrade = 75

}

What is the term used to describe "studentGrade" in this function? (Hint: I made an analogy between these and the inputs of functions in math.)

What is a parameter?

300

What is the value of snacks after the following code is run?

snacks ← ["donut", "french fries", "candy", "popcorn", "candy", "grapes", "apples", "banana"]

REPEAT UNTIL (j = 5)

{

snacks[j] ← j+4

j ← j+1

}

What is 5, 6, 7, 8, candy, grapes, apples, bananas?

300

The following code segment is intended to set min equal to the minimum value among the integer variables x, y, and z. The code segment does not work as intended in all cases.

These initial values for x, y, and can be used to show that the code segment does not work as intended. (There are infinitely many possible correct responses.)

Example response:

What is x = 100, y = 200, and z = 300?

300

What is the value of x after the following code segment executes?

x ← 10

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

x ← x+4


What is 30?

300

This is the word used inside a procedure that will immediately exit that procedure (and perhaps send back a specified value to the part of the program where the procedure was originally called).

What is return?