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 8 of 12

Q71.
What is the output of the code shown?
s=["pune", "mumbai", "delhi"]
[(w.upper(), len(w)) for w in s]
Discuss
Answer: (d).[(‘PUNE’, 4), (‘MUMBAI’, 6), (‘DELHI’, 5)]
Q72.
What is the output of the code shown below?
l1=[2,4,6]
l2=[-2,-4,-6]
for i in zip(l1, l2):
              	print(i)
Discuss
Answer: (c).(2, -2)
(4, -4)
(6, -6)
Q73.
What is the output of the following code?
l1=[10, 20, 30]
l2=[-10, -20, -30]
l3=[x+y for x, y in zip(l1, l2)]
l3
Discuss
Answer: (d).[0, 0, 0]
Q74.
Write a list comprehension for number and its cube for l=[1, 2, 3, 4, 5, 6, 7, 8, 9].
Discuss
Answer: (a).[x**3 for x in l]
Q75.
What is the output of the code shown below?
l=[[1 ,2, 3], [4, 5, 6], [7, 8, 9]]
[[row[i] for row in l] for i in range(3)]
Discuss
Answer: (b).[[1, 4, 7], [2, 5, 8], [3, 6, 9]]
Discuss
Answer: (c).[‘3’, ‘3’, ‘3’, ‘3’, ‘3’]
Q77.
What is the output of the code shown below?
l1=[1,2,3]
l2=[4,5,6]
l3=[7,8,9]
for x, y, z in zip(l1, l2, l3):
            	print(x, y, z)
Discuss
Answer: (a).1 4 7
2 5 8
3 6 9
Q78.
Read the information given below carefully and write a list comprehension such that the output is: [‘e’, ‘o’]
w="hello"
v=('a', 'e', 'i', 'o', 'u')
Discuss
Answer: (b).[x for x in w if x in v]
Q79.
What is the output of the code shown below?
[ord(ch) for ch in 'abc']
Discuss
Answer: (a).[97, 98, 99]
Q80.
What is the output of the code shown below?
t=32.00
[round((x-32)*5/9) for x in t]
Discuss
Answer: (d).Error

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!