The king's reaction is decided by the GM, sure....but the results of that action are typically left to dice, no? We don't know exactly what dice or mechanics were used to handle this situation. Nor do we know what opportunities may present themselves before the PCs are killed off by GM fiat, and how such opportunities would be handled mechanically.Of course it's GM whim!
The King is an NPC. NPCs are the GM's characters to play, just as PCs are those of the players, and thus the GM gets to - based on the King's personality and motivations - decide exactly what the King's reaction will be. (I can't believe I actually have to spell this out!)
Amnd if the King's word is the law, which here seems to be the case, then if he says "Off with their heads!" then those PCs are about to get a bit shorter.
All this to say that having my PC die due to HP loss and failed death saves (or whatever relevant mechanic determines such) is one thing. It's observable, it's clear what the risks are, you know how you arrive at that end. And it doesn't come just because the GM says so.....there are rules that the GM is meant to follow that lead to this.
Having an NPC put PCs in stocks and then execute them out of hand is significantly less specific.
Why would we assume that?Assume that in either case the answer is "as many as required to kill the PC beyond easy revivability", for comparison's sake, and proceed.
Based on your previous descriptions of play, I can't imagine that you or your players would simply accept such a fate for their PC if that's what happened in your game. I feel like you'd try to escape, or bargain, or whatever would make sense. And why not?