What is the total number of elements in an array E[−4 : 1, 6 : 10]?

2021

What is the total number of elements in an array E[−4 : 1, 6 : 10]?

  1. A.

    30

  2. B.

    20

  3. C.

    9

  4. D.

    11

Attempted by 890 students.

Show answer & explanation

Correct answer: A

To find the total number of elements in a 2D array E[−4 : 1, 6 : 10], calculate the number of elements in each dimension and multiply them.

Step 1: For the first dimension (−4 to 1), the number of elements is calculated as:

1 - (−4) + 1 = 6

Step 2: For the second dimension (6 to 10), the number of elements is:

10 - 6 + 1 = 5

Step 3: Multiply the number of elements in each dimension:

6 × 5 = 30

Thus, the total number of elements in the array is 30.

Explore the full course: Up Lt Grade Assistant Teacher 2025