Recall & Review
beginner
What is a method in C#?
A method is a block of code that performs a specific task. It can be called to run that task whenever needed.
Click to reveal answer
beginner
How do you declare a method that returns no value in C#?
Use the void keyword before the method name. For example: <br>
void SayHello() { Console.WriteLine("Hello!"); }Click to reveal answer
beginner
How do you call a method named
Greet in C#?Simply write the method name followed by parentheses: <br>
Greet();
Click to reveal answer
beginner
What is the purpose of method parameters?
Parameters let you send information into a method so it can use that data to do its job.Click to reveal answer
beginner
How do you declare a method that returns an integer value?
Specify the return type before the method name. For example: <br>
int GetNumber() { return 5; }Click to reveal answer
Which keyword is used to declare a method that does not return any value?
✗ Incorrect
The keyword void means the method does not return any value.
How do you call a method named
DisplayMessage?✗ Incorrect
To call a method, write its name followed by parentheses.
What does a method parameter do?
✗ Incorrect
Parameters allow you to send information into a method.
Which part of a method declaration specifies the type of value it returns?
✗ Incorrect
The return type is written before the method name to show what type of value the method returns.
What happens if a method has a return type other than void?
✗ Incorrect
Methods with a return type other than void must return a value of that type.
Explain how to declare and call a simple method in C# that prints a message.
Think about the method header, body, and how you run it.
You got /5 concepts.
Describe the role of parameters and return types in methods.
Consider how methods communicate with the outside.
You got /4 concepts.