Data Structures and Structures Flashcards

1
Q

What is the address of a element i in a 1D array?

A

base addy + (i x element size)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Where is an array located? Local variables are also located here.

A

In the function’s stack frame

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is a stack frame?

A

A structure on the call stack that is created each time a function is called.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How can accessing of an array element be optimized?

A

By doing LSL in the STR instruction

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What must you want to access an element of an array but the index is in a w register?

A

Sign extend

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are the 2 ways to traverse a 2D array? Which is the most common when sorting arrays in RAM?

A

Row-major order
Column-major order

Row-major (first all elements of r0 then r1)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the block size for an n-dimensional array?

A

Check notes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly