Computer Science, asked by vedhasankari7, 7 months ago

Q2: Find the output of the following pseudo-code
Integer value, n
Set value = 1, n = 45
while(value less than equal to n)
value = value << 1
end loop
Print value

Answers

Answered by ixvenukumar
9

Capgemini pseudo code MCQs with answers are given here. These are the questions which were asked in most recent Capgemini pseudo code test.

If you're a 2021 pass-out, Capgemini has retained the Pseudocode round in its brand new recruitment pattern.

If you want to know more about the Capgemini on-campus Recruitment Pattern for 2021 Pass-outs, please check out this article.

Answered by eppyshan
3

Answer:64

Explanation: Here, the left shift operation pushes the values towards the left once; when 1 is left-shifted the value that we will be obtaining will always be 2 to the power something. When one is converted in the beginning and not shifted the value will be 2^0 which is 1. The next iteration will be pushed one place towards the left, therefore the value now will be 2^1 which is 2; this will go on happening until the value stored is greater than 45. The value which is greater than 45 in 2 powers is 64. Now the loop terminates and the last value stored in the variable is 64 and the same will be printed.

Similar questions