top of page

Python List MCQ Questions

  • Writer: Rajesh Singh
    Rajesh Singh
  • Dec 1, 2024
  • 5 min read

Updated: Dec 4, 2025

Q1. What is output of below python code?

dict= {1:'1', 2:'2', 3:'3'}

del dict[1]

dict[1] = '10'

del dict[2]

print (len(dict))

A. 1

B. 2

C. 3

D. 0

Ans: B

 

Q2. Which are methods of list?

A. append()

B. extend()

C. insert()

D. All of the above

Ans: D:

 

Q3. The list.pop ([i]) is used for removing the item at the given position in the list?


A. Yes

B. No

Ans: A:

 

Q4. list, tuple dictionary are which types of Data Types.

A. Binary Types

B. Boolean Types

C. Sequence Types

D. None of the above

Ans: C

 

Q5. What is the data type of following object?


A=[5,’abc’,3,2,6]


A. Tuple


B. Array


C. List


D. Dictionary


Ans: C

 

Q6. What is the output of following code?


A=[[1,2,3],


[4,5,6],


[7,8,9]]


print(A[1][:])


A. [1,2,3]


B. [4,5,6]


C. [2,5,8]


D. None of these


Ans: B

Q7. What is the output of following code?

a1={1:"A",2:"B",3:"C"}

b1={4:"D",5:"E"}

b1.update(a1)

print(b1)

A. {4: 'D', 5: 'E', 1: 'A', 2: 'B', 3: 'C'}

B. {1: 'A', 2: 'B', 3: 'C', 4: 'D', 5: 'E', }

C. {4: 'D', 5: 'E'}

D. None of Above

Ans: A

 

Q8. What is the output when we execute print( list(“hello”))?

A. ['h', 'e', 'l', 'l', 'o']

B. [‘hello’]

C. [‘llo’]

D. [‘olleh’]

Ans: A

 

Q9. In which data type, indexing is not valid?

A. List

B. Dictionary

C. String

D. None of above

Ans: B

 

Q10. What is the output of the following?

t=(2,3,4,3.5,5,6)

print(sum(t)+t.count(2))

A. 24.5

B. 24

C. 23.5

D. 25.5

Ans: A

 

Q11. Which of the following is immutable data type?

A. List

B. Set

C. Tuple

D. Dict

Ans: C

 

Q12. Which of the following is correct?

A. Dictionary can have two same keys with different values

B. Dictionary can have two same values with different keys

C. Dictionary can have two same keys or same values but cannot have two same key value pair

D. Dictionary can neither have two same keys nor two same values

Ans: B

 

Q13. Which will create a list below?

A.    lst = list()

B.    lst = []

C.    lst = list([1, 2, 3])

D.   All of Above

Ans: D

Q14. Let a list=['b','o','d','h'] then len(list)

A.    4

B.    5

C.    1

D.   Error

Ans: A

Q15. Let a list= [4, 5,10, 3] then max(list) is equal to

A.    4

B.    5

C.    10

D.   3

Ans: C

Q16. Let a list= [4, 5, 10, 3] then sum(list) is equal to

A.    22

B.    10

C.    4

D.   Error

Ans: A

Q17. Which function used to shuffle the lst(list)

A.    random.shuffle(list)

B.    random.list()

C.    shuffle.list()

D.   list.shuffle()

Ans: A

Q18. What is the output of below python code?

Lst=[3,6,7,3,7]

Lst.index(6)

A.    0

B.    1

C.    2

D.   3

Ans: B      

Q19. What is the output of following python code?

Lst=[3,4,5,10,9,1]

Lst.remove(4)

Print(lst)

A.    [3,5,10,9,1]

B.    [9,1]

C.    [3,4,5,9,1]

D.   [3,4,5,10,1]

Ans: A

Q20. What is output of following python post?

Lst=[4,5,6,7]

Print(lst[-2])

A.    7

B.    6

C.    5

D.   4

Ans: B

Q21. What is the output of python code?

Lst=[3,4,5,6,12,45,2,9,3,4,6]

print(list.count(3))

A.    1

B.    2

C.    3

D.   None of Above

Ans: 2

Q22. What is the output of following code?

lst=[3,4,5]

print(sum(list))

A.    3

B.    12

C.    2

D.   -3

Ans: B

Q23. What is the output of below python code?

lst=[2,3,4]

print(Lst*2)

A.    [2,3,4]

B.    [4,6,8]

C.    [2,3,4,2,3,4]

D.   [18]

Ans: C

 

Q24. Which brackets is used for list?

A.    []

B.    {}

C.    ()

D.   All of Above

Ans: A

Q25. What is the output of python code?

list=[1,1,2,3,3,3,4,4]

print(len(list))

A.    4

B.    8

C.    3

D.   None of Above

Ans: B

Q26. What is the output of below python code?

lst=[3,4,5,6,7,12,34,2,9]

lst.pop(3)

print(lst)

A.    [3, 4, 5, 7, 12, 34, 2, 9]

B.    [4, 5, 7, 12, 34, 2, 9]

C.    [3, 4,  7, 12, 34, 2, 9]

D.   [3, 4, 5, 6, 7, 12, 34, 2, 9]

Ans: A

Q27. What is the output of below python code?

lst=[3,4,5,6,7,12,34,2,9]

print(lst.pop(3))

A.    6

B.    [3,4,5,6,7,12,34,2,9]

C.    [3,4,5,7,12,34,2,9]

D.   [4,5,6,7,12,34,2,9]

Ans: A

Q28. What is the method to create a empty list in Python?

A.    List=()

B.    List=[]

C.    List=[empty]

D.   List=[null]

Ans: B

Q29. Let a list=[3,4,5,6,7,8]

What is the correct syntax for slicing operation in given list?

A.    print(list[1])

B.    print(list[:3])

C.    print(list[:-3])

D.   all of above

Ans: D

Q30. Which type of data below?

X= [(4, 5), (6, 7)]

A.    Tuples of lists

B.    List of tuples

C.    Both A & B

D.   None of Above

Ans: B

Q31. What is output of following code?

X=[3,4,5]

Sum=0

for I in X:

    Sum+=I

print(Sum)

A.    3

B.    12

C.    0

D.   None of Above

Ans: B

Q32. What is the output of following python code?

x=[1,3,4,5,6]

x.append([10])

x.extend([15,20])

print(x)

A.    [1, 3, 4, 5, 6, [10], 15, 20]

B.    [1, 3, 4, 5, 6, 10, 15, 20]

C.    [1, 3, 4, 5, 6, 10, [15, 20]]

D.   [[1, 3, 4, 5, 6], 10, 15, 20]

Ans: A

Q33. Suppose a list= [3, 4, 5, 6, 10, 2] and we can access 3 element of list then

A.    List[0]

B.    List[1]

C.    List[2]

D.   List[3]

Ans: C

Q34. What is the output of following code?

list=[6,7]

list1=[2,3]

print(len(list+list1))

A.    2

B.    4

C.    18

D.   None of Above

Ans: B

 Q35. What is the output of following code?

list=[6,7]

list1=[2,3]

print((list+list1))

A.    [6, 7, 2, 3]

B.    [8,10]

C.    4

D.   [4]

Ans: A

Q36. Which commands is used to create a list in Python?

A.      List1=list()

B.      List1=[]

C.      List1=list([4,5,6])

D.      All of Above

Ans: D

Q37. What is the output of following list

List1=[5,67,34,23]

Print(list1[-1])

A.      5

B.      67

C.      34

D.      23

Ans: D

Q38. What is the output of below python code?

X=[3,5,6]

x.append([8,9])

print(len(x))

A.      3

B.      5

C.      4

D.      8

Ans: C

Q39. What is the output of below python code?

List=[2,5,6]

Print(list*2)

A.      [2,5,6]

B.      [4,10,12]

C.      [2,5,6,2,5,6]

D.      None

Ans: C

Q40. What is the correct way to create a Python tuple?

A.      Tpl=[1,2,3]

B.      Tpl={1,2,3}

C.      Tpl=1,2,3

D.      Tpl=(1,2,3)

Ans: C and D Both

Q41. Tuples are immutable data type. It means

A.      Their elements is changed

B.      Elements are stored in unordered

C.      Elements are changed after creation

D.      Elements cannot be changed after creation

As: D

Q42. What is the output of below code?

Tpl=(4)

Print(type(tpl))

A.      <class ‘tuple’>

B.      <class ‘int’>

C.      <class ‘list’>

D.      All of Above

Ans: B (A single element within parentheses without a comma treated as integer,string) not a tuple.

Q43. To create a tuple with a single element

A.      Tpl=(10)

B.      Tpl=(10,)

C.      Tpl=[10]

D.      Tpl={10}

Ans: B

Q44. What is the output of below python code?

Tpl=(4,5,6,7,8,9)

Print(tpl[1:4])

A.      (4,5,6,7,8,9)

B.      (5,6,7)

C.      (4,5,6)

D.      (7,8,9)

Ans: B

Q45. Which function is used to get number of elements in a tuple?

A.      Count[]

B.      Len[]

C.      Len()

D.      Count()

Ans: C

Q46. What is output of below python code?

Tpl=(3,4)

Print(tpl*2)

A.      (3,4)

B.      (6,8)

C.      (3,4,3,4)

D.      Error

Ans: C

Q47. Which keywords find a element within a tuple?

A.      Is

B.      In

C.      Return

D.      None

Ans: B

Q48. Tuples is used as dictionary keys because they are

A.      Unordered

B.      Mutable

C.      Hashable

D.      Changealbe

Ans: C (Hashable means immutable)

List MCQ Video:




Recent Posts

See All
For Loop MCQ in Python

Q1. What is the output of the following Python code? x={1:"X",2:"Y",3:"Z"} for i,j in x.items():     print(i,j,end=" ") A.    1 X 2 Y 3 Z B.    1 2 3 C.    X Y Z D.   1:”X” 2:”Y” 3:”Z” Ans: A Q2.  Wha

 
 
 

Comments


bottom of page