Python 2D Lists Quiz

Python 2D Lists Quiz

10th Grade

18 Qs

quiz-placeholder

Similar activities

SOFTWARE 7I

SOFTWARE 7I

7th Grade - University

20 Qs

Animated Canvas

Animated Canvas

9th - 12th Grade

19 Qs

Grade 11 Final Exam

Grade 11 Final Exam

9th - 11th Grade

20 Qs

Arduino -Grade 10+11

Arduino -Grade 10+11

10th - 11th Grade

14 Qs

Coding Karel 2

Coding Karel 2

KG - University

20 Qs

Computer Hardware - CPU & GPU

Computer Hardware - CPU & GPU

7th Grade - University

16 Qs

Skill Competition Quiz 2024

Skill Competition Quiz 2024

10th Grade - University

20 Qs

Common Protocols

Common Protocols

10th - 12th Grade

15 Qs

Python 2D Lists Quiz

Python 2D Lists Quiz

Assessment

Quiz

Computers

10th Grade

Practice Problem

Medium

Created by

Danielle Mills

Used 17+ times

FREE Resource

AI

Enhance your content in a minute

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

18 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do you access the element in the second row and third column of a 2D list `matrix`?

`matrix[1][2]`

`matrix[2][3]`

`matrix[2][1]`

`matrix[3][2]`

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How can you modify the value of the first element in the first row of a 2D list `matrix` to 5?

`matrix[0][0] = 5`

`matrix[1][1] = 5`

`matrix[0] = 5`

`matrix = 5`

3.

MULTIPLE SELECT QUESTION

45 sec • 1 pt

Which of the following is the correct way to iterate over each element in a 2D list `matrix` using nested loops?

`for i in matrix:

for j in i:

print(j)`

`for i in range(len(matrix)):

for j in range(len(matrix[i])):

print(matrix[i][j])`

`for i in matrix:

print(i)`

`for i in range(matrix):

for j in range(i):

print(matrix[i][j])`

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following code snippet if `matrix = [[1, 2], [3, 4]]`? ```python print(matrix[1][1]) ```

`1`

`2`

`3`

`4`

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is a valid 2D list in Python?

`[[1, 2, 3], [4, 5], [6]]`

`[[1, 2], 3, [4, 5]]`

`[[1], [2, 3], 4]`

[[1] [2] [3]]

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How can you add a new row `[5, 6, 7]` to an existing 2D list `matrix`?

`matrix.append(5, 6, 7)`

`matrix.append([5, 6, 7])`

`matrix += [5, 6, 7]`

`matrix.insert(len(matrix), [5, 6, 7])`

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What error is raised when trying to access an element in a 2D list with an index that is out of range?

`IndexError`

`KeyError`

`TypeError`

`ValueError`

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?