
Post Test Quiz PPL 01-13102023
Authored by Muhammad Koprawi
Computers
University

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
20 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
1 min • 10 pts
Which of the following is not a valid way to define this dictionary in Python:
d = dict([
('foo', 100),
('bar', 200),
('baz', 300)
])
d = {}
d['foo'] = 100
d['bar'] = 200
d['baz'] = 300
d = dict(foo=100, bar=200, baz=300)
d = {'foo': 100, 'bar': 200, 'baz': 300}
d = { ('foo', 100), ('bar', 200), ('baz', 300) }
2.
MULTIPLE CHOICE QUESTION
1 min • 10 pts
You have the following dictionary definition:
d = {'foo': 100, 'bar': 200, 'baz': 300}
What method call will delete the entry whose value is 200?
delete d('bar')
d.pop("bar")
d.remove("bar")
None of the above
3.
MULTIPLE CHOICE QUESTION
1 min • 10 pts
What would be the output of the following code snippet?
a_dict = {'color': 'blue', 'fruit': 'apple', 'pet': 'dog'}
for key in a_dict:
print(key)
'blue'
'apple'
'dog'
color
fruit
pet
blue
apple
dog
'color'
'fruit'
'pet'
4.
MULTIPLE CHOICE QUESTION
1 min • 10 pts
Consider the following statement:
If you just need to work with the keys of a dictionary, then you can use .keys(), which is a method that returns a new view object containing the dictionary’s keys.
Is this statement True or False?
False
True
5.
MULTIPLE CHOICE QUESTION
1 min • 10 pts
What is the output of the program above
e
y
t
g
6.
MULTIPLE CHOICE QUESTION
1 min • 10 pts
The output of the code above is
[101, 102, 103, 104]
[3.6, 3.7, 3.8, 4]
7.
MULTIPLE CHOICE QUESTION
1 min • 10 pts
What is the output of the code above
[3.6, 3.7, 3.8, 4]
[101, 102, 103, 104]
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?