Installing RAM in a 27 inch late 2013 iMac
No, you do not have to use all 4 slots in your iMac.

However, I haven't personally seen a 16GB RAM chip used in your model iMac and I've seen a lot of iMacs in my time, so others here may have to comment on whether they've actually tried it. Typically, to get to the maximum 32GB RAM, users have 4 x 8GB RAM chips installed (one in each slot).

The configuration I've personally seen the most is 24GB RAM installed, made up of the two 4GB chips originally installed by Apple and an additional two 8GB chips installed by the end user in the two remaining slots. 24GB RAM is nothing to sneeze at.

Please note:


The RAM your iMac needs must meet the following specs: 204-pin PC3-12800 (1600 MHz) DDR3 SO-DIMM
Apple provides  full instructions on how to install RAM in an iMac