Sovi.AI - AI Math Tutor

Scan to solve math questions

QUESTION IMAGE

name an error present in the following pseudocode. start declarations g…

Question

name an error present in the following pseudocode. start declarations global num merchcost output \enter purchase total: \ input merchcost calculatesalestax() output \please pay \, (merchcost + salestax) stop calculatesalestax() declarations num salestax num taxrate = .08 salestax = taxrate * merchcost return a. the main program declares only global variables. b. the module attempts to use a variable that is out of scope. c. the main program attempts to use a variable that is out of scope. d. the module is never called by the main program.

Explanation:

Brief Explanations

In the calculateSalesTax module, the variable merchCost is used without being passed in or declared locally. It is declared as a global variable in the main program but the module has its own scope rules and this usage causes a scope - related error.

Answer:

B. The module attempts to use a variable that is out of scope.