NumPy slicing uses the same start/stop rules as Python sequences, and it also supports negative indices to count from the end. In a 2D array, slicing is written as array[rows, columns]. To get thelast two rows, you use -2: in the row position, meaning “start two rows from the end and go to the end.” Similarly, to get thelast two columns, you use -2: in the column position. Combining these gives array[-2:, -2:], which selects the bottom-right 2×2 subarray.
Option A, array[-2:, :], selects the last two rows butall columns, so it is not restricted to the last two columns. Option D, array[:, -2:], selects all rows but only the last two columns. Option B, array[-1:, -1:], selects only the last row and the last column, producing a 1×1 (or 1×1 view) subarray, not a 2×2.
This kind of slicing is widely taught because it is essential for matrix operations, extracting submatrices, working with sliding windows, and manipulating image or time-series data where “take the last k observations/features” is common. Negative indexing reduces errors and makes code clearer, especially compared with computing explicit indices like array[rows-2:rows, cols-2:cols].