The format for direct mapped cache is :
$$\begin{array}{|c|c|c|} \hline \text{tag} & \text{index/set} & \text{block size} \\ \hline \end{array}$$
now cache lines/blocks $= 512$ which is $2^9$
block size $= 32$ which is $2^5$
and memory memory address is of $16$ bits i.e
$FBFC\implies 1111 1011 1111 1100$
11(2bit) |
111011111 (9 bit) |
11100(5bit) |
$$\begin{array}{|c|c|c|} \hline 11\text{(2 bit)} & 111011111\text{(9 bit)} & 11100\text{(5 bit)} \\ \hline \end{array}$$
now we can see 9 bit is the cache block number.
$1 1101 1111\implies1 D F\implies(1DF) $
Hence if the cache is direct mapped , that given memory address will map to $1DF$ cache line which is option C .
And in the same way we can show that if it is 8 way set – associative then map to 1F. In 8-way set-associative mapping, number of sets gets reduced by $8$ and hence the number of set bits becomes reduced by $\lg 8 = 3$. These gets added to tag bits as now $8$ times more main memory blocks can go to a single cache block. So, we will have $2+3 = 5$ tag bits and $9-3=6$ index bits. So, the index entry corresponding to $0\text{x}FBFC$ will be $011111 = 1F.$