Python MCQ Quiz Hub

MCQ on List in Python

Choose a topic to test your knowledge and improve your Python skills

Which of the following statement will create list?





✅ Correct Answer: 3

Write the output of the following code : list(“welcome”)





✅ Correct Answer: 1

Write the output of the following code : >>> L=[‘w’,’e’,’l’,’c’,’o’,’m’,’e’] >>> print(len(L))





✅ Correct Answer: 1

Write the output of the following code : >>> L=[“Amit”,”Anita”,”Zee”,”Longest Word”] >>> print(max(L))





✅ Correct Answer: 1

Write the output of the following code : >>> L=[“Amit”,”Anita”,”Zee”,”Longest Word”,123] >>> print(max(L))





✅ Correct Answer: 4

Write the output of the following code : >>>L=[1,5,9] >>>print(sum(L),max(L),min(L))





✅ Correct Answer: 1

Write the output of the following code : >>>L=[1,2,3,4,5,[6,7,8]] >>>print(L[5])





✅ Correct Answer: 1

Write the output of the following code : L=list(“www.csiplearninghub.com”) print(L[20 : -1])





✅ Correct Answer: 1

Write the output of the following code : >>>L=list(“www.csiplearninghub.com”) >>>print(L[20 : 0])





✅ Correct Answer: 4

Write the output of the following code : >>>L=[“Amit”,”Sumit”,”Naina”] >>>print(L[-1][-1])





✅ Correct Answer: 3

Write the output of the following code : >>>L=[“Amit”,”Sumit”,”Naina”] >>>print(L[1:-1])





✅ Correct Answer: 1

Write the output of the following code : L=[“Amit”,”Sumit”,”Naina”] print(L*2)





✅ Correct Answer: 1

Write the output of the following code : L=[“Amit”,”Sumit”,”Naina”] print(L**2)





✅ Correct Answer: 1

Write the output of the following code : L=[0.5 * x for x in range(4)] print(L)





✅ Correct Answer: 1

Write the output of the following code : L=[‘a’ * x for x in range(4)] print(L)





✅ Correct Answer: 1

Write the output of the following code : L= [1*x for x in range(10,1,-4)] print(L)





✅ Correct Answer: 1

Write the output of the following code : L=[1,2,3,4,5] for i in L: print(i,end=” “) i=i+1





✅ Correct Answer: 1

Write the output of the following code : L=[“Amit”,”Sumit”,”Naina”] L1=[“Sunil”] print(L + L1)





✅ Correct Answer: 2

Which command is used to add an element in List named L1





✅ Correct Answer: 2

Write the output of the following : L = “123456” L = list(L) print(type(L[0]))





✅ Correct Answer: 1

Write the output of the following: T=(1,2,3,4,5.5) L = list(T) print(L[3]*2.5)





✅ Correct Answer: 3

Write the output of the following: T=(1,2,3,4,5.5) L = list(T) print(L*2)





✅ Correct Answer: 1

Write the output of the following: T = [1,2,3,4] T1 = [3,4,5,6] T2 = T + T1 print(T2)





✅ Correct Answer: 2

Write the output of the following: T = [1,2,3,4] T1 = [3,4,5,6] T2 = T.append(T1) print(T2)





✅ Correct Answer: 3

del statement can delete the following from the List?





✅ Correct Answer: 3

Write the output of the following: T = [1,2,3,4] T1=T T[0] = “A” print(T) print(T1)





✅ Correct Answer: 2

What type of error is returned by the following statement? T = [1,2,3,4] print(T.index(9))





✅ Correct Answer: 3

Write the output of the following. T = [1,2,3,4] T1=[5,6,7] L=T.append(T1) print(L)





✅ Correct Answer: 1

Write the output of the following: L=["Amit","Sumit","Naina"] L1=["Sunil"] print(L + L1)





✅ Correct Answer: 2

What we call the operation which is used to extract particular range from a sequence.





✅ Correct Answer: 1

Write the output of the following : L=[2 * x for x in range(3,14,3)] print(L)





✅ Correct Answer: 1

Write the output of the following : L=["Amit","Sumit","Naina"] L1=["Sumit"] print(L - L1)





✅ Correct Answer: 2

Write the output of the following:





✅ Correct Answer: 3

Write the output of the following:





✅ Correct Answer: 3

Write the output of the following:





✅ Correct Answer: 3

Which mathematical operator is used for repetition?





✅ Correct Answer: 1

Which of the following is not list operation?





✅ Correct Answer: 3

Which of the following is true about List data type in Python?





✅ Correct Answer: 4

Identify data type of ‘T’ in following line of Code: T = list(tuple([1,2,3])) print(type(T))





✅ Correct Answer: 2

List and String are different





✅ Correct Answer: 2

List can have elements of _____________ data types.





✅ Correct Answer: 2

Write the output of the following: L =[['Physics',101],['Chemistry',202], ['Maths',303],45, 6, 'j'] print(len(L))





✅ Correct Answer: 4

Write the output of the following : L = [1,2,3,4,5,6,7,8,9,10] print(L[L[3]])





✅ Correct Answer: 3

Which of the following statement will return first element from right of list ‘L’?





✅ Correct Answer: 1

Write the output of the following: L = [1,2,3,4,5,6,7,8,9,10] print(L[len(L) - 1])





✅ Correct Answer: 4

The following statements is showing ______ operation in List. L1 = [1,2,3,4] L2 = [1,2,3,4] L = L1 + L2





✅ Correct Answer: 2

Which mathematical operator is used to concatenate list?





✅ Correct Answer: 1

Write the output of the following : L1 = [1,2,3] L2=[5,6,7] L1 + L2 print(L1)





✅ Correct Answer: 3

If we try to concatenate a list with elements of some other data type, _____________ occurs.





✅ Correct Answer: 3

If we try to concatenate a list with elements of some other data type, _____________ occurs.





✅ Correct Answer: 3

If we try to concatenate a list with elements of some other data type, _____________ occurs.





✅ Correct Answer: 3

If we try to concatenate a list with elements of some other data type, _____________ occurs.





✅ Correct Answer: 3

Name the operator which is used in the following print statement.





✅ Correct Answer: 2

Which operator helps to check whether an element is present in list or not?





✅ Correct Answer: 2

Write the output of the following: print(1 in [[1],2,3])





✅ Correct Answer: 2

Which operation of List is shown in following lines? L1 = [1, 2, 3, 4, 5, 6, 7, 8] print(L1[3 : 6])





✅ Correct Answer: 3

Which of the following statement will reverse the list L1?





✅ Correct Answer: 3

Traversing a list can be done with the help of _____





✅ Correct Answer: 1

Write the output of the following: print(len(tuple[1]))





✅ Correct Answer: 2

Write the output of the following : L = [[1,2,3,5,6,7,[1,[2,3]]]] print(len(L))





✅ Correct Answer: 4

Which function returns the length of a list?





✅ Correct Answer: 3

Write the output of the following : D = list[ ] print(len(D))





✅ Correct Answer: 3

remove( ) function removes the _______________ occurrences of an element from the list





✅ Correct Answer: 2

Which of the following function creates the new list?





✅ Correct Answer: 2

Write the output of the following : D = [1,2,3] D1 = D D.append(4) print(D1)





✅ Correct Answer: 1

Fill in the blanks with same word in both places >>> import __________ >>> list1 = [1,2,3,4,5] >>> list2 = _________copy(list1) >>> list2





✅ Correct Answer: 1

Write the output of the following : def listchange(L): L.append(45) return L1 = [1, 2, 3, 4] listchange(L1) print(L1)





✅ Correct Answer: 3

Write the output of the following: print([] * 2 )





✅ Correct Answer: 1

Which of the following will give output as [21,2,9,7] ? if list L = [1,21,4,2,5,9,6,7]





✅ Correct Answer: 2

Write the output of the following : L = ['Amit', 'anita', 'Sumant', 'Zaid'] print(max(L))





✅ Correct Answer: 3

Write the output of the following: L=[13, 12, 15, 27, 3, 46] list1.pop(3) print(L)





✅ Correct Answer: 2

Write the output of the following: list1=[3,2,5,7,3,6] list1.remove(3) print(sum(list1))





✅ Correct Answer: 1

Write the output of the following list1=[3,2,5,7,3,6] list1.insert(6,3) print(list1)





✅ Correct Answer: 3

Write the output of the following L = [14, 2, 3, 16, 15] L[1:4] = [5, 4, 8] print(L)





✅ Correct Answer: 1

Write the output of the following L = ["Amit", 'Sumit', 'Ravi'] print(L[0][1])





✅ Correct Answer: 4

Write the output of the following L = ["Amit", 'Sumit', 'Ravi'] print("@".join(L))





✅ Correct Answer: 2

Write the output of the following: L = ['A', 'S', 'R'] L = L + L*2 print(L)





✅ Correct Answer: 2

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 = ” “)





✅ Correct Answer: 1

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 = ” “)





✅ Correct Answer: 1

How many elements will be there in list ‘L’ L = [[p, q] for p in (0, 4) for q in (0, 4)]





✅ Correct Answer: 2

Write the output of the following: L = [[p, q] for p in (0, 4) for q in (0, 4)] print(L[0])





✅ Correct Answer: 4

Write the output of the following: L = [23, 45, 65, 32, 3] L.insert(L[4], 'Monitor') print(L)





✅ Correct Answer: 1

Which statement will give the same output? list1 = [1, 2, 3, 4] list2 = [5, 6, 7, 8]





✅ Correct Answer: 4

Write the output of the following: L = [11, 21, 31, 41] L.append([51,62,73,84]) print(len(L))





✅ Correct Answer: 2

Write the output of the following : L = [11, 21, 31, 41] L.extend([51,62,73,84]) print(len(L))





✅ Correct Answer: 1

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("N0")





✅ Correct Answer: 2

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 = " ")





✅ Correct Answer: 1

Write the output of the following : L= [1,2,3,4,5] m = [m and 1 for m in L] print(m)





✅ Correct Answer: 2

Write the output of the following : L= [1,2,3,4,5] m = [m + 3 for m in L] print(m)





✅ Correct Answer: 3

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)





✅ Correct Answer: 1

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)





✅ Correct Answer: 1

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)





✅ Correct Answer: 3

Which of the following statement will generate the square of given list L ? L = [1, 2, 3, 4, 5]





✅ Correct Answer: 1

Which of the following function is used to shuffle the list ?





✅ Correct Answer: 1

Which of the following command will insert 7 in third position of List L.





✅ Correct Answer: 2