Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

CodeHS 5.7 2D Arrays

Total questions: 10

Worksheet time: 6mins

Name
Class
Date
1.

How is a 2D array stored?

a)

As an array of arrays

b)

As a grid

c)

As a variable

d)

As an instance variable

2.

Write a well-written line of code that creates a 5x23 grid of integers named foo.

(a)  

3.

What is printed to the console?

(a)  

4.

How do we find the number of rows in bar?

a)

bar.length

b)

bar[].length

c)

bar[][].length

d)

bar[0].length

5.

How do we find the number of columns in bar?

a)

bar.length

b)

bar[].length

c)

bar[][].length

d)

bar[0].length

6.

How do we iterate over the entire 2D array?

a)

nested for loop

b)

nested while loop

c)

sequential for loop

d)

sequential while loop

e)

iterative for loop

7.

What is the name of the value that denotes an element of an array?

a)

index

b)

number

c)

key

d)

bound

8.

What is an array?

a)

a data structure that stores a fixed number of values of the same type

b)

a data structure that stores a dynamic number of values of the same type

c)

a data structure that stores information organized with a key

d)

a data structure that stores information at two-dimensional coordinates

9.

What is another term for an element of an array?

a)

member

b)

trick question--there isn't one

c)

variable

d)

object

10.

What is love?

a)

an object

b)

a primitive data type

c)

a class

d)

an interface

e)

baby don't hurt me