WorksheetsCodeHS 5.1 & 5.2 Intro to Data Structures
Total questions: 10
Worksheet time: 7mins
What is a data structure?
another name for a class
data stored as a set of variables
variables inherited from a parent class
data organized in a particular way
baby don't hurt me
Which data structures were introduced in Lesson 5.1?
Wrong answers only.
array
2D array
ArrayList
HashMap
BinaryTree
What is an array?
a data structure that stores a fixed number of values of the same type
a data structure that stores a dynamic number of values of the same type
a data structure that stores information organized with a key
a data structure that stores information at two-dimensional coordinates
An array is kinda like ...
a list
a group
a chess board
a phonebook ... wait, do you even know what that is?
Make me an array.
int[ ] foo = new int[5];
int[ ] foo = {0, 1, 2, 3, 4}
int[ ] foo = new int[0, 1, 2, 3, 4];
int[ ] foo = new Array(5);
POOF! You're an array
What is the name of the value that denotes an element of an array?
index
number
key
bound
What is the index of the final element of an array called foo?
foo.length - 1
foo.length
foo.last
foo.last + 1
Good geeks start counting at
(a)
A 9-hole golf course is introducing an app to replace paper scorecards. The total
score is the number of times the player hits the ball to complete all 9 holes.
The final scores are stored within the app.
State the most suitable data structure and data type for storing the final score
for each hole.
Data structure: (a)
Data type: (b)
Given the array, { 5, 4, 2, 6, 7, 1, 9 }, at what index is the value 1?
6
5
7
3
