Knowee
Questions
Features
Study Tools

What will be the output of the following pseudo code a=3, b=7, c=10?1. 2. Integer funn (Interger a, Integer b, Integer c)3. c=(c&3)+c4. b=b&c5. a=(2+4)+a6. return a+b+c

Question

What will be the output of the following pseudo code a=3, b=7, c=10?1. 2. Integer funn (Interger a, Integer b, Integer c)3. c=(c&3)+c4. b=b&c5. a=(2+4)+a6. return a+b+c

🧐 Not the exact question you are looking for?Go ask a question

Solution 1

The pseudo code provided seems to be a mix of different programming languages. However, it appears to be closest to Java or C++. Here's a step-by-step breakdown of what the code does:

  1. The function funn is defined, which takes three integers a, b, and c as parameters. In this case, a is 3, b is 7, and c is 10.

  2. In the line c=(c&3)+c, the bitwise AND operation is performed between c (which is 10 in binary form 1010) and 3 (which is 11 in binary). The result is 2 (which is 10 in binary). This is then added to c, so c becomes 12.

  3. In the line b=b&c, the bitwise AND operation is performed between b (which is 7 in binary form 0111) and c (which is 12 in binary form 1100). The result is 4, so b becomes 4.

  4. In the line a=(2+4)+a, 2 and 4 are added together to get 6, and then this is added to a (which is 3), so a becomes 9.

  5. Finally, a, b, and c are added together and returned by the function. So, 9 (value of a) + 4 (value of b) + 12 (value of c) = 25.

So, the output of the pseudo code will be 25.

This problem has been solved

Solution 2

The pseudo code provided seems to be a mix of different programming languages. However, it appears to be closest to Java or C++. Here's a step-by-step breakdown of what the code does:

  1. The function funn is defined, which takes three integers a, b, and c as parameters. In this case, a is 3, b is 7, and c is 10.

  2. In line 3, c is updated. The expression (c&3) performs a bitwise AND operation between c (which is 10 in binary form 1010) and 3 (which is 11 in binary). The result is 2 (which is 10 in binary). This is then added to the original c, so c becomes 12.

  3. In line 4, b is updated. The expression b&c performs a bitwise AND operation between b (which is 7 in binary form 0111) and c (which is now 12 in binary form 1100). The result is 4, so b becomes 4.

  4. In line 5, a is updated. The expression (2+4)+a simply adds 6 to the original a, so a becomes 9.

  5. Finally, in line 6, the function returns the sum of a, b, and c, which is 9 + 4 + 12 = 25.

So, the output of the pseudo code will be 25.

This problem has been solved

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 = 9, b = 7?Integer funn(Integer a, Integer b)  Integer c   Set c = 2   b = b mod c   a = a mod c  return a + b End function funn()[Note- mod finds the remainder after the division of one number by another. For example, the expression "5 mod 2 leaves a quotient of 2 and a remainder of 1.]Question 87AnswerA.5B.2C.17D.-5

What will be the output of the following pseudo code?1. Integer a, b, c2. Set a=3, b=6, c=63. b = (c^1)+b4. for (each c from 2 to 3)5. a = (b&a) +b6. b = (12 + 12) +a7. End for8. b=(b^c)&c9. Print a+b

What will be the output of the following pseudocode for a = 10, b = 11?Integer funn(Integer a, Integer b)if(0)return a - b - funn(-7, -1)End ifa = a + a + a + areturn aEnd function funn()Question 82AnswerA.30B.44C.0D.40

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

1/3

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.