Open coderforlife opened 1 month ago
I agree (will fix in few days). The suggested fix is to skip this question type (VariableDeclaration) for cases where a variable can be first created in different branches. This question type is supposed to be easy and not require actual code tracing. The question that asks for values assigned to a variable (VariableTrace) can be used to address this type of knowledge where required.
For example, the following code (which is lines 31-47) with an argument of 21:
Had the question generated:
A value is assigned to variable
suffix
on line 42. On which line issuffix
created? A. 38 B. 43 C. 46 D. 47The variable on line 42 is created on line 42, not line 38 (which was never run). In fact, line 42 itself never runs (line 40 does, and that is the line that created the variable, but it isn't a possible answer). But if we don't account for the actual argument given to the function, the answer would be 42, which is not a choice given.