Infosys Pseudocode Questions
What will be the output of the following pseudocode?
Question 1) for i=0 to 4 step 1 do
If i==i++ + –i then do
display i
end-if
end-for
Answer: 0Question 2) Set Character c = ‘7’
switch(c)
case ‘1’: display “One”
case ‘7’: display “Seven”
case ‘2’: display “Two”
default: display “Hello”
break
end-switch
Answer: SevenTwoHelloQuestion 3) Integer a, p
Set a = 5
a = a + 1
a = a * 2
a = a / 2
p = a / 5 + 6
print p
Answer: 7Question 4) Integer a, b, c
Set b = 40, a = 20, c = 20
a = a + c
c = c + a
a = a + c
c = c + a
Print a + b + c
Answer: 300Question 5) Integer a, b, c
Set a = 4, b = 3, c = 1
if (a >> (c – 1) && b << (c + 1))
a = a + c
Else
b = a <<< C
End if
Print a – b + c
Answer: 3
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.