Which of the following statements invokes the GetDiscount function, passing it the contents of two Decimal variables named decSa
les and decRate? The statement should assign the function's return value to the decDiscount variable.a. decDiscount = Call GetDiscount(decSales, decRate)b. Call GetDiscount(decSales, decRate, decDiscount)c. decDiscount = GetDiscount(decSales, decRate)d. none of the above
Option a. is incorrect because it is using Call word which is not a valid way to invoke a function.
Similarly option b. is also incorrect because it uses Call word to invoke function GetDiscount() which is not a valid way to call a function and also it is passing it the contents of three variables decSales, decRate and decDiscount and as mentioned in the question only two parameters are to be passed to GetDiscount() function.
Option c. is correct as it invokes the function GetDiscount() and passes it the contents of two variables decSales and decRate and assigns this to a variable decDiscount. For example if the GetDiscount() method has to calculate the discount using decSales and decRate then the resultant value of this computation is assigned to decDiscount. So whatever this function returns or computers is assigned to and stored in decDiscount variable. So this is a valid way to invoke a method.
A method is a code block of statements that perform a task.
By calling a method, a program causes statements to be executed. In C#
programming, every instruction that is executed is performed in the context of
a method. Technically, it is how behaviors are implemented in C# and are
enclosed in parentheses separated by commas
Konrad Zuse was a German civil engineer, inventor and computer pioneer. His greatest achievement was the world's first programmable computer; the functional program-controlled Turing-complete Z3 became operational in May 1941.