What is the output of: d = {'a': 1, 'b': 2} print(d['c'])

CC103 - 2

Quiz
•
Others
•
University
•
Hard
ALVIN CERTEZA
FREE Resource
40 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
None
0
Error
[]
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which method returns a list of key-value tuple pairs?
keys()
values()
items()
get()
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How to safely access a key that may not exist in a dictionary?
dict['key']
dict.get('key')
dict.key
dict.fetch('key')
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of len({'a': 1, 'b': 2, 'a': 3})?
3
2
1
Error
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What does dict.update({'c': 3}) do?
Adds key 'c' with value 3
Replaces dictionary
Clears dictionary
Returns error
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will dict.pop('x') do if 'x' does not exist?
Returns None
Raises KeyError
Deletes key
Returns 0
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How to loop over dictionary keys and values? for k, v in ___: ...
dict
dict.items()
dict.keys()
dict.values()
Create a free account and access millions of resources
Similar Resources on Quizizz
37 questions
Silviculture II Finales

Quiz
•
University
40 questions
ITP QUIZ #1: Chapter One, The Nature of Psychology

Quiz
•
University
44 questions
future tense

Quiz
•
University
40 questions
ICT4

Quiz
•
University
44 questions
IT and Business Alignment Quiz

Quiz
•
University
35 questions
ôn tập tin học 2

Quiz
•
University
40 questions
Quiz on Visual Perception

Quiz
•
University
39 questions
motricidad t2,3,4,5,6

Quiz
•
University
Popular Resources on Quizizz
15 questions
Multiplication Facts

Quiz
•
4th Grade
20 questions
Math Review - Grade 6

Quiz
•
6th Grade
20 questions
math review

Quiz
•
4th Grade
5 questions
capitalization in sentences

Quiz
•
5th - 8th Grade
10 questions
Juneteenth History and Significance

Interactive video
•
5th - 8th Grade
15 questions
Adding and Subtracting Fractions

Quiz
•
5th Grade
10 questions
R2H Day One Internship Expectation Review Guidelines

Quiz
•
Professional Development
12 questions
Dividing Fractions

Quiz
•
6th Grade