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

Q81.
Write a list comprehension for producing a list of numbers between 1 and 1000 that are divisible by 3.
Discuss
Answer: (b).[x for x in range(1000) if x%3==0]
Discuss
Answer: (b).[i for i in range(1, 101) if int(i*0.5)==(i*0.5)]
Q83.
What is the list comprehension equivalent for: list(map(lambda x:x**-1, [1, 2, 3]))
Discuss
Answer: (c).[x**-1 for x in [1, 2, 3]]
Q84.
Write a list comprehension to produce the list: [1, 2, 4, 8, 16……212].
Discuss
Answer: (a).[(2**x) for x in range(0, 13)]
Q85.
What is the list comprehension equivalent for:
{x : x is a whole number less than 20, x is even} (including zero)
Discuss
Answer: (d).[x for x in range(0, 20) if (x%2==0)]
Q86.
What is the output of the list comprehension shown below?
[j for i in range(2,8) for j in range(i*2, 50, i)]
Discuss
Answer: (c).A list of non prime numbers, up to 50
Q87.
What is the output of the code shown below?
l=["good", "oh!", "excellent!", "#450"]
[n for n in l if n.isalpha() or n.isdigit()]
Discuss
Answer: (b).[‘good’]
Discuss
Answer: (b).B = [[3, 3, 3]
[4, 4, 4]
[5, 5, 5]]
Q89.
What is the output of the snippet of code shown below?
A = [[1, 2, 3],
          [4, 5, 6],
          [7, 8, 9]]
A[1]
Discuss
Answer: (a).[4, 5, 6]
Q90.
Which of the following statements will result in the output: 6?
A = [[1, 2, 3],
     [4, 5, 6],
     [7, 8, 9]]
Discuss
Answer: (c).A[1][2]

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!