If row-major order is used, how is the following matrix stored in memory? a b…

2023

If row-major order is used, how is the following matrix stored in memory?

a b c

d e f

g h i

  1. A.

    ihgfedcba

  2. B.

    abcdefghi

  3. C.

    cfibehadg

  4. D.

    adgbehcfi

Attempted by 699 students.

Show answer & explanation

Correct answer: B

Answer: b

Explanation: In row-major order, elements are stored row by row. The matrix has three rows: [a b c], [d e f], [g h i]. The correct memory order is a, b, c, d, e, f, g, h, i.

Explore the full course: Accenture Preparation