# 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

Once you attempt the question then PrepInsta explanation will be displayed.

#### PrepInsta User

2n+4

Start

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

Once you attempt the question then PrepInsta explanation will be displayed.

Start

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

Once you attempt the question then PrepInsta explanation will be displayed.

#### PrepInsta User

m=9, n=6 m=9+1 =10 N=6-1 =5 m=10+5 =15 if(15>6) print 15 else print 6 so the answer is 15

#### PrepInsta User

option D is correct First the m=9, n=6 then the statement is m=m+1 that is 9+1=10 then the statement is n=n-1 that is 6-1=5 then m=m+n-> 10+5=15 then the if statement if true that is (m>.n) = 15>5; true. so print m, that is 15.

Start

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

Once you attempt the question then PrepInsta explanation will be displayed.

Start

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

Once you attempt the question then PrepInsta explanation will be displayed.

Start

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

Once you attempt the question then PrepInsta explanation will be displayed.

Start

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

Once you attempt the question then PrepInsta explanation will be displayed.

Start

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

Once you attempt the question then PrepInsta explanation will be displayed.

Start

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

Once you attempt the question then PrepInsta explanation will be displayed.

#### PrepInsta User

Post order Traversal : LEFT> RIGHT >ROOT

Start

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

Once you attempt the question then PrepInsta explanation will be displayed.

Start

["0","40","60","80","100"]
["Need more practice!","Keep trying!","Not bad!","Good work!","Perfect!"]

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

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 Assurance

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.

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

• Pranavan B

Thanks to Prepinsta for providing the mock test

• PrepInsta Support

Hey,You’re most welcome<3

• PRIYANKA

Thanks…for mock test….nice

• DHRUBAJYOTI

Thanks for AI based calculation platform. It is good way to practice questions with specific time.

• 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

• HelpPrepInsta

Hey Sourav, we are experiencing a small bug in our analytics section, our technical team is resolving it, it will be updated in a day or two