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

Explore more Topics under Python

Q31.
What will be the output?
def increment_items(L, increment):
    i = 0
    while i < len(L):
        L[i] = L[i] + increment
        i = i + 1
 
values = [1, 2, 3]
print(increment_items(values, 2))
print(values)
Discuss
Answer: (a).None
[3, 4, 5].
Discuss
Answer: (a).Return a list containing every third item from L starting at index 0
Discuss
Answer: (a).[โ€˜carrotโ€™, โ€˜celeryโ€™, โ€˜broccoliโ€™, โ€˜potatoโ€™, โ€˜asparagusโ€™] Correct 1.00
Discuss
Answer: (b).[[0, 1, 2], [1, 2, 3], [2, 3, 4]].
Q35.
How many elements are in m?
m = [[x, y] for x in range(0, 4) for y in range(0, 4)]
Discuss
Answer: (c).16
Q36.
What will be the output?
values = [[3, 4, 5, 1], [33, 6, 1, 2]]
 
v = values[0][0]
for row in range(0, len(values)):
    for column in range(0, len(values[row])):
        if v < values[row][column]:
            v = values[row][column]
 
print(v)

a.

3

b.

5

c.

6

d.

33

Discuss
Answer: (d).33
Q37.
What will be the output?
values = [[3, 4, 5, 1], [33, 6, 1, 2]]
 
v = values[0][0]
for lst in values:
    for element in lst:
        if v > element:
            v = element
 
print(v)

a.

1

b.

3

c.

5

d.

6

Discuss
Answer: (a).1
Q38.
What will be the output?
values = [[3, 4, 5, 1 ], [33, 6, 1, 2]]
 
for row in values:
    row.sort()
    for element in row:
        print(element, end = " ")
    print()
Discuss
Answer: (d).The program prints two rows 1 3 4 5 followed by 1 2 6 33
Q39.
What is the output?
matrix = [[1, 2, 3, 4],
       [4, 5, 6, 7],
       [8, 9, 10, 11],
       [12, 13, 14, 15]]
 
for i in range(0, 4):
    print(matrix[i][1], end = " ")
Discuss
Answer: (d).2 5 9 13
Q40.
What will be the output?
def m(list):
    v = list[0]
    for e in list:
      if v < e: v = e
    return v
 
values = [[3, 4, 5, 1], [33, 6, 1, 2]]
 
for row in values: 
    print(m(row), end = " ")
Discuss
Answer: (d).5 33

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!