Capgemini Pseudocodes Asked On 18th december 2021 | Slot 1
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 < 1)
if(1)
p = p - r
Else
p = p + 2
End if
p = p + q +r
End if
Print p + q + r
b) 4
c) 10
d) 7
Ans: Option d
For more pseudo codes click here
5)What will be the output of the following pseudocode for a = 4, b =2?
Integer a,b,c
Set a = 8, b = 11, c = 12
if((a+b) > (c-a))
if((1-8) < (9 - a))
a = b&b
End if
End if
Print a + b + c
a) 31
b) 38
c) 34
d) 33
Ans: Option C
6)What will be the output of the following pseudocode ?
Integer s, p
set s = 56
p = s/4 + s*3 - s/7 + s*6;
if(p not equals 0)
print "hello"
else
print "bye"
end if
a) hello
b) 0
c) 1
d) bye
Ans: Option A
7) What will be the output of the following pseudocode ?
Integer a,b,c
Set a=0, b=3, c=14
b=a+a
b=(a+1)^c
b=(7+8)+b
c=(a+7)&c
Print a+b+c
a) 36
b) 39
c) 42
d) 31
Ans: Option A
8) What will be the output of the following pseudocode ?
Integer p,q,r
Set p=5, q=8, r=7
if(1<r)
if(p<q)
r=(2&3)+q
End if
q=4+p
End if
p=(p+p)+p
Print p+q+r
a) 34
b) 33
c) 43
d) 36
Ans: Option A
For more pseudo codes click here
Comments
Post a Comment