What will be the output of the following pseudo code a=2, b=1?1. 2. Integer funn (Interger a, Integer b)3. if(4>b && b<a && b<a)4. a=b+25. a=b+26. b=a+17. return b – funn(b, b)8. End if9. b=1+b+a10. return b-a +1
Question
What will be the output of the following pseudo code a=2, b=1?1. 2. Integer funn (Interger a, Integer b)3. if(4>b && b<a && b<a)4. a=b+25. a=b+26. b=a+17. return b – funn(b, b)8. End if9. b=1+b+a10. return b-a +1
Solution
The pseudo code provided seems to have some logical issues and it's not clear what it's supposed to do. However, I'll try to interpret it as best as I can.
First, let's initialize the variables: a=2, b=1.
Then, we have a function funn that takes two integers as arguments. Inside this function, there's an if condition that checks if b is less than 4, b is less than a, and b is less than a again. Since b is 1 and a is 2, this condition is true.
Inside the if block, a is first set to b+2 (which would be 3), then immediately set to b+2 again (still 3). b is then set to a+1 (which would be 4). The function then returns b - funn(b, b). However, this would cause a recursive call to funn with b as both arguments, which would likely result in an infinite loop as the condition in funn would always be true.
If the if condition was not met, the function would set b to 1+b+a (which would be 4), then return b-a+1 (which would be 3).
So, without further clarification on the intended logic of the pseudo code, it's difficult to determine a definitive output.
Similar Questions
What will be the output of the following pseudo code a=3, b=2?1. 2. Integer funn (Interger a, Integer b)3. if(b<4 && a<4)4. b=b+35. b=(a+c)+b6. return funn (a+1,b) + funn(b, a)-a7. End if8. return a+b -1
What will be the output of the following pseudocode for a = 4, b = 6?Integer funn(Integer a, Integer b) If(a > 1) Return a * funn (b - 6, a - 4) Else Return 1 End If Return a + b End function funn()Question 79AnswerA.7B.17C.4D.0
What will be the output of the following pseudocode for a = 5, b = 1?Integer funn(Integer a, Integer b)if(b + a || a - b) && (b > a) && 1)a = a+b+b-2return 3-aElseEnd ifreturn a-b+1return a+b End function fun()Question 77AnswerA.11B.5C.16D.0
What will be the output of the following pseudocode for a = 4 and b = 9?Integer funn(Integer a, Integer b)If(a Return 1 + funn(a, b – 2)End IfIf(a^b >a &b)Return a ^ bElseReturn a &bEnd IfReturn 1End function funn()10-81424
What will be the output of the following pseudo code?1. Inteter a, b, c2. Set a=9, b=4, c=93. if ((b&a)<a)4. a=b&a5. End if6. Pring a+b+c
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.