Table of Contents
Multiple Choice Questions
Question 1
List can contain values of these types:
- integers
- floats
- lists
- tuples
- all of these ✓
Question 2
Which of the following will create an empty list?
- L = [ ] ✓
- L = list(0)
- L = list( ) ✓
- L = List(empty)
Question 3
Which of the following will return the last element of a list L with 5 elements?
- L[5]
- L[4] ✓
- L[-1] ✓
- L[6]
Question 4
If L = [1, 2] then L * 2 will yield
- [1, 2] * 2
- [1, 2, 2]
- [1, 1, 2, 2]
- [1, 2, 1, 2] ✓
Question 5
If L1 = [1, 3, 5] and L2 = [2, 4, 6] then L1 + L2 will yield
- [1, 2, 3, 4, 5, 6]
- [1, 3, 5, 2, 4, 6] ✓
- [3, 7, 11]
- [1, 3, 5, [2, 4, 6]]
Question 6
Given a list L= [10, 20, 30, 40, 50, 60, 70], what would L[1 : 4] return?
- [10, 20, 30, 40]
- [20, 30, 40, 50]
- [20, 30, 40] ✓
- [30, 40, 50]
Question 7
Given a list L= [10, 20, 30, 40, 50, 60, 70], what would L[2 : -2] return?
- [10, 20, 30, 40]
- [20, 30, 40, 50]
- [20, 30, 40]
- [30, 40, 50] ✓
Question 8
Given a list L= [10, 20, 30, 40, 50, 60, 70], what would L[-4 : -1] return?
- [20, 30, 40]
- [30, 40, 50]
- [40, 50, 60] ✓
- [50, 60, 70]
Question 9
Given a list L= [10, 20, 30, 40, 50, 60, 70], what would L[-3 : 99] return?
- [20, 30, 40]
- [30, 40, 50]
- [40, 50, 60]
- [50, 60, 70] ✓
Question 10
To find the last element of list namely ‘smiles’ in Python, ………. will be used.
- smiles[0]
- smiles[-1] ✓
- smiles[lpos]
- smiles[:-1]
Question 11
Out of the following, what is correct syntax to copy one list into another?
- listA = listB[ ]
- listA = listB[:] ✓
- listA = listB[ ]( )
- listA = list(listB) ✓
Question 12
What is printed by the Python code?
print(list(range(3)))
- [0, 1, 2, 3]
- [1, 2, 3]
- [0, 1, 2] ✓
- 0, 1, 2
Question 13
Which of the following commands will create a list?
- listl = list( )
- listl = [ ]
- listl = list([1, 2, 3])
- all of these ✓
Question 14
What is the output when we execute list(“hello”)?
- [‘h’, ‘e’, ‘l’, ‘l’, ‘o’] ✓
- [‘hello’]
- [‘llo’]
- [‘olleh’]
Question 15
What gets printed?
names = ['Hasan', 'Balwant', 'Sean', 'Dia'] print(names[-1][-1])
- H
- n
- Hasan
- Dia
- a ✓
Question 16
What is the output of the following
l = [None] * 10 print(len(l))
- 10 ✓
- 0
- Syntax Error
- None
Question 17
Consider the list aList – [“SIPO”, [1, 3, 5, 7] ]. What would the following code print?
print(aList[0][1], aList[1][1])
- S, 3
- S, 1
- I, 3 ✓
- I, 1
Question 18
Which of the following is a standard Python library function and not an exclusively list function?
- append( )
- remove( )
- pop( )
- len( ) ✓
Question 19
Which of the following can add only one value to a list?
- add( )
- append( ) ✓
- extend( )
- none of these
Question 20
Which of the following can add a list of elements to a list?
- add( )
- append( )
- extend( ) ✓
- none of these
Question 21
Which of the following will always return a list?
- max( )
- min( )
- sort( )
- sorted( ) ✓
Question 22
Which of the following can delete an element from a list if the index of the element is given?
- pop( )
- remove( )
- del ✓
- all of these
Question 23
Which of the following can delete an element from a list, if its value is given?
- pop( )
- remove( ) ✓
- del
- all of these
Question 24
Which of the following searches for an element in a list and returns its index?
- search( )
- find( )
- index( ) ✓
- lsearch( )
Question 25
Which of the following can copy a list to another list?
- list( ) ✓
- new( )
- copy( ) ✓
- = operator
Discover more from EduGrown School
Subscribe to get the latest posts sent to your email.