To match the CNC codes correctly, we review the meaning of each code. G91 represents incremental coordinate programming, where each position is specified relative to the previous point rather than an absolute origin. Therefore, P must match function 2. M02 is used to signal the end of program, so Q matches function 1. G32 is the standard G-code for thread cutting in turning operations, making R associated with function 4. Finally, M05 is used in CNC machines to command spindle stop, so S corresponds to function 3. Therefore, the correct matching is P-2, Q-1, R-4, S-3, which corresponds to option (B).