// No parameter, void return type - DON'T USE, can learn from other combinations // // ********** Function definition **************** // Category constraints: One parameter(s) passed by value only, NON-void return type // // 100 // Function.Definition.Local variable.Name overlap // Local variable with same name as in caller // 125 // Function.Definition.Multiple return statements - 125 // Multiple return statements in function definition // // 175 - TO DO // Program.Program does not contain the function main() // Program does not contain main() function // 200 // Function.Definition.return statement missing in the definition of a function with non-void return type // Missing return statement in definition // 225 // Function.Definition.Data type of the value in the return statement is incompatible with the return type of the function // Incorrect type of returned value // 250 // Function.Definition.Return is not the last statement in the function // return statement followed by unreachable statements at the end // 275 // Function.Definition.Formal parameter is re-declared as a local variable in the function // Parameters re-declared as local variables // // // *********** Function call *************** // // Learning objectives that will be met elsewhere // Call in output statement // Call in expression // Call as standalone statement // Zero parameters.. // // 300 // Function.Call.Call as expression // Calling a function with a non-void return type // 325 - TO DO // Function.Call.Calls to multiple functions as statements // Calls to multiple functions // 350 - TO DO // Function.Call.Multiple calls to the same function // Multiple calls to the same function // 375 - TO DO // Function.Call.Chained // main calls fun1 calls fun2 // // // 400 // Function.Call.Function is called before it is defined/prototyped // Function is called before it is defined (C++ only) // 425 // Function.Call.Value returned by the function is ignored by the caller // return value of the function is ignored // 450 // Function.Call.Caller tries to use the value returned by a function with void return type // Call in an expression // 475 // Function.Call.Data type of the value returned by the function call is incompatible with the expected data type in the caller // Returned type incompatible with expression in which it is called // // ******** Parameter Passing ************** // Category constraints: Parameter(s) passed by value only (void return type) // // 500 // Function.Parameter.Value.Variable.One // Call with 1 parameter (variable) passed by value // 525 // Function.Parameter.Value.Variable.Many // Call with many parameters (variables) passed by value // 550 // Function.Parameter.Value.Variable.Repeated // Call with same variable repeated multiple times as parameter // 575 // Function.Parameter.Value.Constant // Call with literal constants as actual parameters // 600 // Function.Parameter.Value.Expression // Call with expressions as actual parameters // // 625 // Function.Parameter.Number of actual parameters in the call not equal to the number of formal parameters in the definition // Call with incorrect number of parameters // 650 // Function.Parameter.Data type of the actual parameter in the call is incompatible with the data type of the formal parameter in the definition // Call with incorrect types/order of parameters // // // 700 - TO DO // Function.Parameter.Reference.Variable.One // Call with 1 parameter (variable) passed by reference // 725 - TO DO // Function.Parameter.Reference.Variable.Many // Call with many parameters (variables) passed by reference // 750 - TO DO // Function.Parameter.Reference.Variable.Repeated // Call with same variable repeated multiple times as parameter by reference // // // 800 - To DO // Function.Parameter.Reference.Constant or expression is passed by reference // Call with literal constant/expression as actual parameter // // // // 900 - TO DO // Passed by a mix of value and reference:.. // Prototype // ----------------------------------------------------------------------------------------------------------------- // ***************** ADVANCED TOPICS ******************* // // 1000 - TO DO // Function.Call.Calls to multiple functions in an expression // Multiple calls in an expression // 1025 - TO DO // Function.Parameter.Value.FunctionCall // Call with function call as actual parameter // // 1100 - TO DO // Function.Parameter.Pointer // // 1200 - TO DO // Function.Definition.Default.Correct // Definition with default values for parameters - C++ only // 1225 - TO DO // Function.Definition.Default.Error.Definition // Incorrect use of default values in definition // 1250 - TO DO // Function.Definition.Default.Error.Call // Incorrect use of default values in call // // 1300 - TO DO // Function.Call.Recursive.Tail.void // Recursive function calls - tail recursive, i.e., local work before recursive call, result is printed // 1325 - TO DO // Function.Call.Recursive.Tail.nonVoid // Recursive function calls - tail recursive, i.e., local work before recursive call, result is returned // 1350 - TO DO // Function.Call.Recursive.Head.void // Recursive function calls - head recursive, i.e., recursive call before local work, result is printed // 1375 - TO DO // Function.Call.Recursive.Head.nonVoid // Recursive function calls - head recursive, i.e., recursive call before local work, result is returned // 1400 - TO DO // Function.Call.Recursive.Both // Recursive function calls - both head and tail recursive, i.e., local work both before and after recursive call, pre is printed, post is returned // // ----------------------------------------------------------------------------------------------------------------- // OLD SCHEME: - All covered in new scheme above // This is the master plan for function // // Definition cases are probably only for synthesis // Definition // Return // void // non-void // // Parameter // none // one // many // // Return statement // // Local Variables // unique // conflicting with caller's local variables // // Call // // As // statement // expression // // parameter // // parameter passing // Value // Reference // ValueResult // Result // // Called // Once // Multiple // Recursive // // Prototype // // ------------------------------------------------------------------- // Other factors that affect template hardness: // Function Definition: // Body: // Just a print statement // a constant // a variable // a simple expression involving local variables // An if-else statement // A loop // ---------------------------------------------------- // ********** Function definition **************** // Category constraints: One parameter(s) passed by value only, NON-void return type // ---------------------------------------------------- // 100 // Function.Definition.Local variable.Name overlap // Local variable with same name as in caller // Design parameters // call: as statement // parameters: none (100), 1 (105) // : by value // local variables: none # 100 Function.Definition.Local variable.Name overlap > {(){ = ;<<;}(){; = ;();<<;}} > Type: output Hardness: 20 # 101 Function.Definition.Local variable.Name overlap > {(){; = ;<<;}(){ = ;<<;();}} > Type: output Hardness: 20 # 102 Function.Definition.Local variable.Name overlap > {(){; = ;<<;}(){();; = ;<<;}} > Type: output Hardness: 20 # 105 Function.Definition.Local variable.Name overlap ? Function.Parameter.Value.Variable.One > {(){<<; = ;<<;}(){; = ;(); = ;<<;}} > Type: output Hardness: 20 # 106 Function.Definition.Local variable.Name overlap ? Function.Parameter.Value.Variable.One > {(){ = + 1;<<;}(){ = ; = ;();<<;}} > Type: output Hardness: 20 # 107 Function.Definition.Local variable.Name overlap ? Function.Parameter.Value.Variable.One > {(){ = * 10;<<;}(){ = ; = ;();<<;<<;}} > Type: output Hardness: 20 // ---------------------------------------------------- // 125 // Function.Definition.Multiple return statements // Multiple return statements in function definition // Design parameters // call: as expression // parameters: none (125), 1 (135) // : by value // local variables: none // Callee does not modify parameter passed by value # 125 Function.Definition.Multiple return statements ? Function.Call.Call as expression > {(){ = ;if( > ){ return - 1; } else { return + 1; };}(){<< ();}} > Type: output Hardness: 30 # 126 Function.Definition.Multiple return statements ? Function.Call.Call as expression > {(){; = ; if( >= ){return ;}<< ; return + 1;}(){; = ();<<;}} > Type: output Hardness: 30 # 127 Function.Definition.Multiple return statements ? Function.Call.Call as expression > {(){ = ; if( != ){ << ; return ; } << ; return ;}(){ = ();<<;}} > Type: output Hardness: 30 # 128 Function.Definition.Multiple return statements ? Function.Call.Call as expression > {(){ = ; if( < ) { return 10 - ;} else {return + 10;} }(){ = ();<<;}} > Type: output Hardness: 30 # 129 Function.Definition.Multiple return statements ? Function.Call.Call as expression > {(){ = ; if( <= ) { = * 10;return ;} else { = * 100; return + 1; }}(){<< ();}} > Type: output Hardness: 30 # 130 Function.Definition.Multiple return statements ? Function.Call.Call as expression > {(){ = ; if( == ) { return * 2;} else { = - 1; return ;}}(){; = ();<<;}} > Type: output Hardness: 30 // Callee does not modify parameter passed by value # 135 Function.Definition.Multiple return statements ? Function.{Parameter.Value.Variable.One,Call.Call as expression} > {(){if( != ){ return ; } else { return ; };}(){ = ;<< ();}} > Type: output Hardness: 40 # 136 Function.Definition.Multiple return statements ? Function.{Parameter.Value.Variable.One,Call.Call as expression} > {(){<< ; if( < ){return ;} = + 1; return ;}(){ = ; = ();<<;}} > Type: output Hardness: 40 # 137 Function.Definition.Multiple return statements ? Function.{Parameter.Value.Variable.One,Call.Call as expression} > {(){<<; if( >= ){ << ; return ; } << ; return ;}(){ = ;<< ();}} > Type: output Hardness: 40 # 138 Function.Definition.Multiple return statements ? Function.{Parameter.Value.Variable.One,Call.Call as expression} > {(){if( == ) { return 10 - ;} else {return + 10;} }(){ = ; = ();<<;}} > Type: output Hardness: 40 # 139 Function.Definition.Multiple return statements ? Function.{Parameter.Value.Variable.One,Call.Call as expression} > {(){<<; if( > ) { = - ;return + 1;} = + ; return - 1; }(){ = ;<< ();}} > Type: output Hardness: 40 # 140 Function.Definition.Multiple return statements ? Function.{Parameter.Value.Variable.One,Call.Call as expression} > {(){<< ; ; if( <= ) { = * 2; return ;} else { = ; return + 1;}}(){ = ;; = ();<<;}} > Type: output Hardness: 40 // ---------------------------------------------------- // 175 // Program.Program does not contain the function main() // Program does not contain main() // Design parameters // call: none // parameters: none (TO DO), 1 (TO DO) // : by value // local variables: none // # 175 // Function.Definition.Program does not contain the function main() // > // {(){; = ;(,);<<;}(,){; = ;<<;}} // > // Type: debug // Hardness: 50 // ---------------------------------------------------- // 200 // Function.Definition.return statement missing in the definition of a function with non-void return type // Missing return statement in definition // Design parameters // call: as statement // parameters: none // local variables: none (200), 1 (210) // Call in output, assignment, initialization, re-ssignment, in expression // return statement has constant, variable or expression # 200 Function.Definition.return statement missing in the definition of a function with non-void return type > {(){<< ;}(){<< ();<< ;}} > Type: debug Hardness: 20 # 201 Function.Definition.return statement missing in the definition of a function with non-void return type > {(){<< - ;}(){; = ();<< ;}} > Type: debug Hardness: 20 # 202 Function.Definition.return statement missing in the definition of a function with non-void return type > {(){<< * ;}(){ = ();<<;}} > Type: debug Hardness: 20 # 203 Function.Definition.return statement missing in the definition of a function with non-void return type > {(){<< * ;}(){ = ;<<; = ();<<;}} > Type: debug Hardness: 20 # 204 Function.Definition.return statement missing in the definition of a function with non-void return type > {(){<< ;}(){ = ; = () - ;<<;}} > Type: debug Hardness: 20 # 210 Function.Definition.return statement missing in the definition of a function with non-void return type > {(){ = ;<< ;}(){<< ();}} > Type: debug Hardness: 30 # 211 Function.Definition.return statement missing in the definition of a function with non-void return type > {(){; = + ;<< ;}(){; = ();<<;}} > Type: debug Hardness: 30 # 212 Function.Definition.return statement missing in the definition of a function with non-void return type > {(){ = ;<< * 10;}(){ = ();<<;}} > Type: debug Hardness: 30 # 213 Function.Definition.return statement missing in the definition of a function with non-void return type > {(){ = ;<< * ;}(){ = ;<<; = ();<<;}} > Type: debug Hardness: 30 # 214 Function.Definition.return statement missing in the definition of a function with non-void return type > {(){ = * 10;<< ;}(){; = () + ;<<;}} > Type: debug Hardness: 30 # 215 Function.Definition.return statement missing in the definition of a function with non-void return type > {(){ = ; = * ;<< ;}(){; = () / ;<<;}} > Type: debug Hardness: 30 // ---------------------------------------------------- // 225 // Function.Definition.Data type of the value in the return statement is incompatible with the return type of the function // Incorrect type of returned value // Design parameters // call: as statement // parameters: none // local variables: none - too subtle without local variables, 1 (225), 2 (235) // Call in output, assignment, initialization, re-ssignment, in expression // return statement has constant, variable or expression # 225 Function.Definition.Data type of the value in the return statement is incompatible with the return type of the function > {(){ = ;return ;}(){<< ();}} > Type: debug Hardness: 20 # 226 Function.Definition.Data type of the value in the return statement is incompatible with the return type of the function > {(){; = + ;return ;}(){; = ();<<;}} > Type: debug Hardness: 20 # 227 Function.Definition.Data type of the value in the return statement is incompatible with the return type of the function > {(){ = ;return + 10;}(){ = ();<<;}} > Type: debug Hardness: 20 # 228 Function.Definition.Data type of the value in the return statement is incompatible with the return type of the function > {(){ = ;return * ;}(){ = ;<<; = ();<<;}} > Type: debug Hardness: 20 # 229 Function.Definition.Data type of the value in the return statement is incompatible with the return type of the function > {(){ = ; = * 10;return ;}(){; = () + 1;<<;}} > Type: debug Hardness: 20 # 230 Function.Definition.Data type of the value in the return statement is incompatible with the return type of the function > {(){ = ; = * 2;return ;}(){; = () / 2;<<;}} > Type: debug Hardness: 20 # 235 Function.Definition.Data type of the value in the return statement is incompatible with the return type of the function > {(){ = ;<<; = / 2;return ;}(){<< ();}} > Type: debug Hardness: 30 # 236 Function.Definition.Data type of the value in the return statement is incompatible with the return type of the function > {(){ = ;<<; = + ;return ;}(){ = ();<<;}} > Type: debug Hardness: 30 # 237 Function.Definition.Data type of the value in the return statement is incompatible with the return type of the function > {(){ = ; = + 10;return ;}(){; = ; = ();<<;}} > Type: debug Hardness: 30 # 238 Function.Definition.Data type of the value in the return statement is incompatible with the return type of the function > {(){ = ; = * ;return ;}(){ = ;<<; = ();<<;}} > Type: debug Hardness: 30 # 239 Function.Definition.Data type of the value in the return statement is incompatible with the return type of the function > {(){ = ; = 10 - ;return ;}(){; = () + ;<<;}} > Type: debug Hardness: 30 # 240 Function.Definition.Data type of the value in the return statement is incompatible with the return type of the function > {(){ = ; = * 2;return ;}(){; = () * 2;<<;}} > Type: debug Hardness: 30 // ---------------------------------------------------- // 250 // Function.Definition.return statement is not the last statement in the function // Design parameters // call: as statement // parameters: none // local variables: none (250), 1 (260) // Call in output, assignment, initialization, re-ssignment, in expression // return statement has constant, variable or expression // Callee does not modify parameter passed by value # 250 Function.Definition.return statement is not the last statement in the function > {(){<< ;return ;<< + 1;}(){<< ();}} > Type: debug Hardness: 20 # 251 Function.Definition.return statement is not the last statement in the function > {(){<< ;<< ;return - ;<< - ;}(){ = ();<<;}} > Type: debug Hardness: 20 # 252 Function.Definition.return statement is not the last statement in the function > {(){<< + 10;return ;<< * 10;}(){ = ();<<;}} > Type: debug Hardness: 20 # 253 Function.Definition.return statement is not the last statement in the function > {(){<< * 2;return ;<< * ;}(){ = ;<<; = ();<<;}} > Type: debug Hardness: 20 # 254 Function.Definition.return statement is not the last statement in the function > {(){<< / 2;return ;<< % 2;}(){ = ;<<; = + ();<<;}} > Type: debug Hardness: 20 // Callee does not modify parameter passed by value # 260 Function.Definition.return statement is not the last statement in the function > {(){ = ;return ;<< ;}(){<< ();}} > Type: debug Hardness: 30 # 261 Function.Definition.return statement is not the last statement in the function > {(){ = + ;return ;<< ;<< ;}(){; = ();<<;}} > Type: debug Hardness: 30 # 262 Function.Definition.return statement is not the last statement in the function > {(){ = ;return * 10;<< * 100;}(){ = ();<<;}} > Type: debug Hardness: 30 # 263 Function.Definition.return statement is not the last statement in the function > {(){ = ;return * ;<< * ;}(){ = ;<<; = ();<<;}} > Type: debug Hardness: 30 # 264 Function.Definition.return statement is not the last statement in the function > {(){ = ;return ; = * 10;<< ;}(){; = () + 1;<<;}} > Type: debug Hardness: 30 # 265 Function.Definition.return statement is not the last statement in the function > {(){ = ;return ; = * 2;<< ;}(){; = () / 2;<<;}} > Type: debug Hardness: 30 // Works, but line numbers are not correct // # 270 // Function.Definition.return statement is not the last statement in the function // > // {(){ = ; if( == ) { return * 2;<< ;<< - 1;} else { = - 1; return ;<< ;<< + 1;}}(){; = ();<<;}} // > // Type: output // Hardness: 30 // ---------------------------------------------------- // 275 // Function.Definition.Formal parameter is re-declared as a local variable in the function // Function.Definition.Re-declaring a variable that has already been declared // Parameters re-declared as local variables // Design parameters // call: as statement // parameters: 1 (275), 2 (285) // : by value // body: does not modify, appears to modify, modifies parameter // Callee does not modify parameter passed by value # 275 Function.Definition.Re-declaring a variable that has already been declared // Function.Definition.Formal parameter is re-declared as a local variable in the function > {(){;<<;<< ;}(){; = ;();<<;}} > Type: debug Hardness: 20 # 276 Function.Definition.Re-declaring a variable that has already been declared // Function.Definition.Formal parameter is re-declared as a local variable in the function > {(){<< ;;<<;}(){; = ;<<;();}} > Type: debug Hardness: 20 // Callee APPEARS to modify parameter passed by value # 277 Function.Definition.Re-declaring a variable that has already been declared // Function.Definition.Formal parameter is re-declared as a local variable in the function > {(){;<< - ;}(){; = ;<<;();}} > Type: debug Hardness: 20 # 278 Function.Definition.Re-declaring a variable that has already been declared // Function.Definition.Formal parameter is re-declared as a local variable in the function > {(){<< ;;<< + ;}(){ = ;();<<;}} > Type: debug Hardness: 20 // Callee modifies parameter passed by value # 279 Function.Definition.Re-declaring a variable that has already been declared // Function.Definition.Formal parameter is re-declared as a local variable in the function > {(){<<;; = + 1;<<;}(){; = ;();<<;}} > Type: debug Hardness: 20 # 280 Function.Definition.Re-declaring a variable that has already been declared // Function.Definition.Formal parameter is re-declared as a local variable in the function > {(){ = - 1;<<;; = - 1;<<;}(){; = ;();<<;}} > Type: debug Hardness: 20 // No modification of formal par # 285 Function.Definition.Re-declaring a variable that has already been declared // Function.Definition.Formal parameter is re-declared as a local variable in the function > {(,){;<<;<<;}(){; = ;; = ;(,);<<;<<;}} > Type: debug Hardness: 30 # 286 Function.Definition.Re-declaring a variable that has already been declared // Function.Definition.Formal parameter is re-declared as a local variable in the function > {(,){<< ;;<<;<<;}(){ = ; = ;<<;<<;(,);}} > Type: debug Hardness: 30 // APPEAR to modify formal par # 287 Function.Definition.Re-declaring a variable that has already been declared // Function.Definition.Formal parameter is re-declared as a local variable in the function > {(,){<< + ;;<< - ;}(){ = ; = ;(,);<<;<<;}} > Type: debug Hardness: 30 # 288 Function.Definition.Re-declaring a variable that has already been declared // Function.Definition.Formal parameter is re-declared as a local variable in the function > {(,){;<< - ;<< * 2;}(){ = ; = ;(,);<<;<<;}} > Type: debug Hardness: 30 // Modify formal par # 289 Function.Definition.Re-declaring a variable that has already been declared // Function.Definition.Formal parameter is re-declared as a local variable in the function > {(,){ = - 1;<<;; = + 1;<<;}(){; = ;; = ;(,);<<;<<;}} > Type: debug Hardness: 30 // Modify formal par # 290 Function.Definition.Re-declaring a variable that has already been declared // Function.Definition.Formal parameter is re-declared as a local variable in the function > {(,){<< ;; = + ; = - ;<<;<<;}(){; = ;; = ;(,);<<;<<;}} > Type: debug Hardness: 30 // *********** Function call *************** // ---------------------------------------------------- // 300 // Function.Call.Call as expression // Calling a function with a non-void return type // Design parameters // call: as statement // parameters: none // local variables: none (300), 1 (310) // Call in output, assignment, initialization, re-ssignment, in expression // return statement has constant, variable or expression // Callee does not modify parameter passed by value # 300 Function.Call.Call as expression > {(){return ;}(){<< ();}} > Type: output Hardness: 20 # 301 Function.Call.Call as expression > {(){return + ;}(){; = ();<<;}} > Type: output Hardness: 20 # 302 Function.Call.Call as expression > {(){return * 10;}(){ = ();<<;}} > Type: output Hardness: 20 # 303 Function.Call.Call as expression > {(){return * ;}(){ = ;<<; = ();<<;}} > Type: output Hardness: 20 # 304 Function.Call.Call as expression > {(){return ;}(){ = ;<<; = + ();<<;}} > Type: output Hardness: 20 // Callee does not modify parameter passed by value # 310 Function.Call.Call as expression > {(){ = ;return ;}(){<< ();}} > Type: output Hardness: 30 # 311 Function.Call.Call as expression > {(){; = + ;return ;}(){; = ();<<;}} > Type: output Hardness: 30 # 312 Function.Call.Call as expression > {(){ = ;return * 10;}(){ = ();<<;}} > Type: output Hardness: 30 # 313 Function.Call.Call as expression > {(){ = ;return * ;}(){ = ;<<; = ();<<;}} > Type: output Hardness: 30 # 314 Function.Call.Call as expression > {(){ = ; = * 10;return ;}(){; = () + 1;<<;}} > Type: output Hardness: 30 # 315 Function.Call.Call as expression > {(){ = ; = * 2;return ;}(){; = () / 2;<<;}} > Type: output Hardness: 30 // ---------------------------------------------------- // 325 // Function.Call.Calls to multiple functions as statements // Calls to multiple functions // Design parameters // call: as statement // parameters: none (325) // : by value // local variables: none or in one function (325), both functions (335) // Just printing value in functions # 325 Function.Call.Calls to multiple functions as statements > {(){<< ;}(){<< ;}(){();; = ;<<;();}} > Type: output Hardness: 20 # 326 Function.Call.Calls to multiple functions as statements > {(){<< * 2;}(){<< * 10;}(){ = ;<<;();();}} > Type: output Hardness: 20 # 327 Function.Call.Calls to multiple functions as statements > {(){<< - ;}(){<< + ;}(){; = ;<<;();();}} > Type: output Hardness: 20 // Reversing the function call order # 328 Function.Call.Calls to multiple functions as statements > {(){<< ;}(){ = ;<<;}(){<< ;();();}} > Type: output Hardness: 30 # 329 Function.Call.Calls to multiple functions as statements > {(){; = ;<< * 2;}(){<< * 10;}(){();<< ;();}} > Type: output Hardness: 30 # 335 Function.Call.Calls to multiple functions as statements > {(){ = ;<<;}(){; = ;<<;}(){; = ;<<;();();}} > Type: output Hardness: 30 # 336 Function.Call.Calls to multiple functions as statements > {(){ = ;<< + 1;}(){; = ;<< - 1;}(){();; = ;<<;();}} > Type: output Hardness: 30 # 337 Function.Call.Calls to multiple functions as statements > {(){; = ;<< ;<< * 10;}(){; = ;<< ;<< * 10;}(){();(); = ;<<;}} > Type: output Hardness: 30 // Reversing the order of function calls # 338 Function.Call.Calls to multiple functions as statements > {(){ = ;<<;}(){ = ;<<;}(){; = ;<<;();();}} > Type: output Hardness: 40 # 339 Function.Call.Calls to multiple functions as statements > {(){; = ;<< * 2;}(){ = - ;<< ;}(){(); = ;<<;();}} > Type: output Hardness: 40 # 340 Function.Call.Calls to multiple functions as statements > {(){; = ;<< * 10;}(){; = ;<< + 1;}(){();(); = ;<<;}} > Type: output Hardness: 40 // // Just printing value in functions // # 330 // Function.Call.Calls to multiple functions as statements // ? // Function.Parameter.Value.Variable.One // > // {(){<<;}(){<<;}(){; = ;(); = ;();<<;}} // > // Type: output // Hardness: 50 // // Printing an expression involving the parameter // # 331 // Function.Call.Calls to multiple functions as statements // ? // Function.Parameter.Value.Variable.One // > // {(){<< - ;}(){<< + ;}(){; = ;(); = ;();<<;}} // > // Type: output // Hardness: 50 // ---------------------------------------------------- // 350 // Function.Call.Multiple calls to the same function // Multiple calls to the same function // Design parameters // call: as statement (350) // parameters: none // local variables: none, one, two # 350 Function.Call.Multiple calls to the same function > {(){<< ;}(){(); = ;<<;();}} > Type: output Hardness: 20 # 351 Function.Call.Multiple calls to the same function > {(){ = ;<< ;}(){();(); = ;<<;}} > Type: output Hardness: 20 # 352 Function.Call.Multiple calls to the same function > {(){ = ;<< ; = + 1;<< ;}(){();();}} > Type: output Hardness: 20 # 353 Function.Call.Multiple calls to the same function > {(){ = ;<< + 1;}(){(); = ;<<;();}} > Type: output Hardness: 20 # 354 Function.Call.Multiple calls to the same function > {(){ = ;<< - 1;<< - 2;}(){();();}} > Type: output Hardness: 20 # 355 Function.Call.Multiple calls to the same function > {(){; = - ;<< ;}(){ = ;<<;();();}} > Type: output Hardness: 20 # 356 Function.Call.Multiple calls to the same function > {(){ = ;<< ; = - ;<< ;}(){();();}} > Type: output Hardness: 20 # 357 Function.Call.Multiple calls to the same function > {(){ = ; = * 10;<<;}(){();(); = ;<<;}} > Type: output Hardness: 20 # 358 Function.Call.Multiple calls to the same function > {(){ = ;<< ; = * 2;<< ;}(){();();}} > Type: output Hardness: 20 # 359 Function.Call.Multiple calls to the same function > {(){ = ; = * 10;<<;<<;}(){(); = ;<<;();}} > Type: output Hardness: 20 # 360 Function.Call.Multiple calls to the same function > {(){ = ;<< ; = * 2;<<;}(){();();}} > Type: output Hardness: 20 // // Passing parameters to functions // # 355 // Function.Call.Multiple calls to the same function // ? // Function.Parameter.Value.Variable.One // > // {(){<< + 1;}(){; = ;(); = ;();<<;}} // > // Type: output // Hardness: 50 // # 356 // Function.Call.Multiple calls to the same function // ? // Function.Parameter.Value.Variable.One // > // {(){<< - 1;}(){; = ;(); = ;<<;();}} // > // Type: output // Hardness: 50 // // Expression as actual parameter // # 480 // Function.Call.Expression // ? // Function.Call.Call as expression,Function.Parameter.Value.Expression // > // // {(){return + ;}(){; = ;( + 1); = ;( + ) + 1;<<;}} // {(){return + ;}(){; = ;<< ( + 1); = ;<< ( + );<<;}} // > // Type: output // Hardness: 50 // ---------------------------------------------------- // 375 // Function.Call.Chained // main calls fun1 calls fun2 # 375 Function.Call.Chained > {(){<< ;}(){<< ;();}(){; = ;<<;();}} > Type: output Hardness: 20 # 376 Function.Call.Chained > {(){<< * 2;}(){();<< * 10;}(){ = ;<<;();}} > Type: output Hardness: 20 # 377 Function.Call.Chained > {(){<< - ;}(){<< + ;();}(){; = ;<<;();}} > Type: output Hardness: 20 // Reversing the function call order # 378 Function.Call.Chained > {(){<< ;}(){(); = ;<<;}(){<< ;();}} > Type: output Hardness: 30 # 379 Function.Call.Chained > {(){; = ;<< * 2;}(){<< * 10;();}(){();<< ;}} > Type: output Hardness: 30 # 385 Function.Call.Chained > {(){ = ;<<;}(){(); = ;<<;}(){; = ;<<;();}} > Type: output Hardness: 30 # 386 Function.Call.Chained > {(){ = ;<< + 1;}(){; = ;<< - 1;();}(){ = ;<<;();}} > Type: output Hardness: 30 # 387 Function.Call.Chained > {(){; = ;<< ;<< * 10;}(){(); = ;<< ;<< * 10;}(){(); = ;<<;}} > Type: output Hardness: 30 // Reversing the order of function calls # 388 Function.Call.Chained > {(){ = ;<<;}(){ = ;<<;();}(){; = ;<<;();}} > Type: output Hardness: 40 # 389 Function.Call.Chained > {(){; = ;<< * 2;}(){(); = - ;<< ;}(){(); = ;<<;}} > Type: output Hardness: 40 # 390 Function.Call.Chained > {(){; = ;<< * 10;}(){; = ;<< + 1;();}(){(); = ;<<;}} > Type: output Hardness: 40 // // Using function call in returned value // # 395 // Function.Call.Chained // ? // ... // > // // {(){return + ;}(){return ();}(){ = ;<< ();}} // {(){return + ;}(){return () + ();}(){ = ;<< (); = ;<< ();<<;}} // > // Type: output // Hardness: 50 // ---------------------------------------------------- // 400 // Function.Call.Function is called before it is defined/prototyped // Function is called before it is defined (C++ only) // Design parameters // call: as statement (400), as expression (410) // parameters: none, 1, 2 // : by value // local variables: none # 400 Function.Call.Function is called before it is defined/prototyped > {(){; = ;();<<;}(){<< ;<< + 1;}} > Type: debug Hardness: 20 # 401 Function.Call.Function is called before it is defined/prototyped > {(){; = ;();<<;}(){; = ;<<;}} > Type: debug Hardness: 20 # 402 Function.Call.Function is called before it is defined/prototyped > {(){; = ;();<<;}(){<<;<< + 1;}} > Type: debug Hardness: 30 # 403 Function.Call.Function is called before it is defined/prototyped > {(){; = ;();<<;}(){<<; = + ;<<;}} > Type: debug Hardness: 30 # 404 Function.Call.Function is called before it is defined/prototyped > {(){; = ;; = ;(,);<<;<<;}(, ){<<;<<;}} > Type: debug Hardness: 40 # 410 Function.Call.Function is called before it is defined/prototyped > {(){; = ;<< ();<<;}(){return ;}} > Type: debug Hardness: 30 # 411 Function.Call.Function is called before it is defined/prototyped > {(){; = ;<< ();<<;}(){; = ;return ;}} > Type: debug Hardness: 30 // NOT PRINTING VALUE OF VARIABLE AFTER ASSIGNING FUNCTION CALL BECAUSE IT ADDS A SECOND SEMANTIC ERROR # 412 Function.Call.Function is called before it is defined/prototyped > {(){ = ;<<;; = ();}(){return + ;}} > Type: debug Hardness: 40 // NOT PRINTING VALUE OF VARIABLE AFTER ASSIGNING FUNCTION CALL BECAUSE IT ADDS A SECOND SEMANTIC ERROR # 413 Function.Call.Function is called before it is defined/prototyped > {(){ = ;<<;; = ();}(){<<; = + ;return ;}} > Type: debug Hardness: 40 // NOT PRINTING VALUE OF VARIABLE AFTER ASSIGNING FUNCTION CALL BECAUSE IT ADDS A SECOND SEMANTIC ERROR # 414 Function.Call.Function is called before it is defined/prototyped > {(){ = ;; = ; = (,);}(, ){return - ;}} > Type: debug Hardness: 50 // ---------------------------------------------------- // 425 // Function.Call.Value returned by the function is ignored by the caller // return value of the function is ignored // Design parameters // call: as statement // parameters: none (425), 1 or more (445) // local variables: none (425), 1 (435) // Call in output, assignment, initialization, re-ssignment, in expression // return statement has constant, variable or expression // Callee does not modify parameter passed by value # 425 Function.Call.Value returned by the function is ignored by the caller > {(){return ;}(){();}} > Type: debug Hardness: 20 # 426 Function.Call.Value returned by the function is ignored by the caller > {(){return + ;}(){ = ;();<<;}} > Type: debug Hardness: 20 # 427 Function.Call.Value returned by the function is ignored by the caller > {(){return * 10;}(){ = * 10;();<<;}} > Type: debug Hardness: 20 # 428 Function.Call.Value returned by the function is ignored by the caller > {(){return * ;}(){ = ;<<;();<<;}} > Type: debug Hardness: 20 # 429 Function.Call.Value returned by the function is ignored by the caller > {(){return ;}(){ = ;<<;();<<;}} > Type: debug Hardness: 20 // Callee does not modify parameter passed by value # 435 Function.Call.Value returned by the function is ignored by the caller > {(){ = ;return ;}(){();}} > Type: debug Hardness: 30 # 436 Function.Call.Value returned by the function is ignored by the caller > {(){; = + ;return ;}(){ = ;();<<;}} > Type: debug Hardness: 30 # 437 Function.Call.Value returned by the function is ignored by the caller > {(){ = ;return * 10;}(){ = ;();<<;}} > Type: debug Hardness: 30 # 438 Function.Call.Value returned by the function is ignored by the caller > {(){ = ;return * ;}(){ = ;<<;();<<;}} > Type: debug Hardness: 30 # 439 Function.Call.Value returned by the function is ignored by the caller > {(){ = ; = * 10;return ;}(){ = ;();<<;}} > Type: debug Hardness: 30 # 440 Function.Call.Value returned by the function is ignored by the caller > {(){ = ; = * 2;return ;}(){ = * 10;();<<;}} > Type: debug Hardness: 30 # 445 Function.Call.Value returned by the function is ignored by the caller > {(){return + ;}(){; = ;();<<;}} > Type: debug Hardness: 40 # 446 Function.Call.Value returned by the function is ignored by the caller > {(, ){return + ;}(){ = ; = ;(,);<<;<<;}} > Type: debug Hardness: 50 // ---------------------------------------------------- // 450 // Function.Call.Caller tries to use the value returned by a function with void return type // Call in an expression // Design parameters // call: as statement // parameters: none (450), 1 (460) // : by value // local variables: none // body: does not modify, appears to modify, modifies parameter // Callee does not modify parameter passed by value # 450 Function.Call.Caller tries to use the value returned by a function with void return type > {(){<< ;}(){<< ();}} > Type: debug Hardness: 20 # 451 Function.Call.Caller tries to use the value returned by a function with void return type > {(){<< ;}(){; = ();<<;}} > Type: debug Hardness: 20 # 452 Function.Call.Caller tries to use the value returned by a function with void return type > {(){ = ;<<;}(){<< ();}} > Type: debug Hardness: 20 # 453 Function.Call.Caller tries to use the value returned by a function with void return type > {(){ = ;<<;}(){ = ();<<;}} > Type: debug Hardness: 20 # 454 Function.Call.Caller tries to use the value returned by a function with void return type > {(){ = ;<<; = / 2;<<;}(){<< ();}} > Type: debug Hardness: 20 # 455 Function.Call.Caller tries to use the value returned by a function with void return type > {(){ = ;<<; = % 2;<<;}(){ = ();<<;}} > Type: debug Hardness: 20 // Callee does not modify parameter # 460 Function.Call.Caller tries to use the value returned by a function with void return type > {(){<< ;}(){ = ;<< ();}} > Type: debug Hardness: 30 # 461 Function.Call.Caller tries to use the value returned by a function with void return type > {(){<< - ;}(){ = ;<<; = ();<<;}} > Type: debug Hardness: 30 // Callee APPEARS to modify parameter passed by value # 462 Function.Call.Caller tries to use the value returned by a function with void return type > {(){<< + ;}(){ = ;<< ();<<;}} > Type: debug Hardness: 30 # 463 Function.Call.Caller tries to use the value returned by a function with void return type > {(){<< - ;}(){ = ; = ();<<;}} > Type: debug Hardness: 30 # 464 Function.Call.Caller tries to use the value returned by a function with void return type > {(){ = + ;<< ;}(){ = ;<< ();}} > Type: debug Hardness: 30 # 465 Function.Call.Caller tries to use the value returned by a function with void return type > {(){<< ; = - ;<< ;}(){ = ; = ();<<;}} > Type: debug Hardness: 30 // Callee modifies parameter passed by value # 466 Function.Call.Caller tries to use the value returned by a function with void return type > {(){<<; = + 1;<<;}(){; = ;<<; = ();<<;}} > Type: debug Hardness: 30 # 467 Function.Call.Caller tries to use the value returned by a function with void return type > {(){ = - 1;<<; = - 1;<<;}(){; = ;<< ();<<;}} > Type: debug Hardness: 30 // ---------------------------------------------------- // 475 // Function.Call.Data type of the value returned by the function call is incompatible with the expected data type in the caller // ******** Parameter Passing ************** // Category constraints: Parameter(s) passed by value only (void return type) // ---------------------------------------------------- // 500 // Function.Parameter.Value.Variable.One // Call with 1 parameter (variable) passed by value // Design parameters // call: as statement // parameters: 1 // : by value // local variables: none // body: does not modify (500), appears to modify (505), modifies parameter (510) // Callee does not modify parameter passed by value # 500 Function.Parameter.Value.Variable.One > {(){<<;}(){; = ;();<<;}} > Type: output Hardness: 20 # 501 Function.Parameter.Value.Variable.One > {(){<<;}(){; = ;<<;();}} > Type: output Hardness: 20 // Callee APPEARS to modify parameter passed by value # 505 Function.Parameter.Value.Variable.One > {(){<< - ;}(){; = ;<<;();}} > Type: output Hardness: 30 # 506 Function.Parameter.Value.Variable.One > {(){<< + ;}(){ = ;();<<;}} > Type: output Hardness: 30 // Callee modifies parameter passed by value # 510 Function.Parameter.Value.Variable.One > {(){<<; = + 1;<<;}(){; = ;();<<;}} > Type: output Hardness: 40 # 511 Function.Parameter.Value.Variable.One > {(){ = - 1;<<; = - 1;<<;}(){; = ;();<<;}} > Type: output Hardness: 40 // ---------------------------------------------------- // 525 // Function.Parameter.Value.Variable.Many // Call with many parameters (variables) passed by value // Design parameters // call: as statement // parameters: 2 (525), 3 (TO DO?) // : by value // local variables: none // body: does not modify (525), appears to modify (530), modifies parameter (535) // No modification of formal par # 525 Function.Parameter.Value.Variable.Many > {(,){<<;<<;}(){; = ;; = ;(,);<<;<<;}} > Type: output Hardness: 30 # 526 Function.Parameter.Value.Variable.Many > {(,){<<;<< ;<<;}(){ = ; = ;<<;<<;(,);}} > Type: output Hardness: 30 // APPEAR to modify formal par # 530 Function.Parameter.Value.Variable.Many > {(,){<< + ;<< - ;}(){ = ; = ;(,);<<;<<;}} > Type: output Hardness: 40 # 531 Function.Parameter.Value.Variable.Many > {(,){<< - ;<< * 2;}(){ = ; = ;(,);<<;<<;}} > Type: output Hardness: 40 // Modify formal par # 535 Function.Parameter.Value.Variable.Many > {(,){ = - 1;<<; = + 1;<<;}(){; = ;; = ;(,);<<;<<;}} > Type: output Hardness: 50 // Modify formal par # 536 Function.Parameter.Value.Variable.Many > {(,){ = + ; = - ;<<;<<;}(){; = ;; = ;(,);<<;<<;}} > Type: output Hardness: 50 // ---------------------------------------------------- // 550 // Function.Parameter.Value.Variable.Repeated // Call with same variable repeated multiple times as parameter // Design parameters // call: as statement // parameters: 2 (550) // : by value // local variables: none // body: does not modify (550), appears to modify (555), modifies parameter (560) // No modification of formal par # 550 Function.Parameter.Value.Variable.Repeated > {(,){<<;<<;}(){; = ;<<;(,);}} > Type: output Hardness: 30 # 551 Function.Parameter.Value.Variable.Repeated > {(,){<<;<< ;<<;}(){ = ;<<;(,);}} > Type: output Hardness: 30 // APPEAR to modify formal par # 555 Function.Parameter.Value.Variable.Repeated > {(,){<< + 1;<< - 1;}(){ = ;(,);<<;}} > Type: output Hardness: 40 # 556 Function.Parameter.Value.Variable.Repeated > {(,){<< - ;<< + ;}(){ = ;(,);<<;}} > Type: output Hardness: 40 // Modify formal par # 560 Function.Parameter.Value.Variable.Repeated > {(,){ = + 10;<<; = * 10;<<;}(){; = ;(,);<<;}} > Type: output Hardness: 50 // Modify formal par # 561 Function.Parameter.Value.Variable.Repeated > []{(,){ = + ; = / ;<<;<<;}(){; = ;(,);<<;}} > Type: output Hardness: 50 // ---------------------------------------------------- // 575 // Function.Parameter.Value.Constant // Call with literal constants as actual parameters // Design parameters // call: as statement // parameters: 1 (575), 2 (590) // : by value // local variables: none // body: does not modify, appears to modify, modifies parameter // Callee does not modify parameter passed by value # 575 Function.Parameter.Value.Constant > {(){<<;}(){();}} > Type: output Hardness: 20 // Callee APPEARS to modify parameter passed by value # 580 Function.Parameter.Value.Constant > {(){<< - ;<< + 1;}(){();}} > Type: output Hardness: 30 # 581 Function.Parameter.Value.Constant > {(){<< + ;<< - ;}(){();}} > Type: output Hardness: 30 // Callee modifies parameter passed by value # 585 Function.Parameter.Value.Constant > {(){ = - 1;<<; = * 2;<<;}(){();}} > Type: output Hardness: 40 # 586 Function.Parameter.Value.Constant > {(){ = - ;<<; = ;<<;}(){();}} > Type: output Hardness: 40 // APPEAR to modify formal par # 590 Function.Parameter.Value.Constant > {(,){<< ;<< ;}(){(,);}} > Type: output Hardness: 50 # 591 Function.Parameter.Value.Constant > {(,){<< - ;<< ;}(){(,);}} > Type: output Hardness: 50 // Modify formal par # 595 Function.Parameter.Value.Constant > {(,){ = - 1;<<; = + 1;<<;}(){(,);}} > Type: output Hardness: 60 // Modify formal par # 596 Function.Parameter.Value.Constant > {(,){ = + ; = - ;<<;<<;}(){(,);}} > Type: output Hardness: 60 // ---------------------------------------------------- // 600 // Function.Parameter.Value.Expression // Call with expressions as actual parameters // Design parameters // call: as statement // parameters: 1 // : by value // local variables: none // body: does not modify (600), appears to modify (605), modifies parameter (610) // Only +, - and * operators used // Callee does not modify parameter passed by value # 600 Function.Parameter.Value.Expression > {(){<<;<< ;}(){; = ;( - 1);<<;}} > Type: output Hardness: 20 # 601 Function.Parameter.Value.Expression > {(){<< ;<<;}(){; = ;( + 1);<<;}} > Type: output Hardness: 20 // Callee APPEARS to modify parameter passed by value # 605 Function.Parameter.Value.Expression > {(){<< ;}(){; = ;( - );<<;}} > Type: output Hardness: 30 # 606 Function.Parameter.Value.Expression > {(){<< ;}(){ = ;( + );<<;}} > Type: output Hardness: 30 // Callee modifies parameter passed by value # 610 Function.Parameter.Value.Expression > {(){<<; = - ;<<;}(){; = ;( * 2);<<;}} > Type: output Hardness: 40 # 611 Function.Parameter.Value.Expression > {(){<<; = / 2;<<;}(){; = ;( + );<<;}} > Type: output Hardness: 40 // ---------------------------------------------------- // 625 // Function.Parameter.Number of actual parameters in the call not equal to the number of formal parameters in the definition // Call with incorrect number of parameters // Design parameters // call: as statement // parameters: 0 in def - 1 in call (630); 1 in def - 0 in call (625); 1 in def - 2 in call (635), 2 in def - 1 in call (641) // : by value // local variables: none // body: does not modify (625), appears to modify (630), modifies parameter (635) // Only +, - and * operators used // Callee does not modify parameter passed by value # 625 Function.Parameter.Number of actual parameters in the call not equal to the number of formal parameters in the definition > {(){<<;<< ;}(){; = ;();<<;}} > Type: debug Hardness: 20 // Callee APPEARS to modify parameter passed by value # 626 Function.Parameter.Number of actual parameters in the call not equal to the number of formal parameters in the definition > {(){<< - ;}(){; = ;<<;();}} > Type: debug Hardness: 20 # 627 Function.Parameter.Number of actual parameters in the call not equal to the number of formal parameters in the definition > {(){<< + ;}(){ = ;();<<;}} > Type: debug Hardness: 20 // Callee modifies parameter passed by value # 628 Function.Parameter.Number of actual parameters in the call not equal to the number of formal parameters in the definition > {(){<<; = + 1;<<;}(){; = ;();<<;}} > Type: debug Hardness: 20 # 629 Function.Parameter.Number of actual parameters in the call not equal to the number of formal parameters in the definition > {(){ = - 1;<<; = - 1;<<;}(){; = ;();<<;}} > Type: debug Hardness: 20 // Callee does not modify parameter passed by value # 630 Function.Parameter.Number of actual parameters in the call not equal to the number of formal parameters in the definition > {(){<< ;}(){; = ;();<<;}} > Type: debug Hardness: 30 // Callee APPEARS to modify parameter passed by value # 631 Function.Parameter.Number of actual parameters in the call not equal to the number of formal parameters in the definition > {(){ = ;<< * 2;}(){; = ;<<;();}} > Type: debug Hardness: 30 # 632 Function.Parameter.Number of actual parameters in the call not equal to the number of formal parameters in the definition > {(){ = ;<< + ;}(){ = ;();<<;}} > Type: debug Hardness: 30 // Callee modifies parameter passed by value # 633 Function.Parameter.Number of actual parameters in the call not equal to the number of formal parameters in the definition > {(){ = ;<<; = + 1;<<;}(){; = ;();<<;}} > Type: debug Hardness: 30 # 634 Function.Parameter.Number of actual parameters in the call not equal to the number of formal parameters in the definition > {(){ = ; = - 1;<<; = - 1;<<;}(){; = ;();<<;}} > Type: debug Hardness: 30 // No modification of formal par # 635 Function.Parameter.Number of actual parameters in the call not equal to the number of formal parameters in the definition > {(){<<;}(){; = ;; = ;(,);<<;<<;}} > Type: debug Hardness: 30 # 636 Function.Parameter.Number of actual parameters in the call not equal to the number of formal parameters in the definition > {(){<<;<< ;}(){ = ; = ;<<;<<;(,);}} > Type: debug Hardness: 30 // APPEAR to modify formal par # 637 Function.Parameter.Number of actual parameters in the call not equal to the number of formal parameters in the definition > {(){<< + ;}(){ = ; = ;(,);<<;<<;}} > Type: debug Hardness: 30 # 638 Function.Parameter.Number of actual parameters in the call not equal to the number of formal parameters in the definition > {(){<<;<< * 2;}(){ = ; = ;(,);<<;<<;}} > Type: debug Hardness: 30 // Modify formal par # 639 Function.Parameter.Number of actual parameters in the call not equal to the number of formal parameters in the definition > {(){ = - 1;<<;}(){; = ;; = ;(,);<<;<<;}} > Type: debug Hardness: 30 // Modify formal par # 640 Function.Parameter.Number of actual parameters in the call not equal to the number of formal parameters in the definition > {(){ = + ;<<;}(){; = ;; = ;(,);<<;<<;}} > Type: debug Hardness: 30 // No modification of formal par # 641 Function.Parameter.Number of actual parameters in the call not equal to the number of formal parameters in the definition > {(,){<<;<<;}(){; = ;<<;();}} > Type: debug Hardness: 40 # 642 Function.Parameter.Number of actual parameters in the call not equal to the number of formal parameters in the definition > {(,){<<;<< ;<<;}(){ = ;<<;();}} > Type: debug Hardness: 40 // APPEAR to modify formal par # 643 Function.Parameter.Number of actual parameters in the call not equal to the number of formal parameters in the definition > {(,){<< + ;<< - ;}(){ = ;<<;();}} > Type: debug Hardness: 40 # 644 Function.Parameter.Number of actual parameters in the call not equal to the number of formal parameters in the definition > {(,){<< - ;<< * 2;}(){ = ;<<;();}} > Type: debug Hardness: 40 // Modify formal par # 645 Function.Parameter.Number of actual parameters in the call not equal to the number of formal parameters in the definition > {(,){ = - 1;<<; = + 1;<<;}(){; = ;<<;();}} > Type: debug Hardness: 40 // Modify formal par # 646 Function.Parameter.Number of actual parameters in the call not equal to the number of formal parameters in the definition > {(,){ = + ; = - ;<<;<<;}(){; = ;<<;();}} > Type: debug Hardness: 40 // ---------------------------------------------------- // 650 // Function.Parameter.Data type of the actual parameter in the call is incompatible with the data type of the formal parameter in the definition // Call with incorrect types/order of parameters // Design parameters // call: as statement // parameters: 1 (650), 2 (660) // : by value // local variables: none // body: does not modify (600), appears to modify (605), modifies parameter (610) // Only +, - and * operators used // Function definition with integer formal parameter, function call with real actual parameter // Avoiding boolean, char; unsigned does not exist in Java // data loss in C++, so warning generated // type incompatible in Java // ?? in C# // Callee does not modify parameter passed by value # 650 Function.Parameter.Data type of the actual parameter in the call is incompatible with the data type of the formal parameter in the definition > {(){<<;<< ;}(){; = ;();<<;}} > Type: debug Hardness: 20 # 651 Function.Parameter.Data type of the actual parameter in the call is incompatible with the data type of the formal parameter in the definition > {(){<< ;<<;}(){; = ;<<;();}} > Type: debug Hardness: 20 // Callee APPEARS to modify parameter passed by value # 652 Function.Parameter.Data type of the actual parameter in the call is incompatible with the data type of the formal parameter in the definition > {(){<< - ;}(){; = ;<<;();}} > Type: debug Hardness: 20 # 653 Function.Parameter.Data type of the actual parameter in the call is incompatible with the data type of the formal parameter in the definition > {(){<< + ;}(){ = ;();<<;}} > Type: debug Hardness: 20 // Callee modifies parameter passed by value # 654 Function.Parameter.Data type of the actual parameter in the call is incompatible with the data type of the formal parameter in the definition > {(){<<; = + 1;<<;}(){; = ;();<<;}} > Type: debug Hardness: 20 # 655 Function.Parameter.Data type of the actual parameter in the call is incompatible with the data type of the formal parameter in the definition > {(){ = - 1;<<; = - 1;<<;}(){; = ;();<<;}} > Type: debug Hardness: 20 // No modification of formal par # 660 Function.Parameter.Data type of the actual parameter in the call is incompatible with the data type of the formal parameter in the definition > {(,){<<;<<;}(){; = ;; = ;(,);<<;<<;}} > Type: debug Hardness: 40 # 661 Function.Parameter.Data type of the actual parameter in the call is incompatible with the data type of the formal parameter in the definition > {(,){<<;<< ;<<;}(){ = ; = ;<<;<<;(,);}} > Type: debug Hardness: 40 // APPEAR to modify formal par # 662 Function.Parameter.Data type of the actual parameter in the call is incompatible with the data type of the formal parameter in the definition > {(,){<< + ;<< - ;}(){ = ; = ;(,);<<;<<;}} > Type: debug Hardness: 40 # 663 Function.Parameter.Data type of the actual parameter in the call is incompatible with the data type of the formal parameter in the definition > {(,){<< - ;<< * 2;}(){ = ; = ;(,);<<;<<;}} > Type: debug Hardness: 40 // Modify formal par # 664 Function.Parameter.Data type of the actual parameter in the call is incompatible with the data type of the formal parameter in the definition > {(,){ = - 1;<<; = + 1;<<;}(){; = ;; = ;(,);<<;<<;}} > Type: debug Hardness: 40 // Modify formal par # 665 Function.Parameter.Data type of the actual parameter in the call is incompatible with the data type of the formal parameter in the definition > {(,){ = + ; = - ;<<;<<;}(){; = ;; = ;(,);<<;<<;}} > Type: debug Hardness: 40 // ---------------------------------------------------- // 700 // Function.Parameter.Reference.Variable.One // Call with 1 parameter (variable) passed by reference // // Callee modifies parameter passed by value // # 274 // Function.{Parameters.One,ParPass.Value} // ? // Function.PostCall // > // {(&){<<; = + 1;<<;}(){; = ;();<<;}} // > // Type: output // Hardness: 50 // // // same actual parameter - appear to modify formal par // # 275 // Function.{Parameters.Many,ParPass.Value} // ? // Function.PostCall // > // {(&){<< ; = ;}(){; = ;<<;();<<;}} // > // Type: output // Hardness: 50 // // // // Using returned value to print // # 485 // Function.Call.Expression // ? // Function.{PostCall,Parameters.One,ParPass.Value} // > // {(){return + ;}(){; = ;<< (); = ;<< () + 1;<<;}} // > // Type: output // Hardness: 50 // // // // Using returned value in assignment // # 487 // Function.Call.Expression // ? // Function.{PostCall,Parameters.One,ParPass.Value} // > // {(){return + ;}(){ = ;; = ();<<;<<;}} // > // Type: output // Hardness: 50 // // // Using returned value in initialization // # 488 // Function.Call.Expression // ? // Function.{PostCall,Parameters.One,ParPass.Value} // > // {(){return + ;}(){ = ; = ();<<;<<;}} // > // Type: output // Hardness: 50 // ---------------------------------------------------- // 725 // Function.Parameter.Reference.Variable.Many // Call with many parameters (variables) passed by reference // ---------------------------------------------------- // 750 // Function.Parameter.Reference.Variable.Repeated // Call with same variable repeated multiple times as parameter by reference // // ---------------------------------------------------- // 800 // Function.Parameter.Reference.Constant or expression is passed by reference // Call with literal constant/expression as actual parameter // // ---------------------------------------------------- // 900 // Passed by a mix of value and reference:.. // Prototype // ************ ADVANCED TOPICS ******************* // ---------------------------------------------------- // 1000 // Function.Call.Calls to multiple functions in an expression // Multiple calls in an expression // // // Using returned value to print - multiple calls in one expresssion // # 1000 // Function.Definition.Local variable.Name overlap // // Function.Call.Expression // ? // Function.{PostCall,Parameters.One,ParPass.Value} // > // {(){return + ;}(){return + ;}(){ = ; = ;<< () + ();<<;<<;}} // > // Type: output // Hardness: 50 // ---------------------------------------------------- // 1025 // Function.Parameter.Value.FunctionCall // Call with function call as actual parameter // // // Using function call in actual parameter // # 490 // Function.Call.Expression // ? // Function.{PostCall,Parameters.One,ParPass.Value} // > // {(){return + ;}(){return () + ;}(){ = ;<< (());}} // // {(){return + ;}(){return () + ;}(){ = ;<< ();}} // > // Type: output // Hardness: 50 // ---------------------------------------------------- // 1100 // Function.Parameter.Pointer // ---------------------------------------------------- // 1200 // Function.Definition.Default.Correct // ---------------------------------------------------- // 1225 // Function.Definition.Default.Error.Definition // ---------------------------------------------------- // 1250 // Function.Definition.Default.Error.Call // ---------------------------------------------------- // 1300 // Function.Call.Recursive.Tail.void // Recursive function calls - tail recursive, i.e., local work before recursive call, result is printed // ---------------------------------------------------- // 1325 // Function.Call.Recursive.Tail.nonVoid // Recursive function calls - tail recursive, i.e., local work before recursive call, result is returned // ---------------------------------------------------- // 1350 // Function.Call.Recursive.Head.void // Recursive function calls - head recursive, i.e., recursive call before local work, result is printed // ---------------------------------------------------- // 1375 // Function.Call.Recursive.Head.nonVoid // Recursive function calls - head recursive, i.e., recursive call before local work, result is returned // ---------------------------------------------------- // 1400 // Function.Call.Recursive.Both // Recursive function calls - both head and tail recursive, i.e., local work both before and after recursive call, pre is printed, post is returned // // // Printing an expression involving the parameter // # 500 // Function.Call.Recursive // ? // Function.{PostCall,Parameters.One,ParPass.Value} // > // {(){if( > 0){ = - 1;();}<<;}(){; = ;();<<;}} // > // Type: output // Hardness: 50 // -------------------------------------------------------------------------- // Templates here are for demonstration purposes // Included at the end so that regular practice does not pick up these templates // How to enter an output # 90 Demonstration > {(){=;<<;}} > Type: output Hardness: 10 // How to enter multiple outputs # 91 Demonstration > {(){=;<<;=;<<;<< - ;}} > Type: output Hardness: 10 // How to enter NO output # 92 Demonstration > {(){=;=;; = + ;}} > Type: output Hardness: 10 // ------------------------------------------------------------------------------ // 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 # 95 Demonstration > {(){;<<;}} > Type: debug Hardness: 10 // Code OK # 96 Demonstration > {(){=;=;<< - ;}} > Type: debug Hardness: 10 // Syntax error # 97 Demonstration > {(){{;}<<;}} > Type: debug Hardness: 10