MCQ on List in Python
Q1. Which of the following statement will create list?
a. L1=list( )
b. L1=[1,2,3,4]
c. Both of the above
d. None of the above
Q2. Write the output of the following code :
list(“welcome”)
a. [‘w’, ‘e’, ‘l’, ‘c’, ‘o’, ‘m’, ‘e’]
b. (‘w’, ‘e’, ‘l’, ‘c’, ‘o’, ‘m’, ‘e’)
c. [‘welcome’]
d. None of the above
Q3. Write the output of the following code :
>>> L=[‘w’,’e’,’l’,’c’,’o’,’m’,’e’]
>>> print(len(L))
a. 7
b. 8
c. 9
d. None
Q4. Write the output of the following code :
>>> L=[“Amit”,”Anita”,”Zee”,”Longest Word”]
>>> print(max(L))
a. Zee
b. Longest Word
c. Error
d. None of the above
Q5. Write the output of the following code :
>>> L=[“Amit”,”Anita”,”Zee”,”Longest Word”,123]
>>> print(max(L))
a. Longest Word
b. Zee
c. Amit
d. Error
MCQ on List in Python
Q6. Write the output of the following code :
>>>L=[1,5,9]
>>>print(sum(L),max(L),min(L))
a. 15 9 1
b. Error
c. Max and Min are only for String Value
d. None of the above
Q7. Do we have any inbuilt function for shuffling the values of List. :
a. True
b. False
Q8. Write the output of the following code :
>>>L=[1,2,3,4,5,[6,7,8]]
>>>print(L[5])
a. [6, 7, 8]
b. 6, 7, 8
c. Error
d. 6
Q9. Write the output of the following code :
L=list(“www.csiplearninghub.com”)
print(L[20 : -1])
a. [‘c’ , ‘o’]
b. [‘c’ , ‘o’ , ‘m’]
c. (com)
d. Error
Q10. Write the output of the following code :
>>>L=list(“www.csiplearninghub.com”)
>>>print(L[20 : 0])
a. Error
b. No Value
c. None
d. [ ]
MCQ on List in Python
Q11. Write the output of the following code :
>>>L=[“Amit”,”Sumit”,”Naina”]
>>>print(L[-1][-1])
a. [Naina]
b. [a]
c. a
d. None of the above
Q12. Write the output of the following code :
>>>L=[“Amit”,”Sumit”,”Naina”]
>>>print(L[1:-1])
a. [‘Sumit’]
b. [a]
c. [Naina]
d. None of the above
Q13. Write the output of the following code :
L=[“Amit”,”Sumit”,”Naina”]
print(L*2)
a. [‘Amit’, ‘Sumit’, ‘Naina’, ‘Amit’, ‘Sumit’, ‘Naina’]
b. [“Amit” , “Sumit” , “Naina”]
c. Error
d. None of the above
Q14. Write the output of the following code :
L=[“Amit”,”Sumit”,”Naina”]
print(L**2)
a. Error
b. [“Amit”,”Sumit”,”Naina”][“Amit”,”Sumit”,”Naina”]
c. [“Amit”,”Sumit”,”Naina”]
d. [“Amit”,”Sumit”,”Naina”,”Amit”,”Sumit”,”Naina”]
Q15. Write the output of the following code :
L=[0.5 * x for x in range(4)]
print(L)
a. [0.0, 0.5, 1.0, 1.5]
b. (0,.5, 1, 1.5)
c. [0.0, 0.5, 1.0, 1.5, 2.0]
d. Error
MCQ on List in Python
Q16. Write the output of the following code :
L=[‘a’ * x for x in range(4)]
print(L)
a. [‘ ‘ , ‘a’ , ‘aa’ , ‘aaa’]
b. [‘a’, ‘aa’, ‘aaa’]
c. Error
d. None of the above
Q17. Write the output of the following code :
L= [1*x for x in range(10,1,-4)]
print(L)
a. [10, 6, 2]
b. [10, 7, 4]
c. Error
d. None of the above
MCQ on List in Python
Q18. Write the output of the following code :
L=[1,2,3,4,5]
for i in L:
print(i,end=” “)
i=i+1
a. 1 2 3 4 5
b. 1, 3, 5
c. Error
d. None of the above
Q19. Write the output of the following code :
L=[“Amit”,”Sumit”,”Naina”]
L1=[“Sunil”]
print(L + L1)
a. [‘Amit’ , ‘Sumit’ , ‘Naina’ , [‘Sunil’]]
b. [‘Amit’ , ‘Sumit’ , ‘Naina’ , ‘Sunil’]
c. List can not concatenate
d. None of the above
Q20. Which command is used to add an element in List named L1
a. L1.add(4)
b. L1.append(4)
c. L1.new(4)
d. None of the above
MCQ on List in Python
Q21. Write the output of the following :
L = “123456”
L = list(L)
print(type(L[0]))
a. class ‘str’
b. class ‘int’
c. 1
d. Error
Q22. Write the output of the following:
T=(1,2,3,4,5.5)
L = list(T)
print(L[3]*2.5)
a. Error
b. 10
c. 10.0
d. 4
Q23. Index value in list and string start from 0(T/F)
a. True
b. False
Q24. Write the output of the following:
T=(1,2,3,4,5.5)
L = list(T)
print(L*2)
a. [2, 4, 6, 8, 11]
b. [1, 2, 3, 4, 5.5, 1, 2, 3, 4, 5.5]
c. Error
d. None of the above
Q25. Write the output of the following:
T = [1,2,3,4]
T1 = [3,4,5,6]
T2 = T + T1
print(T2)
a. [1, 2, 3, 4, 5, 6]
b. [1, 2, 3, 4, 3, 4, 5, 6]
c. [4, 6, 8, 10]
d. Error
MCQ on List in Python
Q26. Write the output of the following:
T = [1,2,3,4]
T1 = [3,4,5,6]
T2 = T.append(T1)
print(T2)
a. [1, 2, 3, 4, [3, 4, 5, 6]]
b. [1, 2, 3, 4, 3, 4, 5, 6]
c. None
d. None of the above
Q27. del statement can delete the following from the List?
a. Single Element
b. Multiple Elements
c. All elements along with List object
d. All of the above
Q28. Write the output of the following:
T = [1,2,3,4]
T1=T
T[0] = “A”
print(T)
print(T1)
a.
['A', 2, 3, 4]
[1, 2, 3, 4]
b.
['A', 2, 3, 4]
['A', 2, 3, 4]
c.
[1, 2, 3, 4]
[1, 2, 3, 4]
d. Error
Q29. What type of error is returned by the following statement?
T = [1,2,3,4]
print(T.index(9))
a. IndexError
b. TypeError
c. ValueError
d. None of the above
Q30. Write the output of the following.
T = [1,2,3,4]
T1=[5,6,7]
L=T.append(T1)
print(L)
a. None
b. [1, 2, 3, 4, [5, 6, 7]]
c. [ ]
d. Error
MCQ on List in Python
Q31. Write the output of the following:
L=["Amit","Sumit","Naina"] L1=["Sunil"] print(L + L1)
a. [“Amit” , “Sumit” , “Naina” , [“Sunil”] ]
b. [‘Amit’ , ‘Sumit’ , ‘Naina’ , ‘Sunil’]
c. Error
d. [‘Amit’ , ‘Sumit’ , ‘Naina’ , ‘Sunil’][‘Amit’ , ‘Sumit’ , ‘Naina’ , ‘Sunil’]
Q32. Result of list slice is also a list?(T/F)
a. True
b. False
Q33. What we call the operation which is used to extract particular range from a sequence.
a. Slicing
b. range
c. Indexing
d. Replication
Q34. Index of last element in list is n-1, where n is total number of elements.(T/F)
a. True
b. False
Q35. Write the output of the following :
L=[2 * x for x in range(3,14,3)]
print(L)
a. [6, 12, 18, 24]
b. [6, 12, 18]
c. [6, 12, 18, 24, 30]
d. Error
MCQ on List in Python
Q36. Write the output of the following :
L=["Amit","Sumit","Naina"]
L1=["Sumit"]
print(L - L1)
a. [“Amit” , “Naina”]
b. [“Amit” , “Naina”, “Sumit”]
c. Show Error
d. None of the above
Q37. Write the output of the following:
L=[1,5,9]
print(sum(L)+max(L)-min(L))
a. Error
b. 14 + 9 -1
c. 23
d. 24
Q38. Which mathematical operator is used for repetition?
a. *
b. **
c. +
d. //
Q39. Following two print statement will return same result.(T/F)
L1 = [1, 5, 9]
L2 = [2, 3, 4]
print(L1 + L1)
print(L1 * 2)
a. True
b. False
Q40. Which of the following is not list operation?
a. Indexing
b. Slicing
c. Dividing
d. Concatenation
MCQ on List in Python
Q41. Which of the following is true about List data type in Python?
a. List is a Sequence data type
b. List is mutable
c. List can have elements of different data type
d. All of the above
Q42. Identify data type of ‘T’ in following line of Code:
T = list(tuple([1,2,3]))
print(type(T))
a. Tuple
b. List
c. Nested List
d. None of the above
Q43. List and String are different
a. in reference to their indexing
b. in reference to data type of elements they contain
c. None of the above
d. Both of the above
Q44. List can have elements of _____________ data types.
a. Same
b. Different
c. Both of the above
d. None of the above
Q45. Write the output of the following:
L =[['Physics',101],['Chemistry',202], ['Maths',303],45, 6, 'j']
print(len(L))
a. 3
b. 4
c. 5
d. 6
MCQ on List in Python
Q46. Write the output of the following :
L = [1,2,3,4,5,6,7,8,9,10]
print(L[L[3]])
a. 3
b. 4
c. 5
d. 6
Q47. Which of the following statement will return first element from right of list ‘L’?
a. L[0]
b. L[-1]
c. L[1]
d. None of the Above
Q48. Write the output of the following:
L = [1,2,3,4,5,6,7,8,9,10] print(L[len(L) - 1])
a. 9
b. 1
c. Error
d. None of the above
Q49. We can concatenate only two list at one time.(T/F)
a. True
b. False
Q50. The following statements is showing ______ operation in List.
L1 = [1,2,3,4] L2 = [1,2,3,4] L = L1 + L2
a. Replication of List
b. Concatenation of List
c. Indexing of String
d. None of the above
MCQ on List in Python
Q51. Which mathematical operator is used to concatenate list?
a. +
b. //
c. **
d. None of the above
Q52. Write the output of the following :
L1 = [1,2,3]
L2=[5,6,7]
L1 + L2
print(L1)
a. [1, 2, 3, 4, 5, 6, 7]
b. [1, 2, 3, 5, 6, 7]
c. [1, 2, 3]
d. None of the above
Q53. If we try to concatenate a list with elements of some other data type, _____________ occurs.
a. SyntaxError
b. SyntaxError
c. TypeError
d. None of the above
Q54. Name the operator which is used in the following print statement.
L1 = [1,2,3]
print(L1*3)
a. Concatenation
b. Repetition
c. Membership
d. None of the above
Q55. print(L1 + L1) and print(L1 * 2) will produce the same result.(L1 is a List)(T/F)
a. True
b. False
MCQ on List in Python
Q56. Which operator helps to check whether an element is present in list or not?
a. +
b. in
c. **
d. None of the above
Q57. Write the output of the following:
print(1 in [[1],2,3])
a. True
b. False
c. Error
d. None of the above
Q58. Which operation of List is shown in following lines?
L1 = [1, 2, 3, 4, 5, 6, 7, 8]
print(L1[3 : 6])
a. Concatenation
b. Repetition
c. Slicing
d. None of the above
Q59. Which of the following statement will reverse the list L1?
a. L1[ : : 1]
b. L1[-1 : : -1]
c. L1[: : -1]
d. None of the above
Q60. Traversing a list can be done with the help of _________
a. loop
b. if
c. if–elif
d. None of the above
MCQ on List in Python
Q61. Write the output of the following:
print(len(tuple[1]))
a. 1
b. 0
c. Error
d. None of the above
Q62. Write the output of the following :
L = [[1,2,3,5,6,7,[1,[2,3]]]]
print(len(L))
a. 4
b. 3
c. 2
d. 1
Q63. Which function returns the length of a list?
a. Len( )
b. length( )
c. len( )
d. Length( )
Q64. Write the output of the following :
D = list[ ] print(len(D))
a. 0
b. 1
c. SyntaxError
d. ValueError
Q65. remove( ) function removes the _______________ occurrences of an element from the list
a. all
b. first
c. last
d. None of the above
MCQ on List in Python
Q66. sort () function Sorts the elements of the given list in-place(T/F)
a. True
b. False
Q67. Which of the following function creates the new list?
a. sort( )
b. sorted( )
c. reverse( )
d. All of the above
Q68. Write the output of the following :
D = [1,2,3]
D1 = D
D.append(4)
print(D1)
a. [1, 2, 3, 4]
b. [1, 2, 3]
c. Error
d. None of the above
Q69. Fill in the blanks with same word in both places
>>> import __________ >>> list1 = [1,2,3,4,5] >>> list2 = _________.copy(list1) >>> list2
a. copy
b. math
c. pickle
d. None of the above
Q70. Write the output of the following :
def listchange(L): L.append(45) return L1 = [1, 2, 3, 4] listchange(L1) print(L1)
a. [1, 2, 3, 4]
b. [1, 2, 3, 45]
c. [1, 2, 3, 4, 45]
d. None of the above
MCQ on List in Python
Q71. Write the output of the following:
print([] * 2 )
a. [ ]
b. 0
c. Error
d. None of the above
Q72. Which of the following will give output as [21,2,9,7] ? if list L = [1,21,4,2,5,9,6,7]
a. print(L[1 : 8 : 2])
b. print(L[1 : : 2])
c. Both of the above
d. None of the above
Q73. Write the output of the following :
L = ['Amit', 'anita', 'Sumant', 'Zaid'] print(max(L))
a. Zaid
b. Sumant
c. anita
d. Amit
Q74. Write the output of the following:
L=[13, 12, 15, 27, 3, 46] list1.pop(3) print(L)
a. [13,12,15, 27, 46]
b. [13, 12, 15, 3, 46]
c. [13, 12, 15, 27, 3]
d. None of the above
Q75. Write the output of the following:
list1=[3,2,5,7,3,6]
list1.remove(3)
print(sum(list1))
a. 23
b. 20
c. 19
d. None of the above
MCQ on List in Python
Q76. Write the output of the following
list1=[3,2,5,7,3,6]
list1.insert(6,3)
print(list1)
a. [3, 2, 5, 6, 7, 3, 6]
b. [3, 2, 5, 6, 3, 6]
c. [3, 2, 5, 7, 3, 6, 3]
d. None of the above
Q77. Write the output of the following
L = [14, 2, 3, 16, 15]
L[1:4] = [5, 4, 8]
print(L)
a. [14, 5, 4, 8, 15]
b. [14, 5, 4, 8, 2, 3, 16, 15]
c. Error
d. None of the above
Q78. Write the output of the following
L = ["Amit", 'Sumit', 'Ravi']
print(L[0][1])
a. A
b. Amit
c. S
d. m
Q79. Write the output of the following
L = ["Amit", 'Sumit', 'Ravi']
print("@".join(L))
a. @Amit
b. Amit@Sumit@Ravi
c. Amit@Sumit@Ravi@
d. None of the above
Q80. Write the output of the following:
L = ['A', 'S', 'R']
L = L + L*2
print(L)
a. [‘A’, ‘S’, ‘R’, ‘2A’, ‘2S’, ‘2R’]
b. [‘A’, ‘S’, ‘R’, ‘A’, ‘S’, ‘R’, ‘A’, ‘S’, ‘R’]
c. [‘A’, ‘S’, ‘R’]
d. Error
MCQ on List in Python
Q81. Write the output of the following :
L = [[5, 7, 9, 1 ], [12, 23, 4, 9]]
for r in L:
r.reverse( )
for e in r:
print(e, end = ” “)
a. 1 9 7 5 9 4 23 12
b.
1 9 7 5
9 4 23 12
c.
Error
d. None of the above
Q82. Write the output of the following:
L = [[5, 7, 9, 1 ], [12, 23, 4, 9]]
for r in L:
r.sort()
for e in r:
print(e, end = ” “)
a. 1 5 7 9 4 9 12 23
b. 1 4 5 7 9 9 12 23
c. 9 7 5 1 23 12 9 4
d. None of the above
Q83. How many elements will be there in list ‘L’
L = [[p, q] for p in (0, 4) for q in (0, 4)]
a. 2
b. 4
c. 8
d. 16
Q84. Write the output of the following:
L = [[p, q] for p in (0, 4) for q in (0, 4)]
print(L[0])
a. [0]
b. [0, 4]
c. [4, 4]
d. [0, 0]
Q85. Write the output of the following:
L = [23, 45, 65, 32, 3]
L.insert(L[4], 'Monitor')
print(L)
a. [23, 45, 65, ‘Monitor’, 32, 3]
b. [23, 45, 65, 32, ‘Monitor’, 3]
c. [23, 45, 65, 32, 3, ‘Monitor’]
d. None of the above
MCQ on List in Python
Q86. Which statement will give the same output?
list1 = [1, 2, 3, 4]
list2 = [5, 6, 7, 8]
a. print(len(list1 + list2))
b. print(len(list1) + len (list2))
c. print(list2[3])
d. All of the above
Q87. Write the output of the following:
L = [11, 21, 31, 41]
L.append([51,62,73,84])
print(len(L))
a. 8
b. 5
c. 4
d. None of the above
Q88. Write the output of the following :
L = [11, 21, 31, 41]
L.extend([51,62,73,84])
print(len(L))
a. 8
b. 4
c. 5
d. Error
Q89. Write the output of the following
L1 = ['C++', 'C-Sharp', 'Visual Basic'] L2 = [name.upper() for name in L1] L3 = [name for name in L1] if(L2[2][0] == L3[2][0]): print("Yes") else: print("No")
a. No
b. Yes
c. Error
d. None of the above
Q90. Write the output of the following :
L = [11, 22, 33, 44, 55, 66] for i in range(1, 6): L[i - 1] = L[i]*2 for i in range(0, 4): print(L[i], end = " ")
a. 44 66 88 110
b. 22 33 44 55
c. 11 22 33 44
d. Error
MCQ on List in Python
Q91. Write the output of the following :
L= [1,2,3,4,5]
m = [m and 1 for m in L]
print(m)
a. [1, 2, 3, 4, 5]
b. [1, 1, 1, 1, 1]
c. [1, 0, 1, 0, 1
d. None of the above
Q92. Write the output of the following :
L= [1,2,3,4,5]
m = [m + 3 for m in L]
print(m)
a. [4, 5, 6, 7, 8, 9]
b. [4, 5, 6, 7, 8, 9, 10]
c. [4, 5, 6, 7, 8]
d. Error
Q93. Write the output of the following :
L1 = [1, 2, 3, 4, 5]
L2 = [9, 8, 7, 6, 5]
S= [L1 + 3 for L1 in L2]
print(S)
a. [12, 11, 10, 9, 8]
b. [1, 2, 3, 4, 5, 6, 7, 8, 9]
c. [4, 5, 6, 7, 8]
d. Error
Q94. Write the output of the following :
L1 = [1, 2, 3]
L2 = [9, 8]
S= [m * n for m in L1 for n in L2]
print(S)
a. [9, 8, 18, 16, 27, 24]
b. [9, 18, 27, 8, 16, 24]
c. [8, 9, 16, 18, 24, 27]
d. Error
Q95. Write the output of the following :
L1 = [1, 2, 3]
L2 = [9, 8]
S= [n + m for m in L1 for n in L1]
print(S)
a. [2, 3, 4, 3, 4, 5, 4, 5]
b. [1, 2, 3, 2, 3, 4, 3, 4, 5]
c. [2, 3, 4, 3, 4, 5, 4, 5, 6]
d. Error
MCQ on List in Python
Q96. Which of the following statement will generate the square of given list L ?
L = [1, 2, 3, 4, 5]
a. [x ** 2 for x in L]
b. [x * 2 for x in L]
c. [x ^ 3 for x in L]
d. None of the above
Q97. Which of the following function is used to shuffle the list ?
a. random( )
b. swap( )
c. shuffle( )
d. None of the above
Q98. Both the print statement will produce the same result.(T/F)
L = ["Amit", "Ananya", "Parth"]
print(L[-1])
print(L[-1][-1])
a. True
b. False
Q99. Write the output of the following:
L1 = [1, 2, 3]
L2 = [1, 2, 3, 4, 5, 6]
print(L1 in L2)
a. True
b. False
Q100. Which of the following command will insert 7 in third position of List L.
a. L.insert(3, 7)
b. L.insert(2, 7)
c. L.add(3, 7)
d. L.append(3, 7)
MCQ on List in Python
Disclaimer : I tried to give you the correct “MCQ on List in Python” , but if you feel that there is/are mistakes in the “MCQ on List in Python” given above, you can directly contact me at csiplearninghub@gmail.com.
MCQ on List in Python
Class 12 Computer Science Sample Paper 2020-2021.
Class 12 Computer Science Sample Paper Marking Scheme
Class 12 Computer Science Test Series
Q1.
a.
b.
c.
d.
Q1.
a.
b.
c.
d.