Ask Question

Find the error in the following pseudocode. Module main () Call raiseToPower (2, 1.5) End Module Module raiseToPower (Real value, Integer power) Declare Real result Set result=value^power Display result End Module

+1
Answers (1)
  1. 28 June, 04:28
    0
    Call raiseToPower (2, 1.5) '

    or

    raiseToPower (Real value, Integer power)

    Explanation:

    To solve this, first organize the pseudo code,

    1) main ()

    2) Call raiseToPower (2, 1.5)

    3) End Module

    4) Module

    5) raiseToPower (Real value, Integer power)

    6) Declare Real result

    7) Set result=value^power

    8) Display result

    9) End Module

    The first three lines in pseudo code are representing the main module. While lines 4-9 shows the definition of module that is being called in main function.

    If we look at the raiseToPower definition at line5, we can see that it is requiring any real value for the base number. However, for power, it defines only integers.

    But, in the main function, 1.5 is placed as a power that is not an integer. Therefore, this is the error in pseudo code. It should be changed to any integer.

    Alternatively, change the integer power to real power to avoid this error.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Find the error in the following pseudocode. Module main () Call raiseToPower (2, 1.5) End Module Module raiseToPower (Real value, Integer ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers