Owing to the large number of students that academic institutions have to accommodate, automated evaluation of students' programs has received impetus in recent years; an automated evaluator not only ensures speedy evaluation but also consistency in distribution of marks. A construct that appears frequently in programs is the else-if block. The condition that appears in a subsequent else-if block should not be weaker (i.e., less general) than any of its preceding conditions, otherwise this block will never be executed (in other words, this block qualifies as dead code). Such wrong ordering of conditions in else-if blocks are often introduced by novice student programmers. It is to be noted that such violation of precedence of conditions in else-if constructs qualifies as logical error which is not detected by standard compilers, such as gcc. In this work, we tabulate different cases to identify the correct and the incorrect precedence of conditions in else-if constructs and thereby, automatically report such errors in students' programs and also provide feedback towards error correction.
Keywords: Computer-assisted learning, Automated program evaluation, else-if construct.