Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

QUESTION 6 Look at the following method. public static int Test2(int x, int y) { if ( x < y) { return -5; } else

QUESTION 6

Look at the following method.

public static int Test2(int x, int y)

{

if ( x < y)

{

return -5;

}

else

{

return (Test2(x - y, y + 5) + 6);

}

}

What is the base case for the method?

x < y

-5

Test2(x - y, y + 5) + 6

+6

QUESTION 7

Look at the following method.

public static int test2(int x, int y)

{

if ( x < y)

{

return -5;

}

else

{

return (test2(x - y, y + 5) + 6);

}

}

What is returned for test2(18,5)?

6

-5

7

1

QUESTION 8

Look at the following pseudocode algorithm.v

Algorithm gcd(x, y)

if (x < y)

gcd (y, x)

else

if (y = 0)

return x

else

return gcd(y, x mod y)

end gcd

What is returned from gcd(60, 24)?

60

24

66

12

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Joe Celkos Data And Databases Concepts In Practice

Authors: Joe Celko

1st Edition

1558604324, 978-1558604322

More Books

Students also viewed these Databases questions

Question

What is the best conclusion for Xbar Chart? UCL A X B C B A LCL

Answered: 1 week ago

Question

How many Tables Will Base HCMSs typically have? Why?

Answered: 1 week ago

Question

What is the process of normalization?

Answered: 1 week ago