Multiple Choice Identify the
choice that best completes the statement or answers the question.
|
|
1.
|
Suppose list1 is [3, 4, 5, 6, 20, 25, 1, 3]. What is the output of
print( len(list1))?
|
|
2.
|
Which of these collections defines a LIST?
a. | {“name”: “apple”, “color”:
“green”} | c. | (“apple”, “banana”, “cherry”) | b. | {“apple”, “banana”, “cherry”} | d. | [“apple, “banana”,
“cherry”] |
|
|
3.
|
Method used to retrieve and output “Mustang” from the following
dictionary. car = {"brand": "Ford", "model":
"Mustang", "year": 1964}
a. | print(car.get(“model”)) | c. | print(car.values(“model”)) | b. | print(car.keys(“model”)) |
|
|
4.
|
What will be the output of the following? tup = (1, 2, 4,
3) print(tup[1:3])
a. | (2, 4, 3) | c. | (1, 2, 4) | b. | (2, 4) |
|
|
5.
|
Which of these collections defines a TUPLE?
a. | {“name”: “apple”, “color”:
“green”} | c. | (“apple”, “banana”, “cherry”) | b. | {“apple,
“banana”, “cherry”} | d. | [“apple”, “banana”,
“cherry”] |
|
|
6.
|
Which of the following print statements will print Jill’s
position? dictTeam = {“name”: “Jill”, “age”: 17,
“position”: “catcher”}
a. | print(dictTeam) | c. | print(dictTeam[“position”]) | b. | print(dictTeam(“position”)) |
|
|
7.
|
Method used to output “Ford”, “Mustang”, 1964 from
the following dictionary. car = {"brand": "Ford", "model":
"Mustang", "year": 1964}
a. | print(car.get( )) | c. | print(car.values( )) | b. | print(car.keys(
)) |
|
|
8.
|
Which of the following creates an empty elements dictionary?
a. | elements = { } | c. | elements = [ ] | b. | elements = (
) |
|
|
9.
|
Method used to remove the last key/value element from a dictionary.
a. | popitem( ) | c. | pop( ) | b. | get( ) |
|
|
10.
|
Which of these collections defines a DICTIONARY?
a. | {“name”: “apple”, “color”:
“green”} | c. | (“apple”, “banana”, “cherry”) | b. | {“apple”, “banana”, “cherry”} | d. | [“apple”,
“banana”, “cherry”] |
|