What will be the output of the following pseudo code?
1. Integer p, q, r
2. Set p = 6, q = 6 , r = 10
3. if((p ^ 4) < (6 + p))
4. if((r + q) > (q - r))
5. q = 3 + r
6. r = (5^4) + q
7. End if
8. r =(r&11)+q
9. Else
10. p = 6 + p
11. if ((r + p) < (8 - r))
12. q = (2 + 9) + q
13. End if
14. p = (p + r) ^ r
15. End if
16. Print p + q + r
Answers & Comments
What will be the pattern of the pseudo-code round of Capgemini?
Capgemini pseudo code round is a 30-minute round and you get 30 questions in this round. The questions will be asked from C( input-output), C++, OPPs, and DSA.
The topics from DSA which are asked:
Array
Time Complexity
Trees
Linked list
Hashing, etc.
Capgemini Pseudocode Questions
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()
2
5
-5
17
Answer: 2
2. What will be the output of the following pseudocode?
Integer a, b, c
Set a = 8, b = 6,c = 4
If(a > b)
a = b
Else
b = a
End If
If(c> b)
c = b
Else
b = c
End If
Print a + b + c
13
14
17
23
Answer: 14
3. What will be the output of the following pseudocode?
Integer a, b, c
Set a = 1, b = 1, c = 7
a = a + b
if(a + b)
if(b + (c ^ a))
a = 2
b = a
End if
End if
Print a + b + c
6
11
22
12
Answer: 11
4. What will be the output of the following pseudocode?
Integer p, q, r, s
Set p=1, q = 1
for (each r from 0 to 2 )
for (each s from -4 to -2 )
p = p + 2if(p > r)
Continue
End if
p = 1if(p > s)
Jump out of the loop
End if
End for
End for
Print p + q
35
13
24
20
Answer: 20
5. What will be the output of the following pseudocode for input a = 30, b = 60, and C = 90?
Integer a, b, c, sum
Read a, b, c
Set sum = a + b + c
if ((sum EQUALS 180) and (a NOT EQUALS 0) and (b NOT EQUALS 0) and (c NOT EQUALS 0))
Print " Success"
Otherwise
Print "Fail"
End if
Success
Fail
Error
None of the above
Answer: Success
Hp it hlps ☺️ ✌️ ☺️
Answer:
The output of the pseudo code would be 185.
Explanation:
From the above question,
They have given :
The pseudo code -
[tex]1. Integer p, q, r2. Set p = 6, q = 6 , r = 103. if((p ^ 4) < (6 + p))4. if((r + q) > (q - r))5. q = 3 + r6. r = (5^4) + q7. End if8. r =(r&11)+q9. Else10. p = 6 + p11. if ((r + p) < (8 - r))12. q = (2 + 9) + q13. End if14. p = (p + r) ^ r15. End if16. Print p + q + r[/tex]
This code is setting p, q and r to particular values, then checking if a certain condition is true for each of those variables and performing different operations depending on if the condition is true or false.
If the condition is true, then it will perform the operations within the 'if' statement (lines 3-7 and 10-13). If the condition is false, then it will perform the operations within the 'else' statement (lines 8-9 and 14-15).
The final output of the code will be the sum of the values of p, q and r, which is printed on line 16.
Hence,
The output of the pseudo code would be 185.
For more such related questions : https://brainly.in/question/55018150
#SPJ2