Capgemini Pseudocodes MCQs Part 1
Capgemini Pseudo Code MCQs Part 1 Capgemini Pseudo Code MCQs Part 1 1) What will be the value of s if n=127? Read n i=0,s=0 Function Sample(int n) while(n>0) r=n%l0 p=8^i s=s+p*r i++ n=n/10 End While Return s; End Function a) 27 b) 187 c) 87 d) 120 Ans: Option C 2)What will be the output of the following pseudocode? Integer n for (n = 3; n != 0; n--) Print n n = n-1 end for a) 3 1 b) 3 2 1 c) 3 d) Infinite Loop Ans: Option C 3) What will be the output of the following pseudocode? For input a = 8 & b = 9. Function(input a, input b) If(a < b) return function(b, a) elseif(b != 0) return (a + function(a,b-1)) else return a) 56 b) 78 c) 72 d) 68 Ans: Option C 4) What will be the value of even_counter if number = 2630? Read number Function divisible(number) even_counter = 0, num_remainder = number; while (num_remainder) dig...