
Python Dictionary and List

Quiz
•
Computers
•
9th Grade
•
Medium
Immanuel Gunawan
Used 6+ times
FREE Resource
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the difference between a list and a dictionary in Python?
In a list, elements are accessed by their position (index), while in a dictionary, elements are accessed by keys.
Dictionaries are ordered collections, while lists are unordered.
Lists can only store integers, while dictionaries can store any data type.
In a list, elements are accessed by keys, while in a dictionary, elements are accessed by their position (index).
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How do you access an element in a list by its index?
myList(index)
myList{index}
myList[index]
myList.index
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the syntax to create an empty dictionary in Python?
my_dict = {}
my_dict = []
my_dict = dict()
my_dict = set()
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Can a list contain elements of different data types in Python?
Sometimes
Yes
Rarely
No
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How do you add a key-value pair to a dictionary in Python?
dictionary_name[key, value]
dictionary_name.add(key, value)
dictionary_name.insert(key, value)
dictionary_name[key] = value
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the method to remove the last element from a list in Python?
list_name.pop(-1)
list_name.remove(-1)
list_name.delete(-1)
list_name.pop()
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What happens if you try to access a key that does not exist in a dictionary?
ValueError
KeyError
AttributeError
TypeError
Create a free account and access millions of resources
Similar Resources on Wayground
7 questions
Databases Quiz 3

Quiz
•
7th - 11th Grade
14 questions
9.1.5 - Starter Quiz

Quiz
•
7th - 11th Grade
10 questions
Python Basics - Quiz

Quiz
•
8th - 11th Grade
9 questions
advanced storage techniques ( arrays , DataFrame)

Quiz
•
9th - 10th Grade
8 questions
Understanding Python Variables and Data Types

Quiz
•
9th Grade
10 questions
Computer Vision & OpenCV-Python

Quiz
•
7th - 12th Grade
15 questions
Жанар214

Quiz
•
9th Grade - University
10 questions
KS4 Programming Techniques (1)

Quiz
•
8th - 10th Grade
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
14 questions
Inputs and Outputs: Computer Science Intro

Lesson
•
5th - 9th Grade
10 questions
Understanding Computers: Hardware, Software, and Operating Systems

Interactive video
•
7th - 12th Grade