Functions And Methods In C Sharp - Study Mode

[#1] What is the keyword used to define a function in C#?
Correct Answer

(C) method

[#2] What is the purpose of a return type in a method declaration in C#?
Correct Answer

(B) To specify the type of data returned by the method

[#3] In C#, which keyword is used to define a method that does not return a value?
Correct Answer

(C) void

[#4] What is the correct syntax to declare a method named Add that takes two integer parameters and returns their sum in C#?
Correct Answer

(D) int Add(int num1, int num2)

[#5] Which of the following statements is true regarding method overloading in C#?
Correct Answer

(D) Methods must have the same signature