adplus-dvertising

Welcome to the Lists in Python MCQs Page

Dive deep into the fascinating world of Lists in Python with our comprehensive set of Multiple-Choice Questions (MCQs). This page is dedicated to exploring the fundamental concepts and intricacies of Lists in Python, a crucial aspect of Python. In this section, you will encounter a diverse range of MCQs that cover various aspects of Lists in Python, from the basic principles to advanced topics. Each question is thoughtfully crafted to challenge your knowledge and deepen your understanding of this critical subcategory within Python.

frame-decoration

Check out the MCQs below to embark on an enriching journey through Lists in Python. Test your knowledge, expand your horizons, and solidify your grasp on this vital area of Python.

Note: Each MCQ comes with multiple answer choices. Select the most appropriate option and test your understanding of Lists in Python. You can click on an option to test your knowledge before viewing the solution for a MCQ. Happy learning!

Lists in Python MCQs | Page 2 of 12

Explore more Topics under Python

Q11.
What is the output when following code is executed ?
>>>names = ['Amir', 'Bear', 'Charlton', 'Daman']
>>>print(names[-1][-1])
Discuss
Answer: (d).n
Q12.
What is the output when following code is executed ?
names1 = ['Amir', 'Bear', 'Charlton', 'Daman']
names2 = names1
names3 = names1[:]
 
names2[0] = 'Alice'
names3[1] = 'Bob'
 
sum = 0
for ls in (names1, names2, names3):
    if ls[0] == 'Alice':
        sum += 1
    if ls[1] == 'Bob':
        sum += 10
 
print sum
Discuss
Answer: (b).12
Q13.
Suppose list1 is [1, 3, 2], What is list1 * 2 ?
Discuss
Answer: (c).[1, 3, 2, 1, 3, 2].
Q14.
Suppose list1 is [3, 4, 5, 20, 5, 25, 1, 3], what is list1 after list1.reverse() ?
Discuss
Answer: (d).[3, 1, 25, 5, 20, 5, 4, 3].
Q15.
Suppose listExample is [3, 4, 5, 20, 5, 25, 1, 3], what is list1 after listExample.extend([34, 5]) ?
Discuss
Answer: (a).[3, 4, 5, 20, 5, 25, 1, 3, 34, 5].
Q16.
Suppose listExample is [3, 4, 5, 20, 5, 25, 1, 3], what is list1 after listExample.pop(1) ?
Discuss
Answer: (c).[3, 5, 20, 5, 25, 1, 3].
Q17.
Suppose listExample is [3, 4, 5, 20, 5, 25, 1, 3], what is list1 after listExample.pop()?
Discuss
Answer: (a).[3, 4, 5, 20, 5, 25, 1].
Discuss
Answer: (a).[β€œWelcome”, β€œto”, β€œPython”].
Q19.
What is the output when following code is executed ?
>>>list("a#b#c#d".split('#'))
Discuss
Answer: (a).[β€˜a’, β€˜b’, β€˜c’, β€˜d’].
Q20.
What is the output when following code is executed ?
myList = [1, 5, 5, 5, 5, 1]
max = myList[0]
indexOfMax = 0
for i in range(1, len(myList)):
    if myList[i] > max:
        max = myList[i]
        indexOfMax = i
 
>>>print(indexOfMax)

a.

1

b.

2

c.

3

d.

4

Discuss
Answer: (a).1

Suggested Topics

Are you eager to expand your knowledge beyond Python? We've curated a selection of related categories that you might find intriguing.

Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!