Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Predict the Output: class R { static int dosomething ( int a [ ] , int i , int n ) { if ( n

Predict the Output:
class R
{
static int dosomething(int a[],int i, int n)
{
if (n0) return 0 ;
else if(a[i]2==0 return a[i]+ dosomething(a, i+1, n-1);
else return a[i]- dosomething(a, i+1, n-1);
}
public static void main(String args[])
{
int a[]={5,12,8,10,3,16,2,1};
System.out.print (i:dosomething(a,i:0,n:8)); }
}
A.-9
B.5
C.19
D.15
image text in transcribed

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

Oracle 10g Database Administrator Implementation And Administration

Authors: Gavin Powell, Carol McCullough Dieter

2nd Edition

1418836656, 9781418836658

More Books

Students also viewed these Databases questions

Question

What guidance are you giving managers on pre- and post- briefing?

Answered: 1 week ago

Question

Current skills levels and starting point of the targeted group

Answered: 1 week ago

Question

Finally, the individual is the only person who can make it happen!

Answered: 1 week ago