and Answers | Latest Version | 2024/2025
| Correct & Verified
What is a method in programming?
✔✔ A block of code that performs a specific task.
Why are methods used in coding?
✔✔ To organize code and avoid repetition.
How do you define a method?
✔✔ By using a method name, parentheses, and a code block.
Where is the method body located?
✔✔ Inside the curly braces after the method name.
What is a method parameter?
✔✔ A variable passed into a method.
1
,How do you call a method?
✔✔ By writing its name followed by parentheses.
What happens when a method is called?
✔✔ The code inside the method executes.
Why would you pass arguments to a method?
✔✔ To provide input values for the method to use.
What is a return type?
✔✔ The data type of the value a method sends back.
What does a void method do?
✔✔ Executes code without returning a value.
How can you get a result from a method?
✔✔ By using a return statement.
2
, What is method overloading?
✔✔ Creating multiple methods with the same name but different parameters.
Why is method overloading useful?
✔✔ It allows methods to handle different input types or counts.
Can methods be reused in multiple parts of a program?
✔✔ Yes, by calling the method wherever needed.
How do you pass multiple arguments to a method?
✔✔ List them in parentheses separated by commas.
What is a method signature?
✔✔ The method name and its parameter list.
Why is the method signature important?
✔✔ It identifies the method uniquely, especially in overloading.
3