60.4k views
2 votes
A programmer notices the following two procedures in a library. The procedures do similar, but not identical,

things.

Procedure square (n) returns the value n2

Procedure cube (n) returns the value n3

Which of the following procedures is a generalization of the procedures described above?
A. Procedure Add (n, m), which returns the value n + m
B. Procedure Fourth (n), which returns the value n4
C. Procedure Polynomial(n), which returns the value n3 +n2
D. Procedure Power (n, m), which returns the value nm

1 Answer

6 votes

Answer:

D. Procedure Power (n, m), which returns the value n^m

Step-by-step explanation:

Given


square(n) \to n^2


cube(n) \to n^3

Required

The generalization

The given functions are power functions which returns the power of n to a certain value.

The power sequence follows:


fourth(n) \to n^4


fifth(n) \to n^5


sixth(n) \to n^6

------

-----

--


power(n,m) \to n^m

Hence, (d) is correct

User Meberem
by
7.1k points