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
39 questions
MSE

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

Quiz
•
University
45 questions
Đề Cương Ôn Tập Giữa Kỳ 2 - Môn Tin Học

Quiz
•
University
40 questions
ICT4

Quiz
•
University
45 questions
PART 1 ED 204

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

Quiz
•
University
44 questions
ORTHO II - Classification of malocclusion

Quiz
•
University
39 questions
Tiếng Anh chuyên nghành

Quiz
•
University
Popular Resources on Quizizz
15 questions
Character Analysis

Quiz
•
4th Grade
17 questions
Chapter 12 - Doing the Right Thing

Quiz
•
9th - 12th Grade
10 questions
American Flag

Quiz
•
1st - 2nd Grade
20 questions
Reading Comprehension

Quiz
•
5th Grade
30 questions
Linear Inequalities

Quiz
•
9th - 12th Grade
20 questions
Types of Credit

Quiz
•
9th - 12th Grade
18 questions
Full S.T.E.A.M. Ahead Summer Academy Pre-Test 24-25

Quiz
•
5th Grade
14 questions
Misplaced and Dangling Modifiers

Quiz
•
6th - 8th Grade