in Computer Graphics edited by
9,259 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

4 Comments

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