List MCQ in Python – 1

Q1) Which of the following is True regarding lists in Python?

a) Lists are immutable.
b) Size of the lists must be specified before its initialization
c) Elements of lists are stored in the contagious memory location.
d) size(list1) command is used to find the size of lists​

View Answer Answer:- Elements of lists are stored in the contagious memory location.

Q2) Which of the following commands will create a list?

a) list1 = list()
b) list1 = [ ]
c) list1 = list([1, 2, 3])
d) all of the mentioned

View Answer Answer:- d) all of the mentioned

Q3) Which of the following is true about the 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

View Answer Answer:- d) All of the above

Q4) What is the output when we execute the list(“hello”)?

a) [‘h’, ‘e’, ‘l’, ‘l’, ‘o’]
b) [‘hello’]
c) [‘llo’]
d) [‘olleh’]

View Answer Answer:- a) [‘h’, ‘e’, ‘l’, ‘l’, ‘o’]

Q5) Do we have any inbuilt function for shuffling the values of List.

a) True
b) False

View Answer Answer:- a) True

Q6) To shuffle the list(say list1) what function do we use?

a) shuffle(list1)
b) list1.shuffle()
c) random.shuffle(list1)
d) random.shuffleList(list1)

View Answer Answer:- c) random.shuffle(list1)

Q7) Empty list in python is made by?

a) l=[ ]
b) l=list()
c) Both of the above
d) None of the above

View Answer Answer:- c) Both of the above

Q8) Suppose listExample is [‘h’,’e’,’l’,’l’,’o’], what is len(listExample)?

a) None
b) 4
c) 5
d) Error

View Answer Answer:- c) 5

Q9) How to define an empty list?

a) list[ ]
b) listname = [ ]
c) listname[ ]
d) list=()

View Answer Answer:- b) listname=[ ]

Q10) What is the correct syntax to copy one list into another?

a) listA = listB[ ]
b) listA = listB[ : ]
c) listA = listB[ ]()
d) listA = listB

View Answer Answer:- b) listA = listB[:]

Also See:- List in Python MCQ – 2

Leave a Comment

Your email address will not be published. Required fields are marked *