QUESTION IMAGE
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.
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.
Snap & solve any problem in the app
Get step-by-step solutions on Sovi AI
Photo-based solutions with guided steps
Explore more problems and detailed explanations
B. The module attempts to use a variable that is out of scope.