What distinguishes kam from ayy in a question?

Inshāʾ (Non-Declarative Speech): Wishing, Questions, Commands and Prohibitions