WorksheetsAP CSP Unit 6
Total questions: 20
Worksheet time: 22mins
the process of accessing each item in a list one at a time
Traversal
Iteration
Selection
Sorting
What is a List in the context of programming?
An unordered collection of elements.
An ordered collection of elements.
A type of variable that can hold only one value.
A method for sorting data.
A counting variable to set an initial value, a Boolean expression, and a statement that increases or decreases the variable being checked are all parts of a(n) _______
Loop
Function
Condition
Array
An individual item in a list that is assigned a unique index....
Element
Node
Attribute
Value
The first item in a list has an index of .....
-1
1
0
2
What does the ++ command do?
Adds 1 to the count
Subtracts 1 from the count
Multiplies the count by 2
Divides the count by 2
The program is designed to determine the minimum value in a list of positive numbers called numList. Which of the following can be used to replace <MISSING CODE> so that the program works as intended for every possible list of positive numbers?
0
1000000
numList.length
numList[0]
myList = [5, 3, 12, 7, 19, 20, 23]. myList.length will return a value of ___
5
6
7
8
Which of the following programs will result in filteredNames only containing the names of students who are 17 or older?
const filteredNames = students.filter(student => student.age >= 17).map(student => student.name);
const filteredNames = students.filter(student => student.age < 17).map(student => student.name);
const filteredNames = students.map(student => student.name).filter(name => name.length > 3);
const filteredNames = students.filter(student => student.age === 17).map(student => student.name);
An ordered collection of elements is a....
List
Array
Set
Dictionary
When the Boolean expression becomes false, the loop ______.
Ends
Continues
Pauses
Restarts
Which of the following is NOT a possible combination of values of the variables in this program when it finishes running?
tails has a value of 0 and heads has a value of 100,
tails has a value of 100 and heads has a value of 0,
tails has a value of 20 and heads has a value of 20,
tails has a value of 50 and heads has a value of 50
tails has a value of 20 and heads has a value of 20
tails has a value of 0 and heads has a value of 100
tails has a value of 100 and heads has a value of 0
tails has a value of 50 and heads has a value of 50
How do you create a list?
By creating a variable and using brackets.
By using a loop to iterate through elements.
By defining a function that returns a list.
By importing a list module from a library.
myList = [9, 10, 11, 12, 13, 14]. What commands are needed to find the average of my list?
Sum, count, average
Total, length, mean
Add, divide, average
Sum, size, median
A common method for referencing the elements in a list using numbers
index
pointer
reference
address
Which line will result in the list containing the values ["air", "rock", "air"]?
wordList[0] = wordList[2]
wordList[2] = wordList[0]
insertItem(wordList, 0, "air")
removeItem(wordList, 0)
What will be displayed in the console when the following program runs? Options: 0 2 4 6, 0 2 4, 2 4 6, The program will result in an infinite loop.
0 2 4 6
0 2 4
2 4 6
The program will result in an infinite loop.
What will the following program display in the console? Options: 0, 5, 10, 15
0
5
10
15
a repetitive portion of an algorithm which repeats a specified number of times or until a given condition is met.
Recursion
Iteration
Selection
Function
What will be displayed in the console when this program runs? Options: 2, 3, 20, 30
2
3
20
30
