You are on page 1of 63

Capgemini Complete Study Materials by Pappu Career Guide

https://www.youtube.com/PappuCareerGuide

Capgemini Exam All 4 Complete


Study Materials (Pseudo Code* &
Game Based) Drive Link Update*
Exam Pattern & Syllabus With Free
Study Materials by Pappu Career
Guide

Game - based Aptitude Test Questions

Capgemini Questions on Game based


Aptitude Test

Capgemini has changed its hiring pattern and its new section game based
Aptitude Test has 4 Aptitude based games to be played, these games are
randomly selected from 24 games present in the system. The following are some
Games asked in Capgemini test previously
1. Deductive Logical Thinking(Geo-Sudo)
2. Inductive-logical Thinking
3. Grid Challenge
4. Motion Challenge
5. Switch Challenge
6. Digit Challenge
Capgemini Complete Study Materials by Pappu Career Guide
https://www.youtube.com/PappuCareerGuide

There are 18 more such games in Capgemini Game Based Aptitude Test.

For Learning and Explaination :- Click Here

Capgemini Recruitment Game Based Aptitude: Questions and Answers

Here are some questions and answers that will help you understand how the Game Based
Aptitude Test works.

According to New Pattern Phase3


Q1. Identify the order of rearrangement .

Answer: 3241

Explanation:
Capgemini Complete Study Materials by Pappu Career Guide
https://www.youtube.com/PappuCareerGuide
From the given row,

Position 1 is occupied by a square

Position 2 is occupied by a triangle

Position 3 is occupied by a plus sign

Position 4 is occupied by a circle

In the final row, the order is plus sign, triangle, circle, square which can be translated as 3241.
Q2. Pick the one that doesn’t fit the group.

th
Answer: (V figure)

Explanation:

In the given series of IX figures (say I to IX), each figure contains 5 horizontal lines (say 1 to 5).
Exactly one of the lines is broken in the order of 1, 2, 3, 4, 5, 4, 3,2, 1 from figures I to IX
th
respectively. But this order is missed in the V figure. Hence is the odd man.
Q3. Pick the one that doesn’t fit the group.

rd
Answer: III figure

Explanation:

In each of the given IX figures there are two shapes, out of which, one is shaded and the other is
unshaded. But only in the third figure, the two shapes overlap each other. Hence is the odd man.
Q4. Find the missing part.
Capgemini Complete Study Materials by Pappu Career Guide
https://www.youtube.com/PappuCareerGuide

Answer:

+
Explanation:

Each row/ column should have all the four shapes (triangle, plus sign, square, circle).

If we consider column 4, grid 14 should be occupied by a circle. So, the grid 13 will be occupied
by a plus sign.
Q5. Enter the unique digits that satisfy the given equation.
Capgemini Complete Study Materials by Pappu Career Guide
https://www.youtube.com/PappuCareerGuide

Answer: 3 × 4 + 8 = 20
Q6 . Choose Correct Answer?
Capgemini Complete Study Materials by Pappu Career Guide
https://www.youtube.com/PappuCareerGuide

Answer.

Explanation:

Rule followed by grids given in the question: Row 1 and Row 3 are identical.

Q7. Identify the pattern in which the question grids are coloured and following the same pattern
colour the given grids.
Capgemini Complete Study Materials by Pappu Career Guide
https://www.youtube.com/PappuCareerGuide

Answer:

Explanation:

The grids with 4 ‘Z’s are coloured yellow and the remaining grids are coloured black.

Q8.
Capgemini Complete Study Materials by Pappu Career Guide
https://www.youtube.com/PappuCareerGuide

Answer: 3241

Explanation:

From the given row,

Position 1 is occupied by a plus sign

Position 2 is occupied by a circle

Position 3 is occupied by a triangle

Position 4 is occupied by a rhombus

After the operator 4312 the order changes as: Rhombus, Triangle, Plus sign, Circle

From this order to get the given final order of Plus sign, Triangle, Circle, Rhombus, the required
operator is 3241.
Q9. Move the red ball to the hole (marked black) in the given grid.
Capgemini Complete Study Materials by Pappu Career Guide
https://www.youtube.com/PappuCareerGuide

Answer & Explanation:


The required moves are:

i) Blue block – 1 position upward

ii) Purple block – 1 position leftward and 1 position upward

iii) Breen block – 1 position upward and 1 position leftward

After these movements, the grid changes as:

Now, the red ball can be taken to the destination without obstacles.
Capgemini Complete Study Materials by Pappu Career Guide
https://www.youtube.com/PappuCareerGuide

Q10. Enter the unique digits that satisfy the given equation.
Capgemini Complete Study Materials by Pappu Career Guide
https://www.youtube.com/PappuCareerGuide

Answer: 3 × 8 + 6 = 30
Q11. Remember the order in which the dots appear on a grid. In between the grids some
questions are to be answered whether the given pictures are symmetrical or not. At last the dots
are to be marked as per the order.
Capgemini Complete Study Materials by Pappu Career Guide
https://www.youtube.com/PappuCareerGuide

Q12. Pick the one that doesn’t fit the group.

Answer: 5th group

+++
Capgemini Complete Study Materials by Pappu Career Guide
https://www.youtube.com/PappuCareerGuide

+++

Explanation:

From the right end, the number of plus signs inside a box increases by 1 in each consecutive
figures. But the order is missed at the fifth figure and hence is the odd one.
Q13. Identify the pattern in which the question grids are coloured and following the same pattern
colour the given grids.

Answer:

Explanation:

The grids with only numbers are marked grey while the grids with both numbers and alphabets
are marked green.
Capgemini Complete Study Materials by Pappu Career Guide
https://www.youtube.com/PappuCareerGuide

Q14. Find the missing part

Answer:
Triangle

Explanation:
Capgemini Complete Study Materials by Pappu Career Guide
https://www.youtube.com/PappuCareerGuide
To find the part to be filled on grid 12, let us first consider other grids related to it.

Grid 51 – Square;

Grid 21 – Triangle;

Grid 11 – Circle;

Grid 45 – Triangle;

Grid 15 – Star;

So, grid 12 will be occupied by a triangle.

(As a triangle can’t be fitted on grid 13 or 14)


Q15. Find the missing part.

Answer:

5th image

Explanation:
Capgemini Complete Study Materials by Pappu Career Guide
https://www.youtube.com/PappuCareerGuide
Each row and column should have exactly one cross mark. As the pattern already exists on the
question figure, the missing part should not contain any cross marks.
Deductive Logical Thinking (Geo-Sudo Challenge)

Rules to Solve
Problem Statement: You’re given a 4×4 or 5×5 or 6×6 grid. You’re supposed to find the missing value
based on some rules

Decoding Rules
Capgemini Complete Study Materials by Pappu Career Guide
https://www.youtube.com/PappuCareerGuide

 One geometrical shape can only occur once, in any row or any column

Marking: (PrepInsta’s Secret Sauce)

 Everytime you solve a problem correctly you level up.


 In each level the difficulty of the problem increases.
 To reward users, each level has a higher marking scheme as given below –
 We are testing users, visual reasoning, decoding, problem solving skills
 The above test is ideal for jobs that require solving complex problems : Engineers, Finance,
Accounts, HR, Software etc

Marking Scheme

 Level Rewards = (Current-Level)2/(Time taken at Level)


 Total Rewards = Σ (Rewards at each level)
Capgemini Complete Study Materials by Pappu Career Guide
https://www.youtube.com/PappuCareerGuide
Capgemini Complete Study Materials by Pappu Career Guide
https://www.youtube.com/PappuCareerGuide
Capgemini Complete Study Materials by Pappu Career Guide
https://www.youtube.com/PappuCareerGuide
Digit Challenge

Rules to Solve

Problem Statement: You’re giving a mathematical statement and you need to create a correct
combination of digits, to make LHS = RHS. Note : One Digit may only be used once, in some cases
the all the digits may not be available.

Marking: (PrepInsta’s Secret Sauce)

 Everytime you solve a problem correctly you level up.


 In each level the difficulty of the problem increases.
 To reward users, each level has a higher marking scheme as given below –
 We are testing users, visual reasoning, decoding, problem solving skills
 The above test is ideal for jobs that require solving complex problems : Engineers, Finance,
Accounts, HR, Software etc

Marking Scheme

 Level Rewards = (Current-Level)2/(Time taken at Level)


 Total Rewards = Σ (Rewards at each level)
Capgemini Complete Study Materials by Pappu Career Guide
https://www.youtube.com/PappuCareerGuide
Capgemini Complete Study Materials by Pappu Career Guide
https://www.youtube.com/PappuCareerGuide
Play Digit Challenge

Motion Challenge
Capgemini Complete Study Materials by Pappu Career Guide
https://www.youtube.com/PappuCareerGuide
Rules to Solve
Problem Statement: You’re a Jim, you love to solve puzzles, your challenge is to put the red ball into
the hole, but hey, there are obstacles, some are plastic obstacles that you can move, some are hard
rocks, you can’t move them. Try to do this in minimum number of steps to earn candy.

Marking: (PrepInsta’s Secret Sauce)

 Note – You can move plastic blocks, over the black whole
 Everytime you solve a maze correctly you level up.
 In each level the difficulty of the problem increases.
 To reward users, each level has a higher marking scheme as given below –
 We are testing users, visual reasoning, decoding, problem solving skills
 The above test is ideal for jobs that require solving complex problems : Engineers, Finance,
Accounts, HR, Software etc

Marking Scheme

 Level Rewards = (Current-Level + X)2/(Time taken at Level)


 X = (Min possible moves)/(Moves taken by candidate)
 Total Rewards = Σ (Rewards at each level)
Capgemini Complete Study Materials by Pappu Career Guide
https://www.youtube.com/PappuCareerGuide
Capgemini Complete Study Materials by Pappu Career Guide
https://www.youtube.com/PappuCareerGuide
Grid Challenge

Rules to Solve

Problem Statement: You’re Shakuntala Devi, and you are good with memory, you will need to do 2
tasks simultaneously, you will be shown a grid with many coordinates, with one highlighted then two
figures.

 You need to remember the highlighted grid position


 Simultaneously, mark if the next two shown figures are symmetrical or not
 At the end you need to mark all the highlighted grid in last slide

Marking: (PrepInsta’s Secret Sauce)


Capgemini Complete Study Materials by Pappu Career Guide
https://www.youtube.com/PappuCareerGuide

 Everytime you solve a challenge correctly you level up.


 In each level the difficulty of the problem increases.
 To reward users, each level has a higher marking scheme as given below –
 We are testing users, visual reasoning, decoding, problem solving skills
 The above test is ideal for jobs that require solving complex problems : Engineers, Finance,
Accounts, HR, Software etc

Marking Scheme

 Level Rewards = (Current-Level)2/(Time taken at Level) + Correct number of symmetry


marked
 Total Rewards = Σ (Rewards at each level)
Capgemini Complete Study Materials by Pappu Career Guide
https://www.youtube.com/PappuCareerGuide
Capgemini Complete Study Materials by Pappu Career Guide
https://www.youtube.com/PappuCareerGuide
Inductive Logical Reasoning

Rules to Solve

Problem Statement: You will be show a few figures your job, is to mark image/images that don’t fit
the rule logically.

Marking: (PrepInsta’s Secret Sauce)

 Everytime you solve a challenge correctly you level up.


 In each level the difficulty of the problem increases.
 To reward users, each level has a higher marking scheme as given below –
 We are testing users, visual reasoning, decoding, problem solving skills
 The above test is ideal for jobs that require solving complex problems : Engineers, Finance,
Accounts, HR, Software etc

Marking Scheme

 Level Rewards = (Current-Level)2/(Time taken at Level)


 Total Rewards = Σ (Rewards at each level)
Capgemini Complete Study Materials by Pappu Career Guide
https://www.youtube.com/PappuCareerGuide
Capgemini Complete Study Materials by Pappu Career Guide
https://www.youtube.com/PappuCareerGuide
Play Inductive Logical Reasoning

Follow the same rule Challenge


Capgemini Complete Study Materials by Pappu Career Guide
https://www.youtube.com/PappuCareerGuide
Rules to Solve
Problem Statement: You will be shown a few figures, your job is to mark other set of image/images
that fit the same rules

Marking: (PrepInsta’s Secret Sauce)

 Everytime you solve a challenge correctly you level up.


 In each level the difficulty of the problem increases.
 To reward users, each level has a higher marking scheme as given below –
 We are testing users, visual reasoning, decoding, problem solving skills
 The above test is ideal for jobs that require solving complex problems : Engineers, Finance,
Accounts, HR, Software etc

Marking Scheme

 Level Rewards = (Current-Level)2/(Time taken at Level)


 Total Rewards = Σ (Rewards at each level)
Capgemini Complete Study Materials by Pappu Career Guide
https://www.youtube.com/PappuCareerGuide
Color the Grid Challenge

Rules to Solve
Problem Statement:

 In the first section you will see 6 tables, having a combination of numbers, alphabets and
colors
 In the second section, 4 other tables, which needs to be assigned color. Based on rules that
you observed in the above 6 tables.

Marking: (PrepInsta’s Secret Sauce)

 Everytime you solve a challenge correctly you level up.


 In each level the difficulty of the problem increases.
 To reward users, each level has a higher marking scheme as given below –
 We are testing users, visual reasoning, decoding, problem solving skills
Capgemini Complete Study Materials by Pappu Career Guide
https://www.youtube.com/PappuCareerGuide

 The above test is ideal for jobs that require solving complex problems : Engineers, Finance,
Accounts, HR, Software etc

Marking Scheme

 Level Rewards = (Current-Level)2/(Time taken at Level)


 Total Rewards = Σ (Rewards at each level)

Capgemini Recruitment | Game Based


Aptitude Questions

Capgemini Pseudo Code Online Test Questions and


Answers

Here is the sample pseudo questions asked in placement drive:

Question: Point out the error in the program?

#include<stdio.h>
int main()
{
char ch;
int i;
scanf("%c", &i);
scanf("%d", &ch);
printf("%c %d", ch, i);
return 0;
}
Error: suspicious char to in conversion in scanf()
Error: we may not get input for second scanf() statement
No error
None of above

Question: Consider the following iterative implementation to find the factorial of a number:
int main()
{
int n = 6, i;
int fact = 1;
for(i=1;i<=n;i++)
_________;
printf("%d",fact);
Capgemini Complete Study Materials by Pappu Career Guide
https://www.youtube.com/PappuCareerGuide
return 0;
}
Which of the following lines should be inserted to complete the above code?
fact = fact + i
fact = fact * i
i = i * fact
i = i + fact

Question: What is the output of this C code?


#include <stdio.h>
int main()
{
int i=12;
int *p =&i;
printf(“%d\n”,*p++);
}
Address of i++
12
Garbage value
Address of i

Question: Convert the following 211 decimal number to 8-bit binary?


11011011
11001011
11010011
11010011

Question: A NAND gate has:


LOW inputs and a HIGH output
LOW inputs and a LOW output
HIGH inputs and a HIGH output
None of these

Question: Comment on the output of this C code?


#include <stdio.h>
int main()
{
int a = 1;
switch (a)
case 1:
printf("%d", a);
case 2:
printf("%d", a);
case 3:
printf("%d", a);
default:
printf("%d", a);
Capgemini Complete Study Materials by Pappu Career Guide
https://www.youtube.com/PappuCareerGuide
}

No error, output is 1111


No error, output is 1
Compile time error, no break statements
Compile time error, case label outside switch statement

Question: How will you find the maximum element in a binary search tree?
a)
public void max(Tree root)
{
while(root.left() != null)
{
root = root.left();
}
System.out.println(root.data());
}

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

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

d)
public void max(Tree root)
{
while(root != null)
{
root = root.right();
}
System.out.println(root.data());
Capgemini Complete Study Materials by Pappu Career Guide
https://www.youtube.com/PappuCareerGuide
}

Question: What is the output of the following code?


void my_recursive_function(int n)
{
if(n == 0)
return;
printf("%d ",n);
my_recursive_function(n-1);
}
int main()
{
my_recursive_function(10);
return 0;
}

10
1
10 9 8 … 1 0
10 9 8 … 1

Capgemini Pseudo code Questions and


Answers

What is the output of the code given below? Now, let us take up a small test.

1#include <stdio.h>
2int main()
3{
4 char ch = 'A';
5 printf("%d\n", ch);
6 return 0;
7}

1. A
Capgemini Complete Study Materials by Pappu Career Guide
https://www.youtube.com/PappuCareerGuide

2. 'A'
3. 65
4. 97

Solution: The output of this code snippet might have been A if the format specifier mentioned in the
print statement would be character format specifier - '%c'. But since the format specifier is integer
format specifier - '%d', the ASCII code character A which is 65 is retrieved as the output. A

Writing code all starts with knowing the coding constructs. The basic coding constructs of any
programming language are data types. You might be tested on knowing more about the data types
and the qualifiers not used frequently. You may come across a question of this kind.

Which of the following is not a valid declaration in C?

1.short int x;

2.signed short x;

3.short x;

4.unsigned short x;

1. 3 and 4
2. 1
3. 2
4. All are valid

Solution:All are valid. First 3 mean the same thing. 4th means unsigned.

Expression Evaluation is the favorite question to test your knowledge about combinations of
different mathematical operators.

What will be the output of the following code snippet?

1#include <stdio.h>
2int foo(int* a, int* b)
3{
4 int sum = *a + *b;

5 *b = *a;
6 return *a = sum - *b;

7}
8int main()
Capgemini Complete Study Materials by Pappu Career Guide
https://www.youtube.com/PappuCareerGuide
9{
10 int i = 0, j = 1, k = 2, l;

11 l = i++ || foo(&j, &k);


12 printf("%d %d %d %d", i, j, k, l);

13 return 0;

14}

1. 1 2 1 1
2. 1 1 2 1
3. 1 2 2 1
4. 1 2 2 2

Solution: The control in the logical OR goes to the second expression only if the first expression
results in FALSE. The function foo() is called because i++ returns 0(post-increment) after
incrementing the value of i to 1. The foo() function actually swaps the values of two variables and
returns the value of the second parameter. So, values of variables j and k get exchanged and OR
expression evaluates to be TRUE.1 2 1 1

Enroll for Free Online CRT Course - Online Classes - Practice Question

Looping constructs and Branching statements of a programming language is an integral part of


programming language. You might be asked to retrieve the output of any code snippet using loops
like for loop, while loop and do-while loop involving some conditions using branching statements.
Let us give a glance over a question of this kind.

What is correct about the below program?

1#include <stdio.h>
2int i;
3int main()
4{
5 if (i);
6 else
7 printf("Ëlse");
8 return 0;
9}

1. if block is executed.
2. else block is executed
3. It is unpredictable as i is not initialized.
Capgemini Complete Study Materials by Pappu Career Guide
https://www.youtube.com/PappuCareerGuide

4. Error: misplaced else

Solution: Since i is defined globally, it is initialized with default value 0. The else block is executed as
the expression within if evaluates to FALSE. An empty block is equivalent to a semi-colon(;). So the
statements if (i);andif (i) {} are equivalent.

We can divide a large program into the basic building blocks known as a function. The function
contains the set of programming statements enclosed by {}. A function can be called multiple times
to provide reusability and modularity to a program. In other words, we can say that the collection of
functions creates a program.

You can be given a function and ask you the functionality of the function.

Consider the following C function

void swap ( int x, int y )

1{
2 int tmp;

3 tmp = x;
4 x = y;
5 y = tmp;
6}
7

In order to exchange the values of two variables a and b:

1. Call swap (a, b)


2. Call swap (&a, &b)
3. swap(a, b) cannot be used as it does not return any value
4. swap(a, b) cannot be used as the parameters passed by value

Solution: The code will not work because the parameters are passed by value. In order to swap the
values of x and y the parameters should be passed with reference. The correct code is:

void swap ( int &x, int &y )

1{
2 int tmp;

3 tmp = x;
4 x = y;

5 y = tmp;
6}
7

As per the above discussion, you might have got some clarity on the kind of questions that you
might come across in this Capgemini Pseudo Code Online test. Having a quick revision on format
Capgemini Complete Study Materials by Pappu Career Guide
https://www.youtube.com/PappuCareerGuide
specifiers, data types, functions, expression statements, conditional statements, looping constructs
makes facing this section of the Capgemini recruitment process with great aplomb.

Capgemini Pseudo Code MCQs with


Answers| Capgemini Pseudo Code Test
Capgemini Pseudo Code MCQs - Syllabus

The syllabus for Capgemini pseudo code MCQs section is as given below. Questions will be
mostly on these topics only.

 Programming Logic Based MCQs (Pseudocode)


 C
 C++
 Data Structures
 OOPS

Capgemini Pseudo Code MCQs (Latest Questions and Answers)

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

Integer i
Set i = 3
do
print i + 3
i=i-1
while(i not equals 0)
end while

[Note: A do while loop is a control flow statement that executes a block of code at least once, and
then repeatedly executes the given Boolean condition at the end of the block]
Capgemini Complete Study Materials by Pappu Career Guide
https://www.youtube.com/PappuCareerGuide
A) 6 6 6
B) 6 5 6
C) 5 5 5
D) 6 5 4

Ans: D

Explanation:
In this program, one variable declared as i, and value initialized as 3. We are moving with do-
while(Do while will execute the statement once and then it will check the condition).

Step 1:
It will print i+3, here i value is 3. So i+3 is 6. On the next line, i will be decremented by 1. Then
checking the conditions in do-while() i!=0. Here updated i value is 2 (2!=0),so condition is true. The
loop continues.

Step 2:
It will print i+3, here updated i value is 2. So i+3 is 5. On the next line i will be decremented by 1.
Then checking the conditions in do-while() i!=0. Here updated i value is 1 (1!=0),so condition gets
true. The loop continues

Step 3:
It will print i+3, here updated i value is 1. So i+3 is 4. On the next line i will be decremented by 1.
Then checking the condition in do while() i!=0. Here updated i value is 0 (0!=0),so condition gets
false. Thus the loop gets terminated!

E.g. code to explain this:


Do while will execute the statement for the first time and then it will check the condition.

int i=3;
do{
cout<<i+3; => 3+3 =6 =>2+3 =>5 =>1+3=4
i=i-1; => 3-1=2 =>2-1 =>1 =>1-1=0
}while(i!=0);
Capgemini Complete Study Materials by Pappu Career Guide
https://www.youtube.com/PappuCareerGuide

Q2. What would be the output of the following pseudocode?

Integer a
String str1
Set str1 = “goose”
a = stringLength(str1)
Print (a ^ 1)

[Note- string-length(): string-length() function counts the number of characters in a given string and
return the integer value.
^ is the bitwise exclusive OR operator that compares each bit of its first operand to the
corresponding bit of its equal operand. If one bit is 0 and the other bit is 1, the corresponding result
bit is set to 1. Otherwise, the corresponding result bit is set to 0]

A) 0
B) 4
C) 5
D) 3

Ans: B

Explanation:
There are two variables a and str1. Value initialized for str1 is “goose”. On the next line, we are
finding the length of str1 that is 5. Finally, printing the output of a bitwise exclusive OR operator with
1. And the answer is 4.

E.g. code to explain this:


{
int a;
string str1="goose";
a = str1.length(); => length of String is 5
cout<<(a^1); 5 xor 1 => 4
}
Capgemini Complete Study Materials by Pappu Career Guide
https://www.youtube.com/PappuCareerGuide

Q3. What would be the output of the following pseudocode?

Integer a, b, c
Set a = 8, b = 51, c = 2
c = (a ^ c)^ (a)
b = b mod 4
Print a + b + c

[Note- mod finds the remainder after the division of one number by another. For example, the
expression “5 mod 2” would evaluate to 1 because 5 divided by 2 leaves a quotient of 2 and a
remainder of 1
^ is the bitwise exclusive OR operator that compares each bit of its first operand to the
corresponding bit of its equal operand. If one bit is 0 and the other bit is 1, the corresponding result
bit is set to 1. Otherwise, the corresponding result bit is set to 0]

A. 13
B. 17
C. 26
D. 16

Ans:A

Explanation:
There are three variables a, b and c declared. Value initialized for a is 8, b is 51 and c is 2.
When we do a bitwise exclusive OR of (8^2), the answer is 10. Again 10 bitwise exclusive OR of a
i.e (10 ^ 8) is 2, which will be stored in variable c.
Then taking modulo operation for b by 4 (b%4) the answer is 3
Finally adding all the updated values of a,b, and c (8+2+3 ) and the output of Pseudocode is 13.

E.g. code to explain this:

int main()
{
int a=8,b=51,c=2;
Capgemini Complete Study Materials by Pappu Career Guide
https://www.youtube.com/PappuCareerGuide
c = (a ^ c)^ (a); =>(8^2) ^(8) => 10 ^ 8 => 2
b = b % 4; =>3
cout<<a + b + c; =>8+2+3 => 13
}
Note: ^ is the bitwise exclusive OR

Q4. Consider an array A = {1, 2, 4, 5, 6, 11, 12} and a key which is equal to 10. How many
comparisons would be done to find the key element in the array using the binary search?
A. 5
B. 1
C. 2
D. 3

Ans: D

Explanation:
There is an Integer Array A = {1, 2, 4, 5, 6, 11, 12} and the key value is 10.

Binary search applies only sorted, ordered list.

We know that binary search takes log n base 2 time to search for a particular element.

If there are N elements in the set you have chosen binary search then take log n base 2 time.

1)First, you check how many elements in your array. if an element in your array is greater than 1
then you go for the next step.
2)Binary search divides the problem into two parts using the mean of the total number of an element
which is sorted mean=(0+n)/2
3)And compare the searching element which is either greater the mean or lesser or equal to the
mean .then after comparison skip the one part either greater part or small part depends on the result
or searching is done if the mean is equal to the searching element. So that problem is divide into n/2
and goes until searching is done.
If you apply the recursive equation for the binary search algorithm then
Capgemini Complete Study Materials by Pappu Career Guide
https://www.youtube.com/PappuCareerGuide
T(n)=T(n/2)+1 to solve the problem
n/2^k=1
taking log on both sides
log n=log (2^k)
log n= k log 2
k=log n base 2.
N=7
K=log 7 base 2 = 3
K=3

So, the answer becomes 3.

Q5. What would be the output of the following pseudocode?

Integer i, j, k
Set k = 8
for(each i from 1 to 1)
for(each j from the value of i to 1)
print k+1
end for
end for

A. 2
B. 9
C. 7
D. 8

Ans: B

Explanation:

There are three variables i, j and k declared. Value initialized for k is 8, In this code, we are moving
with nested for loop.
Capgemini Complete Study Materials by Pappu Career Guide
https://www.youtube.com/PappuCareerGuide
Here I value is 1, for loop will check the condition i<=1 condition gets true. Now, moving with inner
for loop j value will be 1 condition gets true j<=1.so, it prints K+1. Then j value will be incremented by
1(2<+1) inner for loop condition gets false.
On the next iteration i value will be incremented by 1, here updated i value is 2 (2<=1) condition get
false. So the answer is 9.

E.g. code to explain this:


int i, j, k;
k = 8;
for(i=1 ;i<=1;i++){ => i=1 True
for(j=i;j<=1;j++){ => j=1 true
cout<< k+1; => print k+1 => 8+1 =>9
}
}

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

Integer a, b
Set a = 15, b = 7
a = a mod (a - 3)
b = b mod (b – 3)
a = a mod 1
b = b mod 1
Print a + b

A) 15
B) 7
C) 2
D) 0

[Note-mod finds the remainder after the division of one number by another. For example, the
expression “5 mod 2” leaves a quotient of 2 and a remainder of 1]
Capgemini Complete Study Materials by Pappu Career Guide
https://www.youtube.com/PappuCareerGuide

Answer: 0

Explanation:
There are two variables a and b declared. Value initialized for a is 15 and b is 7. Taking mod
operation for a by 12(a%12) and the answer is 3 will stored in a.
The next mod operation for b is 7 mod (7%4). The answer is 3 will be stored in b.
The next line takes the updated value of a and mods it by 1(3%1). Then the answer becomes 0 will
be stored in a.
Next line takes the updated value of b mod by 1 (3%1) then the answer is 0. Finally adding all the
updated values of a and b (0+0 ) and the output of Pseudocode is 0.

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

Integer a, b, c
Set b = 5, a = 2, c = 2
if(b>a && a>c && c>b)
b=a+1
Else
a=b+1
End if
Print a + b + c

[Note-&&: Logical AND - The logical AND operator (&&) returns the Boolean value true(or 1) if both
operands--. If (x) gets executed if the value if(), i.e., x is not zero]

A) 2
B) 13
C) 26
D) 5

Ans:B

Explanation:
Capgemini Complete Study Materials by Pappu Career Guide
https://www.youtube.com/PappuCareerGuide
There are three variables a, b and c declared. Value initialized for a is 2, b is 5 and c is 2.
Checking the condition using if, b >a and a>c and c>b here if conditions get false. Now else part will
execute b value will be incremented by 1 and stored in a, Finally adding all the updated values of a,
b and c (6+5+2 ) and the output of Pseudocode is 13.

Q8. For which of the following applications can you use hashing?
1. To construct a message authentication code.
2. For Timestamping
3. For detecting a cycle in a graph
Choose the correct answer from the options given below.

A. Only 1 and 3
B. Only 2 and 3
C. Only 1
D. Only 1 and 2

Ans:D

Explanation:
Constructing a message authentication code and Timestamping are the real-time applications for
hashing.

Q9. Consider an array of float. Calculate the difference between the address of the 1st and 4th
element, assuming float occupies 4 bytes of memory.
A. 16
B. 4
C. 12
D. 8

Ans: C

Explanation:
Let's consider the address of elements:
Capgemini Complete Study Materials by Pappu Career Guide
https://www.youtube.com/PappuCareerGuide
1st element – 1000 - 1003 (4 bytes)
2nd element – 1004 - 1007 (4 bytes)
3rd element – 1008 – 1011 (4 bytes)
4th element - 1012 – 1015 (4 bytes)
The difference between the address of the 1st and 4th element is 12.

Q10. What is the second part of a node in a linked list that contains the address of the next node
called?
A. data
B. pointer
C. element
D. Link

Ans:D

Explanation:
The field of each node that contains the address of the next node is usually called the 'link'.

Q11. If you are using Depth-first search (DFS) for traversing an unweighted graph, then which of the
following will happen?
1. It produces the minimum spanning tree
2. It produces all pair shortest path tree
Choose the correct answer from the options given below.
A. Both 1 and 2 are true
B. Both 1 and 2 are false
C. Only 2 is true
D. Only 1 is true

Ans:D

Explanation:
Depth-first search (DFS) for traversing an unweighted graph, will produce the minimum spanning
tree.
Capgemini Complete Study Materials by Pappu Career Guide
https://www.youtube.com/PappuCareerGuide
Only Depth-first search (DFS) for traversing an weighted graph, will produce all pair shortest-path
tree.

Q12. With the given the information provided find out the address of Arr[17] in a 1-D array Arr[30].
- lower bound = 1
- starting base address = 1100
- size of each element is 2.

A. 1132
B. 1070
C. 1128
D. 1068

Ans: A

Explanation:
We need to find the address of Arr[17]. Starting base address is 1100.
Arr[1] – 1100 (2bytes)
Arr[2] – 1102 (2bytes)
Arr[3] – 1104 (2bytes)
Arr[4] – 1106 (2bytes)
Arr[5] – 1108 (2bytes)
Capgemini Complete Study Materials by Pappu Career Guide
https://www.youtube.com/PappuCareerGuide
Arr[6] – 1110 (2bytes)
Arr[7] – 1112 (2bytes)
Arr[8] – 1114 (2bytes)
Arr[9] – 1116 (2bytes)
Arr[10] – 1118 (2bytes)
Arr[11] – 1120 (2bytes)
Arr[12] – 1122 (2bytes)
Arr[13] – 1124 (2bytes)
Arr[14] – 1126 (2bytes)
Arr[15] – 1128 (2bytes)
Arr[16] – 1130 (2bytes)
Arr[17] – 1132 (2bytes)

Thus, the Answer for arr[17] is 1132

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

Integer arr[]={10, 20, 30, 40, 5}


Integer a, s
Set s = 0
Set a = arr[1] + arr[2]
Print a

A) 25
B) 5
C) 50
D) 40

Ans: C

Explanation:
Capgemini Complete Study Materials by Pappu Career Guide
https://www.youtube.com/PappuCareerGuide
There is an array of integer arr[]={10,20,30,40,50}. There are two variables a and b declared. . The
value initialized for s is 0. On next line adding the 1 st index value 20 and 2nd index value 30 arr[1] +
arr[2]( 20+30) the answer is 50 will be stored in a. Finally printing the updated values of a is 50.

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

Integer a, b, c
Set b = 2, a = 2
c=a^b
Print c

[Note- ^ is the bitwise exclusive OR operator that compares each bits of its first operand to the
corresponding bit of its-- other bit is 1, the corresponding result bit is set to 1. Otherwise, the
corresponding result bit is set to 0]

A) 6
B) 4
C) 0
D) 2

Ans:C

Explanation:

There are three variables a, b and c declared. Value initialized for a is 2 and b is 2. When we do a
bitwise exclusive OR of c i.e (2^2), the answer is 0. Finally, print the value of c.

Q15. Which of the following series will be printed by the given pseudocode?

Integer i, j, k, n
Set j=1, k=1
for(each i from 1 to 5)
print k
Capgemini Complete Study Materials by Pappu Career Guide
https://www.youtube.com/PappuCareerGuide
j=j+1
k=k+j
end for

A) 1 3 6 10 15
B) 1 2 3 4 5
C) 2 4 6 8 10
D) 1 1 2 3 5

Ans:A

Explanation:
There are four variables i, j,k and n declared. Value initialized for j is 1 and k is 1.
For loop, i value starts from 1 loop will run till the i<5, In the first iteration i value, is 1, printing k value
is 1. Next line j value will be incremented by 1 (1+1) =>2. On the next line adding k and j (1+2), then
the answer is 3.
2nd iteration i value will be incremented by 1, i=2. Print k, the updated k value is 3. on the next line j
value will be incremented by 1 (2+1) =>3. On the next line adding k and j (3+3) , then the answer is
6.
3rd iteration i value will be incremented by 1, i=3. Print k, the updated k value is 6. on the next line j
value will be incremented by 1 (3+1) =>4. On the next line adding k and j (6+4) , then the answer is
10.
4th iteration i value will be incremented by 1, i=4. Print k, the updated k value is 10. on the next line j
value will be incremented by 1 (4+1) =>5. On the next line adding k and j (10+5) , then the answer is
15.
5th iteration i value will be incremented by 1, i=5. Print k, the updated k value is 15. Next line j value
will be incremented by 1 (5+1) =>6. On the next line adding k and j (15+6), then the answer is 21.
Here for loop condition gets false, it comes out of the for loop. The output of Pseudocode is 1 3 6 10
15.

Capgemini Pseudo Code MCQs (previously asked)

Question 1:
Find the output of the following pseudo-code:
Integer x,y,z;
x=0
Capgemini Complete Study Materials by Pappu Career Guide
https://www.youtube.com/PappuCareerGuide
y=1
x=y=z=8
Print x

Options:
A) 0
B) 8
C) 1
D) None of the above

Correct answer: Option B


Explanation: In this question, the value of x is initialized as 0 and y as 1 in the beginning. Later the
value 8 is assigned to the variable z and the value of z is assigned to the variable y and the value of
y is assigned to the variable x. Finally, the value of x is updated as 8.

Question 2:
Find the output of the following pseudo-code:

Integer value, n
Set value = 1, n = 45
while(value less than equal to n)
value = value << 1
end loop
Print value

Options:
A) 64
B) 32
C) 45
D) None of the above

Correct answer: Option A


Explanation: Here, the left shift operation pushes the values towards the left once; when 1 is left
shifted the value what we will be obtaining will always be 2 to the power something. When one is
converted in the beginning and not shifted the value will be 2^0 which is 1. Next iteration it will be
Capgemini Complete Study Materials by Pappu Career Guide
https://www.youtube.com/PappuCareerGuide
pushed one place towards the left, therefore the value now will be 2^1 which is 2 ; this will go on
happening until the value stored is greater than 45 . The value which is greater than 45 in 2 powers
is 64. Now the loop terminates and the last value stored in the variable is 64 and the same will be
printed.

Question 3:
Find the output of the following pseudo-code:
Integer c, d
Set c = 15, d = 12
d=c–1
Print c //line
c = d + (c – 2)
if(c < 40)
Goto line
end if

Options:
A) 14 26 38
B) 27 39
C) 15 27 39
D) None of the above

Correct answer: Option C


Explanation: c and a is initialised, and d as well; line 5 we are re-initialzing c in every iteration of
goto; the goto loop terminates only when the value of c is greater than 40 the last value stored in c
which breaks the if condition is 51 and all the numbers 15 27 and 39 will be printed according to the
algebraic expression in line number 5.

Question 4:
Find the output of the following pseudo-code if x= 4 and y=5:
Integer fun(int x, int y)
if(x > 1)
fun(x – 2, y + 2)
end if
print y
End function fun()
Capgemini Complete Study Materials by Pappu Career Guide
https://www.youtube.com/PappuCareerGuide

Options:
A) 4 5 6
B) 7 6 5
C) 9 7 5
D) None of the above

Correct answer: Option C


Explanation: the first reverse recursion would print 9 and returns to previous function call, next it
prints 7 and returns to very first function call finally it prints a 5 and complets the execution.
Question 5:
How many times will the print statement be executed:
Integer a, b, c
Set a = 8, b = 10, c = 6
If(a > c AND (b + c) > a)
Print a
end if
if(c > b OR (a + c) > b)
Print b
end if
if((b+c) MOD a EQUALS 0)
Print c
end if

Options:
A) 2
B) 3
C) 1
D) 0

Correct answer: Option B


Explanation: All the conditions are true when checked with the condition so the print statement will
be executed 3 times.
Capgemini Complete Study Materials by Pappu Career Guide
https://www.youtube.com/PappuCareerGuide
Question 6:
What will be the output if the following pseudocode if a=10 and b=6:
Integer func (Integer a, Integer b)
Integer temp
while(b)
temp = a MOD b
a=b
b = temp
end while
return a
End function func()

Options:
A) 2
B) 4
C) 3
D) 1

Correct answer: Option A


Explanation: The while loop will only terminate when the value of b becomes zero, this will happen
only after the 4th iteration when the last value of the b will be zero and value of a is 2

Question 7:
What will be the output of the following pseudo code?
Integer x, y, z
Set x=24, y=8
x = x/y
z = y<<x
Print z
[Note: << is left shift operator, it takes two numbers, left shifts the bits of the first operand, the
second operand decodes the number of …]

Options:
A) 1
Capgemini Complete Study Materials by Pappu Career Guide
https://www.youtube.com/PappuCareerGuide
B) 8
C) 0
D) 64

Correct answer: Option D


Explanation: When the x is reinitialised in line 3 the value stored will be 3. Therefore 8 has to be
left shifted thrice. The shifted value is the 3rd next power of 2 that is 2^6 and the value is 64.

Question 8:
What will be the output of the following pseudocode?
Integer x, y, z, a
Set x = 2, y = 1, z = 5
a = (x AND y) OR (z + 1)
Print a

Options:
A) 5
B) 3
C) 2
D) 1

Correct answer: Option D


Explanation: AND gate works when both the conditions are true so the first (x and y) condition will
be taken as true as the both the inputs are true. OR gate works when any of the conditions are true,
where it has already got one of its input as true so without checking the other input it will directly
assign the value as 1.

Question 09:
What will be the output of the following pseudocode?
Integer a=5, b=4, c=3
a=b+c
c=a–b
c=c+a
c=b+c
b=b+c
Capgemini Complete Study Materials by Pappu Career Guide
https://www.youtube.com/PappuCareerGuide
Print a, b, c

Options:
A) 7 14 7
B) 7 14 10
C) 7 8 14
D) 7 18 14

Correct answer: Option D


Explanation: The intial values of a=5, b=4, c=3
a = 4 +3 = 7
c=7–4=3
c = 3 + 7 = 10
c = 4 + 10 = 14
b = 4 + 14 = 18
Print 7, 18, 14

Question 10:
What will be the output of the following pseudocode?
Integer a, b, c, d
Set b = 18, c = 12
a=b–c
for (each c from 1 to a – 1)
b = b + c + 12
b = b/5
d=b+a
end for
c=a+b+c
Print a b c
Capgemini Complete Study Materials by Pappu Career Guide
https://www.youtube.com/PappuCareerGuide

Options:
A) 5 3 9
B) 6 14 17
C) 6 4 14
D) 6 4 16

Correct answer: Option D


Explanation: The loop runs for 5 times ; after the 5th iteration the value of a=6; b=4; c=10.
So the final answers are 6, 4, 16

Question 11:
Which of the following operations is possible on an array?
Options:
A) All of the mentioned options
B) Insertion
C) Searching
D) Sorting

Correct answer: Option A


Explanation: It is trickier when it comes to arrays to do he operation on comparison with the linked
lists. But they are definitely possible
Question 12:
An abstract data type is defined to be a mathematical model of a user-defined type along with the
collection of all ________ operations on that model.

Options:
A) Union
B) Assignment
C) Primitive
D) None of the above

Correct answer: Option A


Explanation: In computer science, an abstract data type (ADT) is a mathematical model for data
types. An abstract data type is defined by its behaviour (semantics) from the point of view of a user,
Capgemini Complete Study Materials by Pappu Career Guide
https://www.youtube.com/PappuCareerGuide
of the data, specifically in terms of possible values, possible operations on data of this type, and the
behaviour of these operations. These are not possible in union and assignment operations.

Question 13:
What do we call the binary tree nodes with no successor?
Options:
A) End nodes
B) Terminal nodes
C) Last nodes
D) Final nodes

Correct answer: Option B


Explanation: The official terminology is Terminal node or leaf node;

Question 14:
What do we call the highest element of an array’s index?
A) Upper bound
B) Lower bound
C) Range
D) Extraction

Correct answer: Option A


Explanation: The upper bound is always the highest element of an array index.

Question 15:
Which of the following data types represents many to many relations?
A) Both plex and graph
B) Graph
C) Plex
D) Tree

Correct answer: Option A


Explanation: A many-to-many relationship occurs when multiple records in a table are associated
with multiple records in another table. This is possible only with the help of Both plex and graph.
Capgemini Complete Study Materials by Pappu Career Guide
https://www.youtube.com/PappuCareerGuide

Question 16:

Which of the following is NOT a type of linked list?


A) Double ended linked list
B) Double linked list
C) Simple linked list
D) Circular linked list

Correct answer: Option A


Explanation: We just have 3 types of linked list among the given options b, c and d. double ended
linked list does not exist.

Question 17:
Each node of the graph is represented as a _______?
A) Vertex
B) Root
C) Path
D) Edge

Correct answer: Option A


Explanation: Every node cannot be a root node and path , edge is realted to the directions of the
graph.

Question 18:
Recursion uses more memory space than iteration. Which of the following is/are the valid reason for
the same?
A. It uses the stack instead of a queue
B. Every recursion call has to be stored
Choose the correct answer from the options given below.
A) Only A
B) Both A and B
C) Neither A nor B
D) Only B
Capgemini Complete Study Materials by Pappu Career Guide
https://www.youtube.com/PappuCareerGuide
Correct answer: Option A
Explanation: Recursive functions use stack as the memory space technique. And also as rightly
pointed out the call has to be present to store the returned values.

Question 19:
To which of the following domain problem does the knapsack problem belong?
A) NP- complete
B) Sorting
C) Optimisation
D) Linear Solution

Correct answer: Option C


Explanation : knapsack algorithm is used to find the maximum profit out of the least weight
combination possible, therefore it is definitely belongs to a optimisation domain.

You might also like