Draw the uml and state diagram for an


Q.1. A) How many recursive calls are made from the call to fib (4) (not counting the original call)?

int fib(int n) { // assumes n >= 0

if (n <= 1)

return n;

else

return (fib(n - 1) + fib(n - 2));

B) Identify the recursive condition in the following code.

int fib(int n) { // assumes n >= 0

if (n <= 1)

return n;

else

return (fib(n - 1) + fib(n - 2));

C) Why does the best recursive method usually run slightly slower than its iterative counterpart?


Q.2. Consider the factorial function: n! = n*(n-1)*(n-2)*...*1. Write a java code of the Factorial method by considering recursion?

Q.3. Explain and draw the UML symbols for the following terms.

i) Inheritance

ii) Aggregation

iii) Dependency

iv) Association

Q.4. Draw the UML and state diagram for an ATM

Solution Preview :

Prepared by a verified Expert
Database Management System: Draw the uml and state diagram for an
Reference No:- TGS01132462

Now Priced at $15 (50% Discount)

Recommended (90%)

Rated (4.3/5)