Preview Questions

3.5. Preview Questions#

Complete these questions before class to prepare for the chapter. Use the dropdowns to check your answers.

3.5.1. True or False#

1. A void method in C# must include a return statement.

Answer

Falsevoid methods may omit return; it is optional.

2. Method parameters are local variables within the method body.

Answer

True — Parameters behave like local variables scoped to the method.

3. Two methods can share the same name if their parameter lists differ (overloading).

Answer

True — Method overloading is fully supported in C#.

4. A method must always return a value.

Answer

False — Methods declared void return nothing.

5. The method signature includes the method name and its parameter types.

Answer

True — The signature = name + parameter type list (not the return type in C#).

6. You can split your helper methods into a separate .cs file without creating a new project.

Answer

True — A project can span many .cs files. You only need a new project (a new .csproj) when you need a second entry point (Main()). Helper methods in additional .cs files share the same project and can be called from Main() freely.

3.5.2. Multiple Choice#

1. What keyword sends a value back from a method to its caller?

a) send
b) output
c) return
d) yield

Answer

c) returnreturn exits the method and passes the value back.

2. Which method signature is syntactically correct in C#?

a) static void Greet(string name)
b) void static Greet(string name)
c) Greet static void(string name)
d) static Greet void(string)

Answer

a) static void Greet(string name) — The modifier (static) precedes the return type, which precedes the name.

3. What happens when a method is called with fewer arguments than required parameters?

a) Uses null automatically
b) Compiles but crashes at runtime
c) Causes a compile-time error
d) Uses zero for numeric types

Answer

c) Causes a compile-time error — Missing required arguments produce a compile error.

4. A method that calls itself is called:

a) Iterative
b) Recursive
c) Polymorphic
d) Abstract

Answer

b) Recursive — Recursion is when a method invokes itself.

5. Method overloading means:

a) A method that calls other methods
b) Multiple methods with the same name but different parameters
c) A method with too many lines
d) Calling a method in a loop

Answer

b) Multiple methods with the same name but different parameters — Overloading lets you reuse a name with different parameter signatures.

Footnotes