The method Greet has a parameter name and is called with argument "Alice".
Step 2: Understand string interpolation output
The output will replace {name} with "Alice" in the printed string.
Final Answer:
Hello, Alice! -> Option A
Quick Check:
Argument replaces parameter in output [OK]
Hint: Arguments fill parameters when calling methods [OK]
Common Mistakes:
Printing parameter name literally
Forgetting to pass argument
Confusing parameter with variable
4. What is wrong with this method call?
void PrintSum(int a, int b) {
Console.WriteLine(a + b);
}
PrintSum(5);
medium
A. Too many arguments passed.
B. Too few arguments passed.
C. Parameter types do not match arguments.
D. Method name is incorrect.
Solution
Step 1: Check method parameters
The method PrintSum requires two integer parameters: a and b.
Step 2: Check method call arguments
The call PrintSum(5); provides only one argument instead of two.
Final Answer:
Too few arguments passed. -> Option B
Quick Check:
Parameter count must match argument count [OK]
Hint: Count arguments to match parameters [OK]
Common Mistakes:
Passing fewer arguments than parameters
Ignoring method signature requirements
Assuming default values without specifying
5. You want to create a method CalculateArea that takes two parameters width and height and returns their product. Which method signature and call correctly use parameters and arguments?
hard
A. Method: int CalculateArea(int width, int height) Call: CalculateArea(5);
B. Method: int CalculateArea(width, height) Call: CalculateArea(5, 10);
C. Method: void CalculateArea(int width, int height) Call: CalculateArea(5, 10);
D. Method: int CalculateArea(int width, int height) Call: CalculateArea(5, 10);
Solution
Step 1: Check method signature correctness
Method: int CalculateArea(int width, int height) Call: CalculateArea(5, 10); correctly declares parameter types and names and returns int.
Step 2: Check method call arguments
Method: int CalculateArea(int width, int height) Call: CalculateArea(5, 10); calls method with two integer arguments matching parameters.
Step 3: Analyze other options
Method: int CalculateArea(width, height) Call: CalculateArea(5, 10); misses types in parameters; Method: int CalculateArea(int width, int height) Call: CalculateArea(5); passes only one argument; Method: void CalculateArea(int width, int height) Call: CalculateArea(5, 10); returns void, so no product returned.
Final Answer:
Method with int parameters and int return, called with two arguments. -> Option D
Quick Check:
Signature and call must match parameters and arguments [OK]
Hint: Match parameter types and argument count exactly [OK]
Common Mistakes:
Omitting parameter types
Passing wrong number of arguments
Using void return when value needed
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.