190k views
0 votes
Which of the following statements invokes the GetDiscount function, passing it the contents of two Decimal variables named decSales 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

1 Answer

0 votes

Answer:

c. decDiscount = GetDiscount(decSales, decRate)

Step-by-step explanation:

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.

User Tadywankenobi
by
4.9k points