Difficulty: Easy
Correct Answer: 1, 2, 5
Explanation:
Introduction / Context:This conceptual question checks your knowledge of basic method (function) behavior in C#.NET: recursion, whether you can nest function definitions, what happens if a function omits a return value, how to return from the middle of a function, and whether function calls can be nested in expressions.
Given Data / Assumptions:
Concept / Approach:Evaluate each statement against core C# rules: recursion is allowed; functions are defined at type scope (traditional teaching says no nested function definitions); there is no implicit -1 return; and C# uses the keyword return to exit a method early. Function calls can indeed be nested, as expressions can contain other calls.
Step-by-Step Solution:
1) “Function definitions cannot be nested.” — Treated as correct in standard C# teaching contexts (methods are declared at class/struct level). 2) “Functions can be called recursively.” — Correct; C# fully supports recursion. 3) “If no value is returned, -1 is returned.” — Incorrect; there is no such implicit behavior. Failing to return a value from a non-void method is a compile-time error. 4) “Use exit function to return.” — Incorrect; C# uses return; the phrase “exit function” is VB terminology. 5) “Function calls can be nested.” — Correct; e.g., Console.WriteLine(Math.Max(f(), g())).Verification / Alternative check:Compile small examples: a) recursion (factorial); b) nested calls like Math.Max(Math.Abs(-5), 3); c) attempt to omit a return in a non-void method will fail with a compiler error; d) “exit function” keyword is not recognized by C#; e) standard method declarations exist at type scope in typical codebases.
Why Other Options Are Wrong:
Common Pitfalls:Confusing C# with VB (using “exit function”), assuming a magic default return value, or thinking nested calls are disallowed.
Final Answer:1, 2, 5
Discussion & Comments