// Syntax: // Comment for reader's benefit, not parsed // # Template Number - +100 for each new type of problem, +10 for each new subtype // Learning Objective(s) for this template - when this template should be used // ? // If student gets the answer right, what OTHER objectives should get credit // Usually, counterpoint to the point of the error, say allocation for missing // deallocation, Declaration for out of scope error, assignment for incorrect // referencing, etc. // Make sure there is no overlap between this and antecedents! // : // If student gets the answer wrong, what OTHER objectives should get discredit // Make sure there is no overlap between this and antecedents! // > // The template itself, no double quotes, preceded and succeeded by a single > // > // Type: debug / output / code / expression // Hardness: The student's correct percentage up to which this template will be used // Note: Syntax for learning objectives (in antecedent, ifCorrect, ifWrong) // is dot.separated, with {,} to represent alternates. // e.g., a.{b,c} is a.b and a.c // This is NOT graph structured, i.e., a,{b,c}.d is not accounted for to mean // a.b.d or a.c.d // Pointer - Accessing pointer out of scope // Technically, students can also say variable accessed outside scope // - ambiguous - used in Spring 2004 // # 101 // Pointer.Declaration.scope.Accessing pointer out of scope // ? // Pointer.Declaration.{Correct,scope.Correct} // > // {(){{;=;=;}<<;}} // > // Type: debug // Hardness: 100 // Technically, students can also say variable accessed outside scope // - ambiguous, used in Spring 2004 // # 102 // Pointer.Declaration.scope.Accessing pointer out of scope // ? // Pointer.Declaration.{Correct,scope.Correct} // > // {(){{=;;=;}<<;}} // > // Type: debug // Hardness: 100 // Although this is correct, it is confusing to students // - 5 instances of students answering this incorrectly on post-test // even after solving out of scope problems correctly on practice // in Spring 2004 - so discarding // # 104 // Pointer.Declaration.scope.Accessing pointer out of scope // ? // Pointer.Declaration.{Correct,scope.Correct} // > // {(){=;{=;;{=;}}<<;}} // > // Type: debug // Hardness: 100 # 101 Pointer.Declaration.scope.Accessing pointer out of scope ? Pointer.Declaration.{Correct,scope.Correct} > {(){=;{;=;}<<;}} > Type: debug Hardness: 100 # 102 Pointer.Declaration.scope.Accessing pointer out of scope ? Pointer.Declaration.{Correct,scope.Correct} > {(){=;{;{=;}}<<;}} > Type: debug Hardness: 100 # 103 Pointer.Declaration.scope.Accessing pointer out of scope ? Pointer.Declaration.{Correct,scope.Correct} > {(){=;{;=;<<;}{;=;}<<;}} > Type: debug Hardness: 100 # 104 Pointer.Declaration.scope.Accessing pointer out of scope ? Pointer.Declaration.{Correct,scope.Correct} > {(){=;{;=;}<<;{;=;<<;}}} > Type: debug Hardness: 100 // Pointer - Dangling Pointer # 201 Pointer.Dereferencing.Dereferencing pointer after the variable to which it points goes out of scope ? Variable.Declaration.{Correct,scope.Correct} > {(){;{=;=;}<<;}} > Type: debug Hardness: 100 # 202 Pointer.Dereferencing.Dereferencing pointer after the variable to which it points goes out of scope ? Variable.Declaration.{Correct,scope.Correct} > {(){;{=;{=;}}<<;}} > Type: debug Hardness: 100 # 203 Pointer.Dereferencing.Dereferencing pointer after the variable to which it points goes out of scope ? Variable.Declaration.{Correct,scope.Correct} > {(){;{=;{=;=;}}<<;}} > Type: debug Hardness: 100 # 204 Pointer.Dereferencing.Dereferencing pointer after the variable to which it points goes out of scope ? Variable.Declaration.{Correct,scope.Correct} > {(){=;{;{=;=;}<<;}}} > Type: debug Hardness: 100 # 211 Pointer.Dereferencing.Dereferencing pointer before initializing/allocating > {(){;=;<<;=;}} > Type: debug Hardness: 100 # 212 Pointer.Dereferencing.Dereferencing pointer before initializing/allocating > {(){=;;<<;=;}} > Type: debug Hardness: 100 # 213 Pointer.Dereferencing.Dereferencing pointer before initializing/allocating ? Pointer.Declaration.scope.Correct > {(){;{=;<<;=;}}} > Type: debug Hardness: 100 # 214 Pointer.Dereferencing.Dereferencing pointer before initializing/allocating ? Variable.Declaration.scope.Correct > {(){=;{;<<;=;}}} > Type: debug Hardness: 100 # 215 Pointer.Dereferencing.Dereferencing pointer before initializing/allocating ? Pointer.Declaration.scope.Correct > {(){;{<<;=;=;}}} > Type: debug Hardness: 100 # 216 Pointer.Dereferencing.Dereferencing pointer before initializing/allocating ? Pointer.Declaration.scope.Correct > {(){;<<;{=;=;}}} > Type: debug Hardness: 100 # 217 Pointer.Dereferencing.Dereferencing pointer before initializing/allocating > {(){;<<;=;=;}} > Type: debug Hardness: 100 // # 250 // Pointer.Dereferencing.Dereferencing pointer after the anonymous variable to which it points is deallocated // > // {(){;=new();<<;delete;<<;}} // > // Type: debug // Hardness: 40 // // # 251 // Pointer.Dereferencing.Dereferencing pointer after the anonymous variable to which it points is deallocated // > // {(){;=new;delete;<<;}} // > // Type: debug // Hardness: 40 // // # 252 // Pointer.Dereferencing.Dereferencing pointer after the anonymous variable to which it points is deallocated // > // {(){;{=new();<<;delete;}<<;}} // > // Type: debug // Hardness: 40 // // # 253 // Pointer.Dereferencing.Dereferencing pointer after the anonymous variable to which it points is deallocated // > // {(){;{=new();<<;delete;}=;<<;<<;}} // > // Type: debug // Hardness: 40 // Pointer - Code OK # 301 Pointer.{Dereferencing.Correct,Deallocation.Correct} ? Pointer.{Declaration.Correct,Allocation.Correct} > {(){;=new();<<;delete;}} > Type: debug Hardness: 100 # 302 Pointer.{Dereferencing.Correct,Deallocation.Correct} ? Pointer.{Declaration.{Correct,scope.Correct},Allocation.Correct} > {(){;{=new();<<;}delete;}} > Type: debug Hardness: 100 # 303 Pointer.{Dereferencing.Correct,Deallocation.Correct} ? Pointer.{Declaration.{Correct,scope.Correct},Allocation.Correct} > {(){;{=new();}<<;{delete;}}} > Type: debug Hardness: 100 # 304 Pointer.{Dereferencing.Correct,Deallocation.Correct} ? Pointer.{Declaration.{Correct,scope.Correct},Allocation.Correct} > {(){;=new();{<<;}delete;}} > Type: debug Hardness: 100 # 311 Pointer.Dereferencing.Correct ? Pointer.{Declaration.{Correct,scope.Correct},Assignment.Correct} > {(){;{=;=;<<;}}} > Type: debug Hardness: 100 # 312 Pointer.Dereferencing.Correct ? Pointer.{Declaration.Correct,Assignment.Correct} : Pointer.{Declaration.Correct,Assignment.Correct,Dereferencing.Correct,Deallocation.Correct} > {(){=;{;=;<<;}}} > Type: debug Hardness: 100 # 313 Pointer.Dereferencing.Correct ? Pointer.{Declaration.Correct,Assignment.Correct} > {(){;=;=;<<;}} > Type: debug Hardness: 100 # 314 Pointer.Dereferencing.Correct ? Pointer.{Declaration.Correct,Assignment.Correct} > {(){=;;=;<<;}} > Type: debug Hardness: 100 // Pointer - Semantic Error # 401 Pointer.Dereferencing ? Variable.Referencing.Referencing variable before initializing its value : Variable.Referencing.Correct > {(){;;=;<<;}} > Type: debug Hardness: 100 # 402 Pointer.Dereferencing ? Variable.Referencing.Referencing variable before initializing its value : Variable.Referencing.Correct > {(){;{;=;<<;}}} > Type: debug Hardness: 100 # 403 Pointer.Dereferencing ? Variable.Referencing.Referencing variable before initializing its value : Variable.Referencing.Correct > {(){;{;=;<<;}}} > Type: debug Hardness: 100 # 404 Pointer.Dereferencing ? Variable.Referencing.Referencing variable before initializing its value : Variable.Referencing.Correct > {(){;;{=;}<<;}} > Type: debug Hardness: 100 # 411 Pointer.Anonymous Variable.Referencing.Referencing anonymous variable before initializing its value ? Pointer.Anonymous Variable.Referencing.Correct > {(){;=new;<<;delete;}} > Type: debug Hardness: 100 # 412 Pointer.Anonymous Variable.Referencing.Referencing anonymous variable before initializing its value ? Pointer.{Anonymous Variable.Referencing.Correct,Declaration.scope.Correct} > {(){;{=new;<<;}delete;}} > Type: debug Hardness: 100 # 413 Pointer.Anonymous Variable.Referencing.Referencing anonymous variable before initializing its value ? Pointer.{Anonymous Variable.{Referencing.Correct,scope.Correct},Declaration.scope.Correct} > {(){;{=new;}<<;{delete;}}} > Type: debug Hardness: 100 # 414 Pointer.Anonymous Variable.Referencing.Referencing anonymous variable before initializing its value ? Pointer.{Anonymous Variable.Referencing.Correct,Declaration.scope.Correct} > {(){;=new;{<<;}delete;}} > Type: debug Hardness: 100 // Pointer - Lost Objects # 501 Pointer.Deallocation.No pointer pointing to the anonymous variable ? Pointer.Allocation.Correct > {(){;=new();<<;}} > Type: debug Hardness: 100 # 502 Pointer.Deallocation.No pointer pointing to the anonymous variable ? Pointer.{Declaration.scope.Correct,Allocation.Correct} > {(){;{=new();<<;}}} > Type: debug Hardness: 100 # 503 Pointer.Deallocation.No pointer pointing to the anonymous variable ? Pointer.{Declaration.scope.Correct,Allocation.Correct,Anonymous Variable.scope.Correct} > {(){;{=new();}<<;}} > Type: debug Hardness: 100 # 504 Pointer.Deallocation.No pointer pointing to the anonymous variable ? Pointer.Allocation.Correct > {(){{;=new();<<;}=;<<;}} > Type: debug Hardness: 100 # 505 Pointer.Deallocation.No pointer pointing to the anonymous variable ? Pointer.Allocation.Correct > {(){=;{;=new();<<;}<<;}} > Type: debug Hardness: 100 # 506 Pointer.Deallocation.No pointer pointing to the anonymous variable ? Pointer.Allocation.Correct > {(){;=new();{;=new();<<;}<<;}} > Type: debug Hardness: 100 # 507 Pointer.Deallocation.No pointer pointing to the anonymous variable ? Pointer.{Allocation.Correct,Assignment.Correct} > {(){;=;=;{;=new();<<;}<<;}} > Type: debug Hardness: 100 # 508 Pointer.Deallocation.No pointer pointing to the anonymous variable ? Pointer.{Allocation.Correct,Assignment.Correct} > {(){;=new();{;=;=;<<;}<<;}} > Type: debug Hardness: 100 # 999 Pointer.Dereferencing ? Variable.Referencing.Correct > {(){=;{; = ;=;<<;}}} > Type: debug Hardness: 100 // ------------------------------------------------------------------------------ // Templates used for the trial run // Intentionally do not provide correct learning objectives, // so that trial run does not affect student's learning objectives // Semantic error # 90 Demonstration > {(){;<<;}} > Type: debug Hardness: 10 // Code OK # 91 Demonstration > {(){=;{<<;}}} > Type: debug Hardness: 10 // Syntax error # 92 Demonstration > {(){{;}<<;}} > Type: debug Hardness: 10