Computer Science Engineering (CSE) Exam  >  Computer Science Engineering (CSE) Questions  >  A two-dimensional array named Arr is with the... Start Learning for Free
A two-dimensional array named Arr is with the range Arr[10........20, 25......45]. The base address of the array is 10 and the size of each element is 2 bytes. What will be the location of Arr[15][30] using column major order?
  • a)
    35
  • b)
    130
  • c)
    230
  • d)
    70
Correct answer is option 'B'. Can you explain this answer?
Most Upvoted Answer
A two-dimensional array named Arr is with the range Arr[10........20, ...
Solution:

Given,
- Range of the 2D array Arr is Arr[10........20, 25......45]
- Base address of the array is 10
- Size of each element is 2 bytes

To find the location of Arr[15][30] using column major order,

Step 1: Find the total number of rows and columns in the array
- Number of rows = 20 - 10 + 1 = 11
- Number of columns = 45 - 25 + 1 = 21

Step 2: Calculate the offset of Arr[15][30] using column major order
- Offset = (30 - 25) * 11 + (15 - 10) = 5 * 11 + 5 = 60

Step 3: Calculate the location of Arr[15][30] using column major order
- Location = Base address + (Offset * Size of each element)
- Location = 10 + (60 * 2) = 130

Therefore, the location of Arr[15][30] using column major order is option B, which is 130.

Note: In column major order, the elements are stored column-wise. Hence, we first need to calculate the offset of the element in the column and then multiply it by the number of rows to get the total offset. Finally, we add the base address to get the location.
Free Test
Community Answer
A two-dimensional array named Arr is with the range Arr[10........20, ...
Column major order concept: 
  • Column major order means the element in a column is stored adjacent to each other. This basically works in a 2d and 3d array.
  • Now we are given the base address along with the size of each element and the construction of a 2d array(row and column number )
  • First, we have to calculate the no. of rows here = (Row upper limit - Row lower limit) + 1 = (20 - 10) + 1 = 11.
  • We need no. of the column if the ques will ask about Row major order.
  • There is a formula available to calculate it directly(Rather than going into deep how the formula came, it's better to remember the formula.)
Formula:-
Address of A[I][J] is can be calculated with the formula is A[I][J] = B + ((J – LC) * M + (I – LR))*W.
where;
  • I- Row subset of an element whose address is to be found ( 15 here)
  • J = Column Subset of an element whose address is to be found,(30 here)
  • B- Base address(10 here)
  • W- storage size of one element  (2 bytes here)
  • LR- the lower limit of row (u can take start index of the matrix)- (10 in this ques)
  • LC-Lower limit of column(start column index of the matrix) - (25 in this ques)
  • M- number of rows given in the matrix. (11 here)
 
Now solve the equation by solving the inner bracket first.
10+[5*11+5] *2  = 10+(60)*2 = 10+120= 130 will be the answer.
Explore Courses for Computer Science Engineering (CSE) exam

Similar Computer Science Engineering (CSE) Doubts

Top Courses for Computer Science Engineering (CSE)

A two-dimensional array named Arr is with the range Arr[10........20, 25......45]. The base address of the array is 10 and the size of each element is 2 bytes. What will be the location of Arr[15][30] using column major order?a)35b)130c)230d)70Correct answer is option 'B'. Can you explain this answer?
Question Description
A two-dimensional array named Arr is with the range Arr[10........20, 25......45]. The base address of the array is 10 and the size of each element is 2 bytes. What will be the location of Arr[15][30] using column major order?a)35b)130c)230d)70Correct answer is option 'B'. Can you explain this answer? for Computer Science Engineering (CSE) 2024 is part of Computer Science Engineering (CSE) preparation. The Question and answers have been prepared according to the Computer Science Engineering (CSE) exam syllabus. Information about A two-dimensional array named Arr is with the range Arr[10........20, 25......45]. The base address of the array is 10 and the size of each element is 2 bytes. What will be the location of Arr[15][30] using column major order?a)35b)130c)230d)70Correct answer is option 'B'. Can you explain this answer? covers all topics & solutions for Computer Science Engineering (CSE) 2024 Exam. Find important definitions, questions, meanings, examples, exercises and tests below for A two-dimensional array named Arr is with the range Arr[10........20, 25......45]. The base address of the array is 10 and the size of each element is 2 bytes. What will be the location of Arr[15][30] using column major order?a)35b)130c)230d)70Correct answer is option 'B'. Can you explain this answer?.
Solutions for A two-dimensional array named Arr is with the range Arr[10........20, 25......45]. The base address of the array is 10 and the size of each element is 2 bytes. What will be the location of Arr[15][30] using column major order?a)35b)130c)230d)70Correct answer is option 'B'. Can you explain this answer? in English & in Hindi are available as part of our courses for Computer Science Engineering (CSE). Download more important topics, notes, lectures and mock test series for Computer Science Engineering (CSE) Exam by signing up for free.
Here you can find the meaning of A two-dimensional array named Arr is with the range Arr[10........20, 25......45]. The base address of the array is 10 and the size of each element is 2 bytes. What will be the location of Arr[15][30] using column major order?a)35b)130c)230d)70Correct answer is option 'B'. Can you explain this answer? defined & explained in the simplest way possible. Besides giving the explanation of A two-dimensional array named Arr is with the range Arr[10........20, 25......45]. The base address of the array is 10 and the size of each element is 2 bytes. What will be the location of Arr[15][30] using column major order?a)35b)130c)230d)70Correct answer is option 'B'. Can you explain this answer?, a detailed solution for A two-dimensional array named Arr is with the range Arr[10........20, 25......45]. The base address of the array is 10 and the size of each element is 2 bytes. What will be the location of Arr[15][30] using column major order?a)35b)130c)230d)70Correct answer is option 'B'. Can you explain this answer? has been provided alongside types of A two-dimensional array named Arr is with the range Arr[10........20, 25......45]. The base address of the array is 10 and the size of each element is 2 bytes. What will be the location of Arr[15][30] using column major order?a)35b)130c)230d)70Correct answer is option 'B'. Can you explain this answer? theory, EduRev gives you an ample number of questions to practice A two-dimensional array named Arr is with the range Arr[10........20, 25......45]. The base address of the array is 10 and the size of each element is 2 bytes. What will be the location of Arr[15][30] using column major order?a)35b)130c)230d)70Correct answer is option 'B'. Can you explain this answer? tests, examples and also practice Computer Science Engineering (CSE) tests.
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

Explore Courses
Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev