click below
click below
Normal Size Small Size show me how
Python final exam
| Question | Answer |
|---|---|
| Invalid indexes do not cause slicing expressions to raise an exception. | True |
| Lists are dynamic data structures such that items may be added to them or removed from them. | True |
| A list cannot be passed as an argument to a function. | False |
| The remove method removes all occurrences of an item from a list. | False |
| The sort method rearranges the elements of a list so they are in ascending or descending order. | False |
| The index of the first element in a list is 1, the index of the second element is 2, and so forth. | False |
| The index -1 identifies the last element in a list. | True |
| In slicing, if the end index specifies a position beyond the end of the list, Python will use the length of the list instead. | True |
| What are the data items in a list called? | elements |
| When working with multiple sets of data, one would typically use a(n) | nested list |
| The primary difference between a tuple and a list is that | once a tuple is created, it cannot be changed |
| What is an advantage of using a tuple rather than a list? | Processing a tuple is faster than processing a list. |