Accenture Psedocode - 3
Accenture Psedocode - 3
if(q EQUALS 0)
return 0
B. 7
C. 12
D. 8
Integer x, y, Z, a
Set x=2,y=1,z=5
a = (x AND y) OR (z + 1)
Print a
A. 5
B. 3
C. 2
D. 1
3 Correct Ans : B Added By : fc15074 October 4, 2023, 11:58 am Edit
What will be the output of the following pseudocode for a = 2, b = 3?
doSomething(Integer a, Integer b)
if(b EQUALS 1)
return 0
else
A. 3
B. 4
C. 2
D. 1
Integer a, n, sum, q, r
Set q=a
n=n+1
q=q/10
End while
Print n
while (a greater than 0)
r=a mod 10
sum =sum + r
a =a/power(10, n- 1)
End while
Print sum
A. 3 2
B. 6 4
C. 6 5
D. 3 4
Integer a=5,b=8,c
if(a>8 OR b < 7)
c=a+b
elseif(a + b > 9)
c=a-b
else
a=a+5
c=c-2
end if
a=a+b
Print a and c
b=b-5
B. 5 -3
C. 5 1
D. 13 -3
a. 17
b. 5
c. 2
d. -5
a. 13
b. 17
c. 14
d. 23
If(x) gets executed if the value inside ifo, i.e., x is not zero]
a. 11
b. 6
c. 12
d. 22
a. 13
b. 17
c. 14
d. 23
13
24
35
20
11 Correct Ans : A Added By : fc15074 October 5, 2023, 9:39 am Edit
What will be the output of the following pseudocode for input a = 30, b = 60, C = 90?
Integer a, b, c, sum
Read a, b, c
Set sum = a + b + c
if ((sum EQUALS 180) and (a NOT EQUALS 0) and (b NOT EQUALS 0) and (c NOT EQUALS
0))
Print " Success"
Otherwise
Print "Fail"
End if
a. Success
c. Fail
if(a > b)
End if
if(b > a)
End if
b=b^a
a=a^b
return a + b
A. 35
B. 20
C. 14
D. 25
x=x+2
end for
Print x
A.11
B.10
C.12
D.13
Set m = 1, j = 1
if(a[0])
a[j] = 5
End if
m = m + a[j]
Print m
A.3
B.2
C.6
D.4
if(k>155)
return
end if
print k
fun(k+2)
print k
C. 150
Initialize Integer x, y, z
Set y = 1, x = 2
z=x^y
Print z
a. 1
b. 2
c. 4
d. 3
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
a. 5 8 10
b. 1 3 6
c. 8 9 10
d. 3 6 9