
Programming 2 - Lesson 03
Quiz
•
Computers
•
11th Grade
•
Practice Problem
•
Medium
Rachel FitzZaland
Used 4+ times
FREE Resource
Enhance your content in a minute
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
What does a dictionary in Python do?
Stores ordered collections of items
Maps keys to value
Represents empty data structures
Allows you look up keyword definitions
2.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
How do you create an empty dictionary in Python?
empty_dict = []
empty_dict = dict()
empty_dict = {}
empty_dict = ()
3.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
What is the output of the following code:
game_scores = {'player1': 1000, 'player2': 1500}
print(game_scores['player1'])
1000
player1
1500
None
4.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
What will happen if you try to access a key that doesn’t exist in the dictionary?
It will return None.
It will create a new key-value pair.
It will raise a KeyError.
It will return an empty string
5.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
What does the len function do when applied to a dictionary
Returns the number of key-value pairs
Returns the number of keys
Returns the number of values
Returns the total number of characters in keys and values
6.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
What does the following code output:
game_levels = {'level1': 'easy', 'level2': 'medium', 'level4': 'hard'}
'level3' in game_levels
True
False
None
'hard'
7.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
How do you add a new key-value pair to a dictionary named 'inventory'
where the key is 'potion' and the value is 5?
inventory.add('potion', 5)
inventory.append('potion', 5)
inventory['potion'] = 5
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
10 questions
AP Computer Science Principles Unit 3 Review
Quiz
•
9th - 12th Grade
15 questions
Online communities & cloud computing - BTEC IT unit 1
Quiz
•
11th - 12th Grade
10 questions
Code.org Discoveries
Quiz
•
9th - 11th Grade
12 questions
Law , Artificial Intelligence & Screen Time
Quiz
•
7th - 12th Grade
15 questions
Python Tuples Review
Quiz
•
11th Grade
10 questions
Software - Common Utility Programs
Quiz
•
3rd - 12th Grade
15 questions
Colossus
Quiz
•
1st - 12th Grade
14 questions
The Internet
Quiz
•
6th Grade - Professio...
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
20 questions
Figurative Language Review
Quiz
•
6th Grade
