The figure in Panel I below is a grid of cells with four rows and four columns.
The numbers on the top and on the left represent the number of cells that are to
be shaded in that column and row, respectively. Which one of the options shown
in Panel II below represents the grid shaded correctly?

This is a classic constraint-grid puzzle, solved by cross-checking row totals against column totals.
Approach: Treat the row numbers and column numbers as two independent counting constraints on the same 4 by 4 grid. A correct shading must satisfy both sets of constraints at once -- picking a grid that only gets the row totals right, or only the column totals right, is not enough.
Going through the four candidate grids one at a time, count shaded squares along each of the 4 rows and compare to the row clues, then repeat for each of the 4 columns against the column clues. Grids (i), (iii) and (iv) fail this check on at least one row or column.
Grid (ii) passes the check for all 4 rows and all 4 columns simultaneously, so it is the unique valid shading.
Final answer: option (ii).