Accenture Pseudocode Questions
What will be the output of the following pseudocode?
Questions 1) 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-2
return 3-a
Else
return a-b+1
End if
return a + b
End function fun()
Answer: 5Questions 2) What will be the output of the following pseudocode for a = 5, b = 1?
Integer funn(Integer a, Integer b)
if((b mod a && a mod b) || (a ^ b > a))
a=a ^ b
Else
return a-b
End if
return a + b
End function funn()
Answer: 5Questions 3) What will be the output of the following pseudocode?
Integer a, b, c
Set a = 4, b = 4, c = 4
if (a & (b ^ b) & c)
a = a >> 1
End if
Print a + b + c
Answer: 12Questions 4) 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 if
a = a + a + a + a
return a
End function funn()
Answer: 40Questions 5) 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 – 2
return 3 – a
Else
return a – b + 1
End if
return a + b
End function fun()
Answer: 5
What is PseudoCode: A Complete Tutorial
A Pseudocode is defined as a step-by-step description of an algorithm. Pseudocode does not use any programming language in its representation instead it uses the simple English language text as it is intended for human understanding rather than machine reading.
Pseudocode is the intermediate state between an idea and its implementation(code) in a high-level language.