A revision question about Multi Dimensional arrays (2 Viewers)

juventino

Juventus For Life
Joined
Jun 4, 2003
Messages
385
Location
Western sydney ;)
Gender
Male
HSC
2004
As I was doing some revision questions from the execl, I stubbled across this one...and it doesn't explain it all that well.

ARRAY 1 2 3 4
----------------------------------
1 | 2 3 1 6
2 | 3 9 4 8
3 | 7 4 16 11

What is the value of : ARRAY[ARRAY[2,3],ARRAY[2,1]] ?

a)11
b)1
c)7
d)8

Ok...HOw does this work?!! (the answer given at the back is 11 by the way)


Thanks
 

sunny

meh.
Joined
Jul 7, 2002
Messages
5,350
Gender
Male
HSC
2002
juventino said:
As I was doing some revision questions from the execl, I stubbled across this one...and it doesn't explain it all that well.

ARRAY 1 2 3 4
----------------------------------
1 | 2 3 1 6
2 | 3 9 4 8
3 | 7 4 16 11

What is the value of : ARRAY[ARRAY[2,3],ARRAY[2,1]] ?

a)11
b)1
c)7
d)8

Ok...HOw does this work?!! (the answer given at the back is 11 by the way)


Thanks

Lets break down ARRAY[ARRAY[2,3],ARRAY[2,1]]

ARRAY[2,3] = 4 (across 2, then down 3, like coordinates; x then y)
ARRAY[2,1] = 3

Thus,
ARRAY[ARRAY[2,3],ARRAY[2,1]] = ARRAY[4, 3]

Go 4 across, then 3 down, and you have 11.
 

Winston

Active Member
Joined
Aug 30, 2002
Messages
6,128
Gender
Undisclosed
HSC
2003
Heh easy dude, look at it logically basically it's saying obtain the real positions, so if you look for the numbers it's actually [4,3] which is essentially point to 11, because ARRAY[2,3] = 4, and ARRAY[2,1] = 3 right?

*EDIT damn, sunny beat me :p
 

Wild Dan Hibiki

teh sex0r
Joined
Feb 28, 2004
Messages
649
Gender
Undisclosed
HSC
2004
hehehe i did that question a few days ago, good thing i got it wrong during class exercises so i was able to remember how to get the answer.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 2)

Top