Generation of Programming Exam Question and Answer Using ChatGPT Based on Prompt Engineering
This study addresses the inefficiency of traditional programming exam design and its limited capacity to holistically assess students’ creativity, problem-solving skills, and domain knowledge. It presents the first systematic application of prompt engineering to the automatic generation of programming examination questions, proposing a method that leverages carefully crafted, diverse prompt templates to guide ChatGPT—without requiring fine-tuning of large language models. The approach autonomously produces high-quality questions and reference solutions spanning theoretical and practical aspects, multiple question types, and varying difficulty levels. Experimental results demonstrate that the generated items match or exceed the quality of human-authored questions while substantially improving item development efficiency. User studies further confirm the method’s effectiveness and practical value in educational settings.