C# - Functions and Subroutines Questions and Answers
Practice ModeShowing 10 of 29 questions
Q11
A function can be used in an expression, whereas a subroutine cannot be.
Answer: Option A
Q12
What is the primary purpose of a method in C#?
Answer: Option B
Explanation: Methods help organize code into reusable blocks and reduce redundancy.
Q13
Which keyword is used to define a method that does not return any value?
Answer: Option B
Explanation: void keyword indicates no return value.
Q14
What is the correct syntax for defining a method in C#?
Answer: Option B
Explanation: Method syntax requires return type, name, and parentheses for parameters.
Q15
Which of the following is true about method parameters?
Answer: Option B
Explanation: Parameters act as variables that receive values passed to the method.
Q16
What is method overloading in C#?
Answer: Option B
Explanation: Overloading allows multiple methods with same name but different parameters.
Q17
Which keyword is used to call a method from another method?
Answer: Option D
Explanation: Methods are called by using their name followed by parentheses.
Q18
What is the return type of a method that returns an integer value?
Answer: Option C
Explanation: int is the return type for integer values.
Q19
Which of the following is NOT a valid access modifier for methods?
Answer: Option C
Explanation: public, private, and protected are valid access modifiers.
Q20
What is the purpose of the return statement in a method?
Answer: Option B
Explanation: return statement sends a value back to the caller and exits the method.