Knowee
Questions
Features
Study Tools

What do you mean by the terms “Dimension” and “Subscript” when we talk about arrays?

Question

What do you mean by the terms “Dimension” and “Subscript” when we talk about arrays?

🧐 Not the exact question you are looking for?Go ask a question

Solution

"Dimension" and "Subscript" are two terms commonly used when discussing arrays in programming.

  1. Dimension: In the context of arrays, a dimension represents a new level of depth. An array's dimension indicates how many indices you need to select an element. For example, a 1-dimensional array is a simple list of items, where each item can be accessed by a single index. A 2-dimensional array, on the other hand, can be thought of as a table, where each element is accessed by two indices (one for the row and one for the column).

  2. Subscript: The subscript refers to the index used to access an element within the array. In a 1-dimensional array, there is one subscript. In a 2-dimensional array, there are two subscripts. The subscript is usually enclosed in square brackets following the name of the array. For example, in the array named 'a', a[3] would access the fourth element (assuming the array is zero-indexed).

In summary, the dimension of an array refers to the number of indices needed to access an element, and the subscript is the actual index or indices used to access these elements.

This problem has been solved

Similar Questions

In C/C++ language, the subscript of array starts from ______.

What does the ndim function do?Gets the dimensions of a graphGets the number of dimensions only for sparse arraysGets the number of dimensions of an array

what is an array

One way to think of a multi-dimensional array, is as an array of arrays. When you use brackets to access your array, the first set of brackets refers to the entries in the outermost (the first level) array, and each additional pair of brackets refers to the next level of entries inside.Exampleconst arr = [ [1, 2, 3], [4, 5, 6], [7, 8, 9], [[10, 11, 12], 13, 14]];const subarray = arr[3];const nestedSubarray = arr[3][0];const element = arr[3][0][1];In this example, subarray has the value [[10, 11, 12], 13, 14], nestedSubarray has the value [10, 11, 12], and element has the value 11 .Note: There shouldn't be any spaces between the array name and the square brackets, like array [0][0] and even this array [0] [0] is not allowed. Although JavaScript is able to process this correctly, this may confuse other programmers reading your code.Using bracket notation select an element from myArray such that myData is equal to 8.Run the Tests (Ctrl + Enter)Reset this lessonGet HelpTestsWaiting:myData should be equal to 8.Waiting:You should be using bracket notation to read the correct value from myArray.

Briefly explain the meaning of the following terms in the context of java programming.Write java code snippet that demonstrates implementation of each case. [4 Marks]i). one dimension Arrayii) Two-dimension array

1/3

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.