Capgemini Pseudo Code Questions Quiz-1

Question 1

Time: 00:00:00
What will be the space required for this piece of code?

int sum (int B[], int n)
{
int s = 0, j;
for (j = 0; j < n; j++)
s = s + B[i];
return s;
}// sizeof(int) = 2 bytes

2n + 8

2n + 8

2n + 4

2n + 4

2n + 2

2n + 2

2n

2n

Question 2

Time: 00:00:00
What will be the output of the following pseudo code?

For input e = 7 & f = 8.
work (input e, input f)
If (e < f)
return work (f, e)
elseif (f != 0)
return (e + work (e, f - 1))
else
return 0

72

72

88

88

56

56

65

65

Question 3

Time: 00:00:00
What will be the output of the following pseudo code?

Input p = 9, w = 6 ,
p = p + 1 ;
w = w - 1 ;
p = p + w
if (p > w)
print p
else
print w

6

6

5

5

10

10

15

15

Question 4

Time: 00:00:00
What will be the output of the following pseudo-code?

Input t = 6, h = 9 and set x = 0 
Integer c
if (h > t)
for (c = t; c < h; c = c + 1)
x = x + c
End for loop
print x
else
print error message print x

21

21

15

15

9

9

6

6

Question 5

Time: 00:00:00
What will be the output of the following pseudo code?

integer i
set i=3
do
print i+3
i=i-1
while( i not equals 0)
end while

6 5 4

6 5 4

6 5 6

6 5 6

5 5 5

5 5 5

6 6 6

6 6 6

Question 6

Time: 00:00:00
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

success

success

fail

fail

compilation error

compilation error

None of the mentioned

None of the mentioned

Question 7

Time: 00:00:00
What will be the output of the following pseudocode for a = 2, b = 6?

Integer funn(Integer a, Integer b)
if(a > 0
if(b > 0)
return a + b + funn(a + 1, 0) + funn(a + 2, 0) + funn(a + 3, 0
End if 
End if
return a + b 
End function funn()

17

17

21

21

20

20

8

8

Question 8

Time: 00:00:00
What will be the output of the following pseudocode?

Integer count
for (each count from 0 to 9)
print "#"
if (count > 6)
CONTINUE 
print count 
End for

#0#1#1#2#3#4#5#

#0#1#1#2#3#4#5#

0#1#1#2#3#4#5#6##

0#1#1#2#3#4#5#6##

#0#1#2#3#4#5#6

#0#1#2#3#4#5#6

#0#1#1#2#3#4#5#6#7#8#9#10

#0#1#1#2#3#4#5#6#7#8#9#10

Question 9

Time: 00:00:00
What does the following piece of code do?

public void func (Tree root)
{
func (root.left ());
func (root.right ());
System.out.println (root.data ());
}

Preorder traversal

Preorder traversal

Inorder traversal

Inorder traversal

Postorder traversal

Postorder traversal

Level order traversal

Level order traversal

Question 10

Time: 00:00:00
Tree is a binary search tree. Which of the following code will help us to find the minimum element of Tree?

a) public void min (Tree root)
{
while (root.left () != null)
{
root = root.left ();
}
System.out.println (root.data ());
}



b) public void min (Tree root)
{
while (root != null)
{
root = root.left ();
}
System.out.println (root.data ());
}



c) public void min (Tree root)
{
while (root.right () != null)
{
root = root.right ();
}
System.out.println (root.data ());
}



d) public void min (Tree root)
{
while (root != null)
{
root = root.right ();
}
System.out.println (root.data ());
}

a

a

b

b

c

c

d

d

null
null

Personalized Analytics only Availble for Logged in users

Analytics below shows your performance in various Mocks on PrepInsta

Your average Analytics for this Quiz

Rank

-

Percentile

0%

Get over 200+ Courses under One Subscription

mute

Don’t settle Learn from the Best with PrepInsta Prime Subscription

Learn from Top 1%

One Subscription, For Everything

The new cool way of learning and upskilling -

Limitless Learning

One Subscription access everything

Job Assistance

Get Access to PrepInsta Prime

Top Faculty

from FAANG/IITs/TOP MNC's

Get over 200+ course One Subscription

Courses like AI/ML, Cloud Computing, Ethical Hacking, C, C++, Java, Python, DSA (All Languages), Competitive Coding (All Languages), TCS, Infosys, Wipro, Amazon, DBMS, SQL and others.

Comments

30 comments on “Capgemini Pseudo Code Questions Quiz-1”


  • Sourav

    In the homepage of prime mock – Capgemini, it shows 0/100 completed in the first pseudocode mock. But I completed 10 questions in that. I wish to get the next 90 questions. Also, it doesnt get updated in the counter that I have completed 10 questions. It shows that I have not solved any questions (0/100). it is not sowing or giving me any button to go for next 90