EmSAT Achieve Exam  >  EmSAT Achieve Tests  >  Python for EmSAT Achieve  >  Test: 2D Arrays - 1 - EmSAT Achieve MCQ

Test: 2D Arrays - 1 - EmSAT Achieve MCQ


Test Description

15 Questions MCQ Test Python for EmSAT Achieve - Test: 2D Arrays - 1

Test: 2D Arrays - 1 for EmSAT Achieve 2024 is part of Python for EmSAT Achieve preparation. The Test: 2D Arrays - 1 questions and answers have been prepared according to the EmSAT Achieve exam syllabus.The Test: 2D Arrays - 1 MCQs are made for EmSAT Achieve 2024 Exam. Find important definitions, questions, notes, meanings, examples, exercises, MCQs and online tests for Test: 2D Arrays - 1 below.
Solutions of Test: 2D Arrays - 1 questions in English are available as part of our Python for EmSAT Achieve for EmSAT Achieve & Test: 2D Arrays - 1 solutions in Hindi for Python for EmSAT Achieve course. Download more important topics, notes, lectures and mock test series for EmSAT Achieve Exam by signing up for free. Attempt Test: 2D Arrays - 1 | 15 questions in 30 minutes | Mock test for EmSAT Achieve preparation | Free important questions MCQ to study Python for EmSAT Achieve for EmSAT Achieve Exam | Download free PDF with solutions
Test: 2D Arrays - 1 - Question 1

What is a 2D array in Python?

Detailed Solution for Test: 2D Arrays - 1 - Question 1

In Python, a 2D array is typically represented as a list of lists. It is a data structure that allows you to store elements in a grid-like format with rows and columns. Each inner list within the main list represents a row of elements, and the length of each inner list determines the number of columns in the 2D array.

Test: 2D Arrays - 1 - Question 2

What is a 2D array in Python?

Detailed Solution for Test: 2D Arrays - 1 - Question 2

A 2D array in Python is represented as a list of lists. Each inner list represents a row in the array.

1 Crore+ students have signed up on EduRev. Have you? Download the App
Test: 2D Arrays - 1 - Question 3

What is the shape of a 2D array with n rows and m columns?

Detailed Solution for Test: 2D Arrays - 1 - Question 3

The shape of a 2D array with n rows and m columns is represented as (n, m).

Test: 2D Arrays - 1 - Question 4

Which of the following operations is not valid for a 2D array?

Detailed Solution for Test: 2D Arrays - 1 - Question 4

Appending new rows to a 2D array is not a valid operation. The number of columns must be consistent across all rows.

Test: 2D Arrays - 1 - Question 5

Which module in Python provides functions for working with 2D arrays?

Detailed Solution for Test: 2D Arrays - 1 - Question 5

The numpy module provides functions for working with 2D arrays in Python.

Test: 2D Arrays - 1 - Question 6

What is the time complexity to access an element in a 2D array with n rows and m columns?

Detailed Solution for Test: 2D Arrays - 1 - Question 6

Accessing an element in a 2D array with n rows and m columns takes constant time, O(1), as the indexing operation is direct.

Test: 2D Arrays - 1 - Question 7

What will be the output of the following code snippet?
arr = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
print(arr[1][2])

Detailed Solution for Test: 2D Arrays - 1 - Question 7

The code snippet accesses the element at the second row (index 1) and third column (index 2) of the 2D array. The value is 6.

Test: 2D Arrays - 1 - Question 8

What will be the output of the following code snippet?
arr = [[1, 2], [3, 4, 5], [6, 7, 8, 9]]
print(len(arr[1]))

Detailed Solution for Test: 2D Arrays - 1 - Question 8

The code snippet uses the len() function to get the length of the second row of the 2D array. The length is 4.

Test: 2D Arrays - 1 - Question 9

What will be the output of the following code snippet?
arr = [[1, 2], [3, 4], [5, 6]]
print(arr[-1][-1])

Detailed Solution for Test: 2D Arrays - 1 - Question 9

The code snippet accesses the last element of the last row in the 2D array. The value is 6.

Test: 2D Arrays - 1 - Question 10

What will be the output of the following code snippet?
arr = [[1, 2], [3, 4], [5, 6]]
print(arr[-2][0])

Detailed Solution for Test: 2D Arrays - 1 - Question 10

The code snippet accesses the first element of the second-to-last row in the 2D array. The value is 3.

Test: 2D Arrays - 1 - Question 11

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)

Detailed Solution for Test: 2D Arrays - 1 - Question 11

The code snippet calculates the sum of all elements in the 2D array. The sum will be 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 = 45.

Test: 2D Arrays - 1 - Question 12

What is the output of the following code snippet?
arr = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
print(arr[1:])

Detailed Solution for Test: 2D Arrays - 1 - Question 12

The code snippet prints a sublist of the 2D array starting from the second row. The output will be [[4, 5, 6]].

Test: 2D Arrays - 1 - Question 13

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])

Detailed Solution for Test: 2D Arrays - 1 - Question 13

The code snippet uses a list comprehension to extract the second element from each row of the 2D array. The output will be [2, 5, 8].

Test: 2D Arrays - 1 - Question 14

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))])

Detailed Solution for Test: 2D Arrays - 1 - Question 14

The code snippet uses a list comprehension to extract the diagonal elements from the 2D array. The output will be [1, 4, 6].

Test: 2D Arrays - 1 - Question 15

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]))])

Detailed Solution for Test: 2D Arrays - 1 - Question 15

The code snippet uses a nested list comprehension to flatten the 2D array into a 1D list. The output will be [1, 2, 3, 4, 5, 6].

49 videos|38 docs|18 tests
Information about Test: 2D Arrays - 1 Page
In this test you can find the Exam questions for Test: 2D Arrays - 1 solved & explained in the simplest way possible. Besides giving Questions and answers for Test: 2D Arrays - 1, EduRev gives you an ample number of Online tests for practice

Top Courses for EmSAT Achieve

49 videos|38 docs|18 tests
Download as PDF

Top Courses for EmSAT Achieve