For $4$ way associative memory (Assuming memory is Byte addressible):
Size of a block $=$ No. of words in a block x Size of a word $= 8$ x $32$ bits = $32$ bytes
So size of the OFFSET field is $5$ bits.
No. of blocks in the cache $=$$\frac{Size\space of\space the\space cache}{Size\space of\space a\space block}$$=$$\frac{16 KB}{32 B} = 512$
No. of sets $= \frac{No.\space of\space blocks}{Associativity} = \frac{512}{4} = 128$
So the no. of bits in the INDEX field $= 7$.
Physical address size $= 32\space bits$.
So the number of bits in the TAG field $= 32 -(5+7) = 20$.
Now For 16 way associative memory using same given values for block size, word size and cache capacity,
OFFSET field $= 5$ (same)
No. of blocks in the cache $= 512$ (same)
No. of sets $= \frac{No.\space of\space blocks}{Associativity} = \frac{512}{16} = 32$
So, the no. of bits in the INDEX field $= 5$
No. of bits in the TAG field $= 32-(5+5) = 22$.