Python 2D Lists Quiz

Quiz
•
Computers
•
10th Grade
•
Medium
Danielle Mills
Used 16+ times
FREE Resource
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`
Create a free account and access millions of resources
Similar Resources on Wayground
15 questions
7.2 Parameters & Return Investigate

Quiz
•
9th - 12th Grade
15 questions
Crash Course Computer Science #14 - Data Structures

Quiz
•
9th - 12th Grade
19 questions
Мова програмування та структури даних - 1

Quiz
•
10th Grade
20 questions
GCSE Computer Science: Programming (Data Structures)

Quiz
•
9th - 10th Grade
14 questions
Python Data types & Exceptions

Quiz
•
1st - 10th Grade
14 questions
List Review Quiz

Quiz
•
9th - 12th Grade
15 questions
Output Devices - Printers

Quiz
•
10th Grade
19 questions
WJECT ICT - Chapter 1 - Computing Devices

Quiz
•
10th Grade - University
Popular Resources on Wayground
10 questions
Video Games

Quiz
•
6th - 12th Grade
20 questions
Brand Labels

Quiz
•
5th - 12th Grade
15 questions
Core 4 of Customer Service - Student Edition

Quiz
•
6th - 8th Grade
15 questions
What is Bullying?- Bullying Lesson Series 6-12

Lesson
•
11th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
Discover more resources for Computers
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
10 questions
Proper Keyboarding Techniques

Interactive video
•
6th - 10th Grade
10 questions
Understanding Computers: Hardware, Software, and Operating Systems

Interactive video
•
7th - 12th Grade
29 questions
AP CSP Unit 2 Review (Code.org)

Quiz
•
10th - 12th Grade