PYTHON MULTIPLE CHOICE 1a) What is the output of the following code snippet? 1b)
ID: 3728666 • Letter: P
Question
PYTHON MULTIPLE CHOICE 1a) What is the output of the following code snippet?
1b) What is stored in x at the end of this code segment?
1c) Which of the following statements creates a duplicate copy of the favoriteFoodsdictionary?
1d) You use______________ to delete an element from a dictionary.
the remove method
the erase method
the delete method
the del statement
1e) Consider the following dictionary:
What statement will print Peg's favorite food?
1f) The_________method returns a randomly selected key-value pair from a dictionary.
1g) The_______________function returns the number of elements in a dictionary:
1h) The ________ method returns the value associated with a specified key and removes that key-value pair from the dictionary.
1i) The ______ method returns all of a dictionary’s keys and their associated values as a sequence of tuples.
1j) Which statement correctly creates a dictionary for converting numbers 1 through 5 to roman numerals?
1k) What is the difference between a list and a dictionary?
a list is a subset of a dictionary
a dictionary can access elements by position
1l) What is returned by a dictionary's items method?
{1, 2, 3, 5, 8}
Explanation / Answer
Hi, I have answered first 7 Qs.
please repost others in separate post.
1. Ans: C. {1, 2, 3, 5, 7, 8, 11}
2. Ans. C. {3, 5, 7}
3. Ans. B. favoriteFoods2 = dict(favoriteFoods)
4. Ans. the del statement
5. Nas. print("Peg's favorite food is: ", favoriteFoods["Peg"])
6. popitem()
7. len()
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.