Search Header Logo

#17 Arrays, Records, Tuples and Hash Tables

Authored by Claire Buckler

others

11th - 12th Grade

Used 3+ times

#17 Arrays, Records, Tuples and Hash Tables
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

15 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

2. Which of these applies to an array?

A. Elements must be of the same data type
B. Elements can be of any data type as there are no type rules on the array
C. One element can contain a single value while other elements contain multiple values or data structures
D. Specific array index values can be set to different numbers where necessary

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

3. In the array nums = {0,1,5,2,1), which of the following is false?

A. There are five elements
B. 5 is one element
C. There are two elements
D. Two elements have the same value

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

4. In the following array, which of these commands would determine the number of characters in "Crab"? zoo = ["Pig", "Wolf", "Crab"],

A. zoo.length[3]
B. zoo[2].length
C. zoo[3].length
D. zoo[3][4]

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

5. Which of the following would place an 'X' as the first element in a 2D array of characters which has the identifier 'grid'?

A. grid.length(0)[0] = 'X'
B. grid]='X'
C. grid[0][0] = 'X'
D. grid['X'].charAt(0)

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

6. Twenty-seven different coloured cubes are arranged into a larger cube shape. The colour of each individual cube is unique and is represented as a 5-bit colour code, e.g. 00000=black, 10101=pink. A 3D array of strings is used to represent the arrangement of the 27 smaller cubes into a 3x3x3 arrangement. If cube [0][0][0] represents the top-left cube on the top row, which of these represents the bottom-right cube on the bottom row?

A. cube[0][1][2]
B. cube[3][3][3]
C. cube[0][3][0]
D. cube[2][2][2]

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

7. Which of these is the most suitable data structure for modelling a chess board in a computerised chess game in such a way that the squares on the board store the value of the chess piece at that square?

A. Tuple
B. 3D array
C. 2D array
D. 1D array

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

8. When visiting all of the elements of a 2D array, which of these approaches is suitable?

A. Use two nested iterative structures. Each time you progress to a new row, recalculate the length of that row as it may not contain the same number of columns as the row before it.
B. Use two nested iterative structures. Each time you progress to a new row, you will not have to recalculate the length of that row as it will be the same as the row before it.
C. Use a do-while (aka repeat-until) loop. It has built-in capabilities to handle 2D arrays efficiently.
D. Use three nested iterative structures. The two inner iterative structures (FOR loops are commonly used) will visit each of the elements, but a third outer loop is required to manage any additional checks such as IF statements that need to be carried out.

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?