Consider a raster grid having ๐‘‹๐‘Œ-axes in positive ๐‘‹-direction and positiveโ€ฆ

2016

Consider a raster grid havingย ๐‘‹๐‘Œ-axes in positiveย ๐‘‹-direction and positive upwardย ๐‘Œ-direction withย ๐‘‹๐‘š๐‘Ž๐‘ฅย = 10,ย ๐‘‹๐‘š๐‘–๐‘›ย = โ€“5,ย ๐‘Œ๐‘š๐‘Ž๐‘ฅย = 11, andย ๐‘Œ๐‘š๐‘–๐‘›ย = 6. What is the address of memory pixel with locationย (5,4)ย in raster grid assuming base addressย 1ย (one) ?

  1. A.

    150

  2. B.

    151

  3. C.

    No valid address

  4. D.

    untime error due to an invalid coordinate

Attempted by 124 students.

Show answer & explanation

Correct answer: C

Conclusion: The coordinate (5,4) is outside the defined raster grid because Ymin = 6 and 4 < 6. Therefore there is no valid memory address within the given grid for (5,4).

  • Number of columns = Xmax - Xmin + 1 = 10 - (-5) + 1 = 16.

  • Number of rows = Ymax - Ymin + 1 = 11 - 6 + 1 = 6.

  • Using row-major ordering with the origin at (Xmin, Ymin) (i.e., rows counted upward) and base address = 1, the address formula is:

  • Address = base + (y - Ymin) * (number of columns) + (x - Xmin).

  • Apply to (5,4): y - Ymin = 4 - 6 = -2, which is outside the valid row index range (0 to 5). Hence the point is outside the grid and the formula does not produce a valid in-grid address.

  • Example for a valid point: for (5,6) (lowest valid row), address = 1 + (6 - 6)*16 + (5 - (-5)) = 1 + 0 + 10 = 11.

Recommendation: Verify the intended coordinates. If a different y-value within 6..11 was intended, use the formula above to compute the correct address.

Explore the full course: Nta Ugc Net Paper 2

Loading lessonโ€ฆ