Course Solutions Uncategorized (Solved) : Number 5 Number Exp Number 2 Disp Number Function Number Exp Number Exp 2 Exp Number Numbe Q37395918 . . . .

(Solved) : Number 5 Number Exp Number 2 Disp Number Function Number Exp Number Exp 2 Exp Number Numbe Q37395918 . . . .

 

number = 5;

number = exp(number, 2);

disp(number);

function number = exp(number, exp)

for i = 2:exp

number = number * number;

end

end

You are testing the exp function above. Which of the followingtest cases would detect errors which exist in the function (hint:there is an bug)

1)exp(0,2)

% test for 0 number
% expected output 0

2)exp(2,0)

% test for 0 exponent
% expected output 1

3)exp(2,-1)

% test for negative exponent
% expected output 0.5

4)exp(5,2)

% test for square

% expected output 25

5)exp(-5,2)

% test for negative number

% expected output 25

Expert Answer


An answer will be send to you shortly. . . . .

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

(Answered) : In the most basic activity table, which of the following times should be included? 1) Maximum (pessimistic) completion time(Answered) : In the most basic activity table, which of the following times should be included? 1) Maximum (pessimistic) completion time

In the most basic activity table, which of the following times should be included? 1) Maximum (pessimistic) completion time 2) Minimum (Optimistic) completion time 3) Most likely time 4) Expected completion time