CSC 121 Exam 2

Jul 11th, 2023
4.7 (114 reviews)
16 test answers
question
Invalid indexes do not cause slicing expressions to raise an exception.
answer
True
question
Arrays, which are allowed by most other programming languages, have more capabilities than Python list structures.
answer
False
question
Lists are dynamic data structures such that items may be added to them or removed from them.
answer
True
question
A list cannot be passed as an argument to a function.
answer
False
question
The remove method removes all occurrences of an item from a list.
answer
False
question
The sort method rearranges the elements of a list so they are in ascending or descending order.
answer
False
question
The index of the first element in a list is 1, the index of the second element is 2, and so forth.
answer
False
question
In slicing, if the end index specifies a position beyond the end of the list, Python will use the length of the list instead.
answer
True
question
In order to create graphs using the matplotlib package, you need to import the pyplot module.
answer
True
question
To add a descriptive label to the X and Y axes of a graph when using the matplotlib package, you need to import the labels module.
answer
False
question
What are the data items in a list called?
answer
elements
question
When working with multiple sets of data, one would typically use a(n)
answer
nested list
question
The primary difference between a tuple and a list is that
answer
once a tuple is created, it cannot be changed
question
What is an advantage of using a tuple rather than a list?
answer
Processing a tuple is faster than processing a list.
question
Which list will be referenced by the variable number after the following code is executed?number = range(0, 9, 2)
answer
[0, 2, 4, 6, 8]
question
Which of the following would you use if an element is to be removed from a specific index?
answer
a del statement
1 of 16
question
Invalid indexes do not cause slicing expressions to raise an exception.
answer
True
question
Arrays, which are allowed by most other programming languages, have more capabilities than Python list structures.
answer
False
question
Lists are dynamic data structures such that items may be added to them or removed from them.
answer
True
question
A list cannot be passed as an argument to a function.
answer
False
question
The remove method removes all occurrences of an item from a list.
answer
False
question
The sort method rearranges the elements of a list so they are in ascending or descending order.
answer
False
question
The index of the first element in a list is 1, the index of the second element is 2, and so forth.
answer
False
question
In slicing, if the end index specifies a position beyond the end of the list, Python will use the length of the list instead.
answer
True
question
In order to create graphs using the matplotlib package, you need to import the pyplot module.
answer
True
question
To add a descriptive label to the X and Y axes of a graph when using the matplotlib package, you need to import the labels module.
answer
False
question
What are the data items in a list called?
answer
elements
question
When working with multiple sets of data, one would typically use a(n)
answer
nested list
question
The primary difference between a tuple and a list is that
answer
once a tuple is created, it cannot be changed
question
What is an advantage of using a tuple rather than a list?
answer
Processing a tuple is faster than processing a list.
question
Which list will be referenced by the variable number after the following code is executed?number = range(0, 9, 2)
answer
[0, 2, 4, 6, 8]
question
Which of the following would you use if an element is to be removed from a specific index?
answer
a del statement