Posts

Showing posts with the label capgemini pseudocode questions mcq

Capgemini Pseudo Code MCQs Asked on 20th december 2021

Capgemini Pseudo Code MCQs Asked on 20th december 2021 Capgemini Pseudo Code MCQs Asked on 20th december 2021 1)What will be the output of the following pseudocode? Integer p,q,r Set p=9,q=7,r=4 r=q+r if((p^q) q=11+r q=(q+p)+r End if Print p+q+r a) 27 b)13 c) 34 d) 46 Ans: Option a 2)What will be the output of the following pseudocode? integer a,b,c Set a=3,b=7,c=10 for(each c from 2 to 4) a=(b^b)+b if(c>a) continue else jump out of the loop a=(8&12)+a Print a+b a) 17 b) 10 c) 7 d) 22 Ans: Option d 3) What will be the output of the following pseudocode? integer a,b,c Set a=8,b=4,c=9 for(each c from 5 to 7) a=3+b if(5<a) a=(c+3)+b Print a+b a) 18. b) 36. c) 12. d) 20 ...

Capgemini Pseudocode Question Asked on 19th december 2021 | slot 2

Capgemini Pseudo Code MCQs Asked on 19th december 2021 Slot 2 Capgemini Pseudo Code MCQs Asked on 19th december 2021 Slot 2 1)The following numbers are inserted into an empty binary search tree in the given order: 10, 1, 3, 5, 15, 12, 16. What is the height of the binary search tree? a) 3 b) 4 c) 5 d) 6 Ans: Option a 2) Convert the given postfix expression into infix. ab-c*d/ a) (a-b)(c/d) b) (a-(bc))/d c) a-((bc)/d) d) (((a-b)c)/d) Ans: Option d 3) Find out the array representation of the given max heap, if the value 12 is deleted from it. 18, 15, 12, 9, 6, 3 a) 18, 15, 9, 6, 3 b) 9, 6, 18, 15, 3 c) 18, 3, 6, 9, 15 d)18, 15, 3, 9, 6 Ans: Option d 4)Which of the following traversal of a binary tree always yields all the nodes? a) In-order traversal b) Post-order traversal c) Pre-order traversal d) Level order traversal ...

Capgemini Pseudocode Question Asked on 19th december 2021 | slot 1

Capgemini Pseudo Code Asked on 19th december 2021 slot 1 Capgemini Pseudo Code Asked on 19th december 2021 slot 1 1)What will be the output of the following pseudocode? Integer a,b,c Set a=0, b=8, c=9 for(each c from 5 to 9) a=(a&9)^b End for a=c+a for(each c from 3 to 5) b=(12+6)+c b=(c+a)+b End for Print a+b a) 59 b) 69 c) 64 d) 66 Ans: Option c 2)What will be the output of the following pseudocode? Integer j,m Set m=2 Integer a[4] = {2,1,3,1} for(each j from 0 to 2) if (a[j] > j) Continue Else m=a[j]+2 End if m=m+1 End for Print m a) 17 b) 9 c) -11 d) 4 Ans: Option d 3) What will be the output of the following pseudocode if a=5,b=10,c=15? Start Number, a, b, result Input: a , b result = ++a + b++ + –c print a,b,c,result a) 6 11 14 30 b) 5 10 1...

Capgemini pseudocodes asked on 18th december 2021 | slot 2

Capgemini Pseudo Code MCQs (previously asked) Capgemini pseudocodes asked on 18th december 2021 slot 2 1)What will be the output of the following pseudocode? #include int main() { char ch = 'A'; printf("%d\n", ch); return 0; } a) A b)'A' c) 65 d) 97 Ans: Option a 2)What will be the output of the following pseudocode? #include int foo(int* a, int* b) { int sum = *a + *b; *b = *a; return *a = sum - *b; } int main() { int i = 0, j = 1, k = 2, l; l = i++ || foo(&j, &k); printf("%d %d %d %d", i, j, k, l); return 0; } a) 1211 b) 1121 c) 1221 d) 1222 Ans: Option a 3) What will be the output of the following pseudocode? #include int i; int main() { if (i); else printf("Ëlse"); return 0; } a) if block is executed. b) else block is executed ...

Capgemini Pseudocodes Asked On 18th december 2021 | Slot 1

Capgemini Pseudo Code MCQs (previously asked) Capgemini Pseudo Code Questions Asked on 18th December 2021 Slot 1 1)What will be the output of the following pseudocode? Integer pp,qq Set pp = 1, qq = 1 pp = pp + qq qq=0 pp=0 pp=qq qq=pp if(1) pp = pp + qq End if Print 1 + qq + pp a) 0 b) 8 c) 11 d) 1 Ans: Option d 2)What will be the output of the following pseudocode? String str1 = "consumer" Print countVowel(str1+str1+str1) a) 14 b) 5 c) 27 d) 9 Ans: Option d 3) What will be the output of the following pseudocode? Integer p,q,r Set p = 6, q = 9, r = 7 if(q<r or (r&p) < (q^r)) r = 3 q = (q + 9) + r End if print p+q+r Ans: 30 4)What will be the output of the following pseudocode? Integer p,q,r Set p = 1, q = 2, r = 1 if(p ...

Capgemini Pseudocodes MCQs Part 2

Capgemini Pseudo Code MCQs (previously asked) Capgemini Pseudo Code MCQs Part 2 1) Which of the following will give the best performance? a) O(n) b) O(n!) c) O(n log n) d) O(n^C) Ans: Option A 2)How many times the following loop be executed? { ch = b; while(ch >= a && ch ch++; } a) 0 b) 25 c) 26 d) 1 Ans: Option B 3) ) Consider the following piece of code.What will be the space required for this code? int sum(int A[], int n) { int sum = 0, i; for(i = 0; i sum = sum + A[i]; return sum; } // sizeof(int) = 2 bytes a) 2n + 8 b) 2n + 4 c) 2n + 2 d) 2n Ans: Option A 4) What will be the output of the following pseudo code? For input a=8 & b=9. Function(input a,input b) If(a return function(b,a) elseif(b!=0) return (a+function(a,b-1)) else return 0 a) 56 b) 88 c) 72 d) 65 Ans: Option C 5)Wha...

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...