Question
1- What is the output of the following script? >>> things = [second] >>> things.insert(0, first) >>> print(things) a. ['0', 'second'] b. ['first', 'second'] c.
1- What is the output of the following script?
>>> things = ["second"] >>> things.insert(0, "first") >>> print(things)
a. ['0', 'second'] b. ['first', 'second'] c. ['second', '0'] d. ['first', 'first']
2 - Which method allows you to access a subset, or a slice, of a tuple? a. Sorting b. Reversing c. Indexing d. Slicing
3 - Identify which tuple method is used in the following script.
>>> a[1:5]
a. Indexing b. Reversing c. Sorting d. Slicing
4 - Which function is used to remove all items from a list?
a. clear() b. remove(item) c. pop() d. delete()
5 - Which is the correct way to display an empty list?
a. {} b. [] c. [2, 4, 6, 8] d. ["one", 2, "three", ["five", 6]]
6 - Which method returns the number of occurrences of an item in a tuple?
a. max() b. count() c. min() d. any()
7 - Which of the following is not a built-in list method: append(), insert(), destroy(), clear()?
a. destroy() b. append() c. insert() d. clear()
8 - Identify ways in which tuples are accessible: indexing, sorting, slicing, popping.
a. Indexing and slicing b. Indexing and sorting c. Indexing and popping d. Slicing and sorting
9 - Elements in lists are:
a. Unordered and unchangeable b. Unordered and changeable c. Ordered and unchangeable d. Ordered and changeable
10 - Which built-in method identifies iterable elements in a tuple: count(), any(), max(), len()?
a. len() b. any() c. max() d. count()
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started