Q7Numerical3 Marks13 Apr 2025
Consider the following python code:
What is the output of the program when executed?
```
def update_matrix(matrix):
for i in range(len(matrix)):
for j in range(len(matrix[i])):
if i % 2 == 0:
matrix[i][j] += 1
else:
matrix[i][j] += 2
return matrix
def compute_total(matrix):
total = 0
for row in matrix:
total += sum(row)
return total
mat = [[1, 2], [3, 4], [5, 6]]
new_mat = update_matrix(mat)
print(compute_total(new_mat))
```
Press Enter to check.