Step 1: Understanding the Concept
We need to determine the function of this imperative sentence. Imperative sentences give orders, instructions, advice, or make requests.
Step 2: Analyzing the Sentence Structure and Tone
The sentence starts with a verb ("Hang") and gives a direct order. The use of the adverb "immediately" adds a sense of urgency and authority, removing any possibility of it being a polite request or a gentle suggestion.
Step 3: Evaluating the Options
(A) requesting: A request would be softer, likely using "please" or a question format (e.g., "Could you please...?"). This sentence is too harsh for a request.
(B) commanding: To give an authoritative order. This perfectly describes the function of the sentence. It is a direct, non-negotiable instruction.
(C) suggesting: A suggestion is a proposal for consideration, not a direct order. A suggestion might be "Perhaps we should hang the prisoner."
(D) complaining: The sentence expresses no dissatisfaction; it gives an instruction.
Step 4: Final Answer
The sentence "Hang the prisoner immediately" is a direct order, so its function is commanding. Option (B) is correct.