1 Crore+ students have signed up on EduRev. Have you? Download the App |
Which of the following operations is not valid for a 2D array?
Which module in Python provides functions for working with 2D arrays?
What is the time complexity to access an element in a 2D array with n rows and m columns?
What will be the output of the following code snippet?
arr = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
print(arr[1][2])
What will be the output of the following code snippet?
arr = [[1, 2], [3, 4, 5], [6, 7, 8, 9]]
print(len(arr[1]))
What will be the output of the following code snippet?
arr = [[1, 2], [3, 4], [5, 6]]
print(arr[-1][-1])
What will be the output of the following code snippet?
arr = [[1, 2], [3, 4], [5, 6]]
print(arr[-2][0])
What is the output of the following code snippet?
arr = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
sum = 0
for row in arr:
for elem in row:
sum += elem
print(sum)
What is the output of the following code snippet?
arr = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
print(arr[1:])
What is the output of the following code snippet?
arr = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
print([row[1] for row in arr])
What is the output of the following code snippet?
arr = [[1, 2], [3, 4], [5, 6]]
print([arr[i][i] for i in range(len(arr))])
What is the output of the following code snippet?
arr = [[1, 2], [3, 4], [5, 6]]
print([arr[i][j] for i in range(len(arr)) for j in range(len(arr[i]))])