in Computer Graphics edited by
9,278 views
3 votes
3 votes

A frame buffer array is addressed in row major order for a monitor with pixel locations starting from $(0,0)$ and ending with $(100,100).$ What is address of the pixel $(6,10)?$ Assume one bit storage per pixel and starting pixel location is at $0.$

  1. $1016$
  2. $1006$
  3. $610$
  4. $616$
in Computer Graphics edited by
9.3k views

2 Comments

Whats answer provided? is it 616?
1
1

Suppose the array is of size m by n,

Given that m=101 and n=101

For row major order

loc(i,j) = (Base Address) + (i*n + j) * (size of each element)

Where n is the total number of columns.

So, loc(6,10) = 0 + (6*101 + 10)*1 = 616

1
1

4 Answers

12 votes
12 votes
Best answer

Address of pixel (6,10) in row major order is,

= 0 + 1((6 - 0) +101 (10 - 0))

= 1016

(For pixel calculation address in row major order , use logic of how to find address of array element in column major order .)

selected by
by

21 Comments

how can this be 616 ? My answer is 610
0
0
Thanks for pointing out !!!!
0
0
Its Actual answer is 1016.
0
0
how the answer is 1016 kindly explain.
0
0
@neha ,

your question is saying row major , hence it will be 616

and for column major, it will be 1016 .
0
0
This is in official answer key of isro..
0
0
yes, i know but it should be 616 .

1016 will come for column major.

you should refer this,it will help you....

http://www.guideforschool.com/625348-memory-address-calculation-in-an-array/
0
0
no.there is a difference . the question is related pixel location calculations, please do not mixed it with array address calculations. The answer is correct .

For calculating the address of a pixel varying from (0,0)- (100,100) formula is:-

 

addr(6,10)=addr(0,0)+y(xmax+1)+x

i.e=0+10(100+1)+6

1010+6 =1016 .(ans)

this is the correct solution for this qusetion
4
4
@Preeti,

thanks , for pointing it out .

I hv corrected it .
0
0
yaa it is from computer graphics
0
0
0+1(6*101+10)=616
0
0
why we need to take xmax+1. i hope we need to take y(xmax) +x.

like in 2-D cartesian coordinate system we consider from origin 0,0 and 5,5 means x- 5 units and y- 5 units.

 

correct me if i m wrong
0
0
I think array column order formula is best to remember to solve pixel based questions...
0
0
Can you explain the reason of this? (Taking row major order in pixel geometry as column major order of array)
1
1

@Ravi 

Check this :- https://www.siggraph.org/education/materials/HyperGraph/scanline/outprims/setpixel.htm

You can learn that formula OR simply use column major approach for array address calculation to calculate pixel address. I read that somewhere. You can google it .

1
1
@Kapil:-

For Row Major answer is 610(as i have posted in my solution) but key say answer is 1016. so we need to calculate row major or column major?
0
0
There's a whole different formula for pixel address calculation, but to reduce the efforts needed to byheart that, it has the same behaviour as that of column major address calc. in an array.

Hence, we can simply use column major .
0
0
Thank you kapil
0
0
Then what we need to do for Column major order?
0
0
Why have you taken 101?
0
0
they have explicitly mentioned row-major order.
0
0
1 vote
1 vote

Column Major System:

The address of a location in Column Major System is calculated using the following formula:

Address of A [ I ][ J ] = B + W * [  ( I – Lr ) + M*( J – Lc ) ]

A[6][10] = 0 + 1[(6-0) +100*10] = 1016

Answer is A

edited by

4 Comments

Divya Bharti

the question is asked as the array is addressed in row major order and also can u please elaborate the terms in the formula used .

And even the answer as per the ISRO key modified is option D

1
1
I was having the same doubt(and earlier solved it using row major order).So,if you see the above comments,Kapil mentioned that for pixels we need column major order by default.

But as you are saying that modified key has option D,let's confirm it again

@kapil- can you please confirm once again to use row major or column major
0
0

dattasai Please share revised answer key of ISRO

0
0
0 votes
0 votes
Hope the answer is A
by
0 votes
0 votes
Let’s imagine the frame buffer to be a matrix of 100x100, so we define this as 2d array in C(or any language for that matter), note that the size of the array should be actually array[101][101] since we need to store 100, this is from the fact that if you need to store a single element in a array you need to declare it as array[1] and not array[0] which would not make sense, right?

Now we have maximum rows = maximum colums = 101. So we can get the address of element by using row-major order.

 

Case 1: Row Major Order

Address = Base Adress + Size of Single Element * (Row * Maximum Row Value) + Column

So, we have,

0 + 1 * (6 * 101) + 10 = 616

 

Case 2: Column Major Order

Address = Base Address + Size of Single Element * (Column * Maximum Column Value) + Row

So, we have,

0 + 1 * (10 * 101) + 6 = 1016

I have no clue what is the answer, some website says it’s 616 and some say it’s 1016. If anyone have any ideas, please comment below. I really would like to know.
Answer:

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true