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

Q91.
What is the output of the code shown?
A = [[1, 2, 3],
      [4, 5, 6],
      [7, 8, 9]]
[A[row][1] for row in (0, 1, 2)]
Discuss
Answer: (c).[2, 5, 8]
Q92.
What is the output of the code shown below?
A = [[1, 2, 3],
     [4, 5, 6],
     [7, 8, 9]]
[A[i][i] for i in range(len(A))]
Discuss
Answer: (a).[1, 5, 9]
Q93.
What is the output of the following code?
l=[[1, 2, 3], [4, 5, 6]]
for i in range(len(l)):
               	for j in range(len(l[i])):
                               		l[i][j]+=10
l
Discuss
Answer: (d).[[11, 12, 13], [14, 15, 16]]
Q94.
What is the output of the code shown?
A = [[1, 2, 3],
     [4, 5, 6],
     [7, 8, 9]]
 
[[col + 10 for col in row] for row in A]
Discuss
Answer: (a).[[11, 12, 13], [14, 15, 16], [17, 18, 19]]
Q95.
What is the output of the code shown below?
A = [[1, 2, 3],
        [4, 5, 6],
        [7, 8, 9]]
[A[i][len(A)-1-i] for i in range(len(A))]
Discuss
Answer: (c).[3, 5, 7]
Q96.
The service in which the cloud consumer does not manage the underlying cloud infrastructure nor the application(s) contained in the instances as the service provides user with all of it is:
A = [[1, 2, 3],
        [4, 5, 6],
        [7, 8, 9]]
B = [[3, 3, 3],
        [4, 4, 4],
        [5, 5, 5]]
[B[row][col]*A[row][col] for row in range(3) for col in range(3)]
Discuss
Answer: (c).[0, 30, 60, 120, 160, 200, 300, 350, 400]
Q97.
What is the output of the code shown?
r = [11, 12, 13, 14, 15, 16, 17, 18, 19]
A = [[0, 10, 20],
               [30, 40, 50],
               [60, 70, 80]]
for row in A:
           	for col in row:
                     		r.append(col+10)
r
Discuss
Answer: (a).[11, 12, 13, 14, 15, 16, 17, 18, 19, 10, 20, 30, 40, 50, 60, 70, 80, 90]
Q98.
What is the output of the code shown?
A = [[1, 2, 3],
        [4, 5, 6],
        [7, 8, 9]]
B = [[3, 3, 3],
        [4, 4, 4],
        [5, 5, 5]]
[[col1 * col2 for (col1, col2) in zip(row1, row2)] for (row1, row2) in zip(A, B)]
Discuss
Answer: (b).[[0, 30, 60], [120, 160, 200], [300, 350, 400]]
Q99.
What is the output of the code shown?
A = [[1, 2, 3],
        [4, 5, 6],
        [7, 8, 9]]
B = [[3, 3, 3],
        [4, 4, 4],
        [5, 5, 5]]
zip(A, B)
Discuss
Answer: (a).Address of the zip object
Q100.
Suppose list1 = [0.5 * x for x in range(0, 4)], list1 is :
Discuss
Answer: (c).[0.0, 0.5, 1.0, 1.5].
Page 10 of 12

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!