0% found this document useful (0 votes)
8 views17 pages

Accenture PSEUDOCODE Questions

The document presents a series of pseudocode problems, each requiring the reader to determine the output based on the provided logic and operations. Each question includes multiple-choice answers, testing understanding of programming concepts such as functions, loops, conditionals, and data manipulation. The document serves as a quiz or exercise for learners to practice their coding skills.

Uploaded by

228w1f0045
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views17 pages

Accenture PSEUDOCODE Questions

The document presents a series of pseudocode problems, each requiring the reader to determine the output based on the provided logic and operations. Each question includes multiple-choice answers, testing understanding of programming concepts such as functions, loops, conditionals, and data manipulation. The document serves as a quiz or exercise for learners to practice their coding skills.

Uploaded by

228w1f0045
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

1. What will be the output of the following pseudocode if input x is 4 and y is 5?

FUNCTION calculate(x, y)
Z=x*y
RETURN z- x
END FUNCTION

Result = calculate(4, 5)
DISPLAY result
Select the correct answer from the given choices.
a. 16
b. 17
c. 18
d. 19

2. What is the output of the following pseudocode?


Set1= (1, 2, 3)
set2=(3, 4, 5)
union_set=set1 union set2
print(union_set)
Select the appropriate answer from the given choices.
a. {1,2,3,4,5}
b. {1,2,3}
c. {3,4,5}
d. {1,2,4,5}

3. What will be the output of the following pseudocode?


for i-1 to 3
if 1%2 == 0
print("even')
else
print("odd")
Select the correct answer from the given choices.
a. even odd even
b. odd even odd
c. odd odd odd
d. even even even
4. What is the output of the following pseudocode?
X=5
y = 10
if x < y and y > 5
print("True")
else
print("False")
Select the appropriate answer from the given choices.
a. True
b. False
c. Error
d. None

5. What is the output of the following pseudocode?


function add(a, b)
return a+b
print(add(2,3,1))
Select the correct answer from the given choices.
a. Error: Too many arguments passed
b. 3.0
c. 5.0
d. 6.0

6. What does the following pseudocode do in a linked list?


Node current = head
WHILE current.next is not null
current = current.next
ENDWHILE
PRINT current.data
Select the correct answer from the given choices.
a. Prints the first node’s data
b. Prints all node’s data
c. Prints the last node’s data
d. Prints the second node’s data
7. What will be the output of the following pseudo code?
Integer pp,qq,rr
Set pp=5, qq=6,rr=4
for(each rr from 5 to 8)
pp=qq^rr
pp=(gg+rr)+rr
pp=7+rr
End for
Print pp+qq
Select the correct option from the given choices.
a. 31
b. 23
c. 7
d. 21

8. What will be the output of the following pseudo code?


Integer p.q.r
Set p=2, q=7,r=4
if((q^5)<(S+q) && 3>p)
r=4&r
Else
q=r+p
End if
Print p+g+r
Select the correct option from the given choices.
a. 10
b. 13
c. 17
d. 26

9. What will be the output of the following pseudo code?


Integer p,q,r
Set p=5, q=5, r=5
P=(5^8)&q
for(each r from s to 8 )
q=(9+1)^r
End for
Q=s+p
Print p+q
Select the correct option from the given choices.
a. 16
b. 19
c. 24
d. 36

10. What will be the output of the following pseudo code?


Integer p,q,r
Set p=4, q=2, r=7
R=(12+4) +p
if((r^10^5)>(p^7))
p=r+q
r=3+q
End if
Print p+g+r
Select the correct option from the given choices.
a. 26
b. 29
c. 31
d. 43

11. What will be the output of the following pseudo code for a=2, b=8. c=8?
Integer funn(Integer a, Integer b, Integer c)
C=9+a
if((4+10+a)<(7+c))
if((7+6)<c)
if((S+c)<(b+5))
b=a+b
End if
End if
End If
Print a+b+c
Select the correct option from the given choices.
a. 17
b. 22
c. 21
d. 29
12. What will be the output of the following pseudo code?
Integer p,q,r
Set p=9,q=8,r=8
for(each r from 2 to 3)
p=(12^4)+q
p=q&q
End for
Q=3^p
Print p+q
Select the correct option from the given choices.
a. 8
b. 11
c. 16
d. 23

13. What will be the output of the following pseudo code for a=2, b=2, c=9?
Integer funn(Integer a, Integer b. Integer c)
for(each c from 4 to 6)
b=(11+11)+a
End for
for(each c from 2 to 5)
b=(c+6)&b
End for
Print a+b
Select the correct option from the given choices.
a. 7
b. 10
c. 15
d. 26

14. What will be the output of the following pseudo code for a=7. b=7. c=9?
Integer funn(Integer a, Integer b, Integer c)
A=8+c
if((9-9)>(a+9))
c=(2+10)+a
Else
if((b+a+c)<(a+c+b))
c=(c+c)+b
End if
a+b+c
End If
Print a+b+c
Select the correct option from the given choices.
a. 32
b. 36
c. 29
d. 44

15. What will be the output of the given pseudo code?


Integer a,b,c
Set a=7, b=2, c=4
a=(a+12)+C
for(each c from 4 to 5)
if((9+c)<a && c<a)
b=(c+a)+a
End if
b=(b+9)+c
if((a+c+b)<(c+b+a))
b=(c+a)+a
End if
End for
Print a+b+c
Note- &&: Logical AND - The logical AND operator (88) returns the Boolean value true(or 1) if
both operands are true and returns false (or 0) otherwise.
Select the correct option from the given choices.
a. 94.0
b. 96.0
c. 90.0
d. 106.0

16. What will be the output of the following pseudo code?


Integer p,q,r
Set p=9, q=2,r=10
for(each r from 3 to 4)
p=(p+q)+p
if((p+r)<r || 7>r)
p=12+p
Else
Continue
End if
End for
Print p+q
Select the correct option from the given choices.
a. 77
b. 83
c. 80
d. 87

17. What will be the output of the following pseudo code for a=3, b=2. c=6?
Integer funn(Integer a, Integer b, Integer c)
if((5-c-a)<(a+b))
if((a+c)+(c+b)>(a+c+b))
if((6+a)<(C+6))
a-5+a
Else
b-(c+11)+b
End if
End if
End If
return a+b+c
Select the correct option from the given choices.
a. 36
b. 20
c. -3
d. 16

18. What will be the output of the given pseudo code?


Integer a,b,c
Set a=1, b=2, c=6
a=(10+12)+b
if((b&a)<c || (b&c)<a)
b=1+b
if(2<a)
b=(8&12)+c
End if
End if
Print a+b+c
Note- & bitwise AND - The bitwise AND operator (&) compares each bit of the first operand to
the corresponding bit of the second operand. If both bits are 1, the corresponding result bit is set
to 1. Otherwise. the corresponding result bit is set to 0
Logical OR - The logical OR operator (1) returns the Boolean value TRUE (or 1) if either or
both operands is/are TRUE and returns FALSE(or 0) otherwise
Select the correct option from the given choices.
a. 38.0
b. 44.0
c. 45.0
d. 53.0
19. What will be the output of the following pseudo code?
Integer a,b,c
Set a=2, b=5, C=9
if((a^b^c)<(b+c+a))
b=5+a
End if
a=8^b
Print a+b+c
Select the correct option from the given choices.
a. 31
b. 36
c. 28
d. 42

20. What will be the output of the following pseudo code?


Integer p,q,r
Set p=2, q=5, r=5
q=1+r
for(each from 2 to 4)
p=p+q
p=10^p
p=(q+9)+q
End for
Print p+q
Select the correct option from the given choices.
a. 22
b. 27
c. 31
d. 43

21. What will be the output of the given pseudo code?


Integer a,b,c
Set a=1, 6=2, c=6
a=(10+12)+b
if((b&a)<c || (b&c)<a)
b=1+b
if(2<a)
b=(8&12)+c
End if
End If
Print a+b+c
Note- &: bitwise AND- The bitwise AND operator (&) compares each bit of the first operand to
the corresponding bit of the second operand. If both bits are 1, the corresponding result bit is set
to 1. Otherwise. the corresponding result bit is set to 0.
Logical OR-The logical OR operator (11) returns the Boolean value TRUE (or 1) if either or
both operands is/are TRUE and returns FALSE (or 0) otherwise.
Select the correct option from the given choices.
a. 38.0
b. 44.0
c. 45.0
d. 53.0

22. What will be the output of the following pseudo code?


Integer p,q,r
Set p=4, q=8, r=6
if((p+r)>(q-p))
q=(q+7)+q
if((4+q^p)<(7+p+r))
p=(q^p)^r
Else
r=5+q
End If
End if
Print p+q+r
Select the correct option from the given choices.
a. 50
b. 59
c. 55
d. 63

23. What will be the output of the following pseudo code?


Integer p,q,r
Set p=1, q=8, r=9
q=(11+9)&q
p=q+q
Print p+q+r
Select the correct option from the given choices.
a. 6
b. 9
c. 13
d. 24
24. What is the output of the following pseudocode?
result = (5 *2) + (10/2)-3
print(result)
Select the correct answer from the given choices.
a. 10
b. 12
c. 9
d. 14

25. What is the output of the following pseudocode?


function multiply(a, b)
return a*b*25
print(multiply(4, 5))
Select the correct answer from the given choices
a. 250
b. 500
c. 20
d. 10

26. What will be the output of the following pseudo code?


Integer p,q,r
Set p=9, q=4, r=6
for(each r from 3 to 4)
p=(r^3)^p
End for
P=(p+q)^p
Print p+q
Select the correct option from the given choices.
a. 29
b. 34
c. 32
d. 41

27. What will be the output of the following pseudo code for a=4, b=5, c=6?
Integer funn(Integer a, Integer b, Integer c)
if((c+b)<(b-c) && 6>a)
if((c+a+b)<(5+b+9))
c=(a+3)+b
End if
C=a+a
End If
B=(c+10)+a
return a+b+c
Select the correct option from the given choices.
a. 28
b. 32
c. 30
d. 39

28. What will be the output of the following pseudo code?


Integer p,q,r
Set p=1, q=6, г=7
if((r^q) <q)
p=(q^3)&r
End If
R=r+p
Print p+q+r
Select the correct option from the given choices.
a. 19
b. 24
c. 23
d. 29

29. What will be the output of the following pseudo code?


Integer a,b,c
Set a=2, b=5, C=9
if((a^b^c)<(b+c+a))
b=5+a
End if
a=8^b
Print a+b+c
Select the correct option from the given choices.
a 31
b 36
c 28
d 42

30. What will be the output of the following pseudo code?


Integer p,q,r
Set p=1, q=8, г=9
q=(11+9)&q
p=q+q
Print p+g+r
Select the correct option from the given choices.
a 6
b 9
c 13
d 24

31. What will be the output of the following pseudo code?


Integer pp,qq,rr
Set pp=4, qq=6, rr=9
if((1^6)<pp)
qq-(5&3)^rr
rr=(pp+pp)+pp
End if
Print pp+qq+rr
Select the correct option from the given choices.
a 33
b 28
c 12
d 19

32. What will be the output of the following pseudo code?


Integer a,b,c
Set a=3, b=8, C=6
C=a+c
if((c+a)<(6-c))
b-(1&10)+c
Else
b=(c+c)+c
if((7&a&b)<(a&b&7))
c=(b+c)+c
End if
End if
Print a+b+c
Select the correct option from the given choices
a 39
b 40
c 37
d 51
33. What will be the output of the following pseudo code?
Integer p.4,
Set p=2, q=5, r=5
Q=1+r
for(each r from 2 to 4)
p=p+q
p=10^p
p=(q+9)+q
End for
Print p+q
Select the correct option from the given choices.
a 22
b 27
c 31
d 43

34. What will be the output of the given pseudo code?


Integer a,b,c
Set a=1, b=2, c=6
a=(10+12)+b
if((bla)<c || (b&c)ca)
if(2<a)
b=(8&12)+c
End if
End If
Print a+b+c
Note- &: bitwise AND - The bitwise AND operator (&) compares each bit of the first operand to
the corresponding bit of the second operand. If both bits are 1, the corresponding result bit is set
to 1. Otherwise the corresponding result bit is set to 0.
Logical OR-The logical OR operator (1) returns the Boolean value TRUE (or 1) if either or both
operands is/are TRUE and returns FALSE(or 0) otherwise.
Select the correct option from the given choices.
a 28.0
b 44.0
c 45.0
d 53.0
35. What will be the output of the following pseudo code?
Integer p,q,r
Set p=4, q=s, r=6
if((p+r)>(q-p))
q=(q+7)+q
if((4+q^p)<(7+p+r))
p=(q^p)^r
Else
r=5+q
End if
End if
Print p+q+r
Select the correct option from the given choices.
a 50
b 59
c 55
d 63

36. What will be the output of the following pseudo code for a=1, b=6 c=7?
Integer funn(Integer a, Integer b, Integer c)
if((a+8+c)<(6+a))
a=(a+b)+b
if((a+b+c)<(b+c+a))
a=c+c
Else
c=(c+a)+b
End if
c=7+b
End If
return a+b+c
Select the correct option from the given choices.
a 14
b 20
c 9
d 24
37. What will be the output of the following pseudo code for a = 5, b = 8, c = 6 ?
Integer funn(Integer a, Integer b, Integer c)
If((2 + c) < (a + 2))
a = (a + c) + c
Else
If((b + c) < (10 - b))
c=c+a
c = (1 + 4) + c
End if
b = (9 + 9) + c
End if
Print a+b+c
Select the correct option from the given choices.
a) 30
b) 39
c) 35
d) 43

38. What will be the output of the following pseudo code for a = 8, b=7, c=7?
Integer funn(Integer a, Integer b, Integer c)
if((3 + c + b) < (c + b + 3))
c=b+a
if((c + b) < (a + c))
if( (b + c + a) < (c + a + b) )
c = (12 + 1) + a
End if
End if
a=(a + a)+a
End if
Print a+b+c
Select the correct option from the given choices
a) 19
b) 22
c) 26
d) 37

39. What will be the output of the following pseudo code?


Integer a,b,c
Set a =4, b = 4, c = 4
b=a + a
if((a + b) > (c - a) && a<b)
if((b + c) < c)
c = (c + b) + c
End if
c = (c + a) + b
End if
Print a + b + c
Select the correct option from the given choices.
a) 25
b) 28
c) 29
d) 46
40. What will be the output of the depicted pseudo code for a = 9, b = 5, and c = 4?
Integer funn(Integer a, Integer b, Integer c)
a = (b + 6) + b
if((a + b) < c || (b+7)<a)
b = (a + b) + a
if((b + a) < (c - b))
a = (1 + 1) + c
End if
End If
return a+b+c
Note- ||: Logical OR-The logical OR operator (||) retums the Boolean value TRUE (or 1) if either
or both operands is/are TRUE and returns FALSE (or 0) otherwise.
Select the correct option from the given choices.
a) 50
b) 57
c) 59
d) 70

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy