Question 1
What will be the output of the following pseudocode?
Initialize Integer x, y, z Set y = 1, x = 2 z = x ^ y Print z
Question 2
Which of the following series will be printed by the given pseudocode?
Integer a, b, c Set b = 4, c = 5 for(each a from 2 to 4) print c b = b - 1 c = c + b end for
Question 3
Predict the output of the following pseudocode.
Integer value, n Set value = 1, n = 45 while(value less than equal to n) value = value << 1 end loop Print value
Question 4
Integer x, y Set x = 15, y = 12 y = x – 1 do{ Print x x = y + (x – 2) } while(x < 40) end do while
Question 5
What will be the output of the following pseudocode?
Initialize Integer x, y, z Set y = 1, x = 2 z = x & y Print z
Question 6
Which of the following series will be printed by the given pseudocode?
Integer a, b, c Set b = 0, c = 0 for(each a from 1 to 5) print c b = b + 1 c = c + b end for
Question 7
Integer value, n Set value = 32, n = 1 while(value greater than equal to n) value = value >> 1 end loop Print value
Question 8
Integer x, y Set x = 4, y = 8 do{ Print x x = x + y + 1 } while(x < 15) end do while
Question 9
Predict the output of the following pseudo-code if x= 1 and y=2:
Integer solve(int x, int y) if(x > 1) solve(x – 1, y + 3) end if print y End function solve()
There are 20 questions to complete.