0% found this document useful (0 votes)
302 views

Capgemini Datastructures

The document contains details of a test section including 20 multiple choice questions related to data structures and algorithms. The questions cover topics like arrays, stacks, queues, trees, searching, and sorting. The summary provides high-level information about the type of test, number of questions, and topics covered.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
302 views

Capgemini Datastructures

The document contains details of a test section including 20 multiple choice questions related to data structures and algorithms. The questions cover topics like arrays, stacks, queues, trees, searching, and sorting. The summary provides high-level information about the type of test, number of questions, and topics covered.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 29

Section 1

Sno 1

Name SECTION-1

Time 120

Mark 1

Negative 0

Questions – S1

Qno 1

Questio Which of the following expressions is written in Reversed Polish


n notation?

Sno 1

Type Mcq

A ((w + f) - ) +d

B Wc+d*e-

C None of the mentioned options

D - *+ddvw

Answer C

Topic

Mark 1

Level 1

Qno 2

Questio Consider two arrays, A and B


A = {1, 3, 5}
B = {2, 0}
n
A new array is formed by joining two arrays. Sorting is done on the new
array. What will be the last second element in the new array?

Sno 1

Type Mcq

A 0

B 1

C 5

D 3

Answer D

Topic

Mark 1

Level 1

Qno 3

Consider an array of integers, A={a, b, c, d, e, f, g, h, i, j, k}, where a, b,


Questio c, d, e, f, g, h, i, j and k are constant integers. It is given that sum of
n squares of all elements of array equals 0. Find the sum of all elements
of the array.

Sno 1

Type Mcq

A Cannot be determined

B 3

C 2
D 0

Answer C

Topic

Mark 1

Level 1

Qno 4

Paul has a hypothetical array, A containing an infinite number of elements,


A = {1, 3, 5, 7, 9, ......}
Paul uses a for loop to traverse the array from start to end. Inside the for
loop, he writes the following instruction:
Questio
n A[k] = A[k+2], where k is a loop variable that represents the index of the
array.
Assume that the loop runs successfully. What will array A look like after the
program has been executed?

Sno 1

Type Mcq

A 3, 5, 7, 17 ......

B 3, 5, 7, 13, 17.....

C None of the mentioned options

D 5, 9, 13, 17.....

Answer D

Topic

Mark 1

Level 1
Qno 5

Questio Which of the following array representations represent a strict but not
n complete binary tree?

Sno 1

Type Mcq

A A, B, C, D, E

B A, B, C, D, E, F, G

C None of the mentioned options

D A, B, C, _, _, D, E,

Answer D

Topic

Mark 1

Level 1

Qno 6

Which of the following statements is/are correct about the adjacency


matrix?

Questio 1. Adjacency matrix for an undirected graph is always symmetric


n
2. Adjacency Matrix is also used to represent weighted graphs

Choose the correct answer from the options given below.

Sno 1

Type Mcq
A Only 2

B Neither 1 nor 2

C Both 1 and 2

D Only 1

Answer C

Topic

Mark 1

Level 1

Qno 7

Consider a stack, s: 2, 4, 16, 6, 7, 8, _, _


Questio Push operation is performed until a perfect square is encountered.
n What is the value of the top most element after all push operations
have been performed?

Sno 1

Type Mcq

A 2

B 4

C 16

D None of the mentioned options

Answer A

Topic

Mark 1

Level 1
Qno 8

Question What is the complexity of linear and binary search respectively?

Sno 1

Type Mcq

A O(n) and O(logn)

B O(n*n) and O(n)

C O(logn) and O(logn)

D O(n) and O(n)

Answer A

Topic

Mark 1

Level 1

Qno 9

Fill in the blanks with suitable options –


Questio
The time and space complexity of jump search is _____and _____
n
respectively.

Sno 1

Type Mcq

A O(toot(log(n))) and O(1)

B O(root(n)) and O(1)

C O(root(n)) and O(n)

D O(root(n)) and O(n*n)

Answer B

Topic
Mark 1

Level 1

Qno 10

Henry wants to search an element is the array using jump search. The
Questio optimal size of a block to be jumped is _____________.
n
(It is given that n is the number of elements)

Sno 1

Type Mcq

A Cube root(n)

B n/2

C Sqrt(n)

D N

Answer C

Topic

Mark 1

Level 1

Qno 11

Consider a binary tree, T which is represented using array as:


Question A, B, D, __, ___, Q, W
Which of the following statements is correct about T.

Sno 1

Type Mcq

A T is a complete BT but not a strict BT.


B None of the mentioned options

C T is a complete BT and also a strict BT.

D T is a strict BT but not a complete BT.

Answer A

Topic

Mark 1

Level 2

Qno 12

Fill in the blank with suitable option:


Questio
In a binary max heap containing 101 elements, the smallest element
n
can be found in time _____.

Sno 1

Type Mcq

A O(loglogn)

B O(logn)

C O(1)

D O(101)

Answer D

Topic

Mark 1

Level 2

Qno 13
Consider an array P containing n elements. While sort, an array named
Questio “Count” is created, that stores the count of each element. The count
n array looks like – {2, 2, 2, 2, 5, 7, 10}
Find the value of n.

Sno 1

Type Mcq

A 20

B 10

C 30

D None of the mentioned options

Answer C

Topic

Mark 1

Level 2

Qno 14

Question Identify the correct statement about a full binary tree.

Sno 1

Type Mcq

A The number of nodes in full binary tree is always even

B None of the mentioned options

C The number of nodes in full binary tree may be even or odd

D The number of nodes in full binary tree is always odd

Answer C

Topic
Mark 1

Level 2

Qno 15

Consider an array R containing some number of elements. While


sorting the array R using count sort, an array named “count” is created,
Questio
that stores the count of each element. The count array looks like –
n
{999, 0, 1, 0, 1, 0, 0, 5, 1}
Find the sum of all elements presents in array R.

Sno 1

Type Mcq

A 50

B 45

C 999

D 1049

Answer C

Topic

Mark 1

Level 2

Qno 16

Consider the following statements:


1. Let the number of binary search tree possible when the number of
Questio nodes is 4 be x.
n 2. Let the number of binary search trees possible when the number of
nodes is 3 be y.
Calculate x – y.

Sno 1
Type Mcq

A 16

B 18

C 9

Answer C

Topic

Mark 1

Level 2

Qno 17

Consider the following keys:


Questio 11, 12, 17, 14, 18, 15
n What will be pro-order traversal of the BST created using the above
keys? (It is given that keys are inserted in the sequence given)

Sno 1

Type Mcq

A 11 17 12 14 15 18

B 11 14 17 12 15 18

C 11 15 17 14 12 18

D 11 12 17 14 15 18

Answer D

Topic

Mark 1

Level 2
Qno 18

Consider a binary tree, T which is represented using array as:


Question K, Q, E, ___, N, T
Which of the following statements is correct about T.

Sno 1

Type Mcq

A T is complete BT and also a strict BT.

B T is neither a complete BT nor a strict BT

C T is a complete BT but not a strict BT

D T is a strict BT but not a complete BT.

Answer D

Topic

Mark 1

Level 2

Qno 19

Questio Consider a complete binary tree in which the parent node is stored at
n index I. What will be the index of left child of the parent node?

Sno 1

Type Mcq

A 2*|-1

B 2*|+1

C 2*|+2

D 2*|-2
Answer A

Topic

Mark 1

Level 2

Qno 20

Question Identify the correct statement about 3- way merge sort.

Sno 1

Type Mcq

A It makes use of three binary trees.

B It breaks down the arrays to subarrays of size one fourth.

C It splits the array into three parts.

D None of the mentioned options.

Answer C

Topic

Mark 1

Level 2

Qno 21

During an in-order traversal of the given rooted tree, which of the


following is the correct over of the nodes visited?

Questio
n
Sno 1

Type Mcq

A 8-4-2-1-9-5-6-7-3

B 8-4-2-1-9-5-3-6-7

C 1-2-3-4-5-6-7-8-9

D 8-4-2-9-5-6-7-3-1

Answer D

Topic

Mark 1

Level 3

Qno 22

Find out the sum of the degree of vertices in the pseudo graph as
shown in the image.
Questio
n

Sno 1

Type Mcq

A 24

B 20

C 28

D 22

Answer D
Topic

Mark 1

Level 3

Qno 23

Consider the following keys:


Questio 11, 12, 17, 14, 18, 15
n What will be post-order traversal of the BST created using the above
keys? (It is given that keys are inserted in the sequence given)

Sno 1

Type Mcq

A 15 17 11 14 18 12

B 15 14 18 17 12 11

C 15 18 14 17 12 11

D 15 12 14 17 11 18

Answer C

Topic

Mark 1

Level 3

Qno 24

Suppose there is a 1-D array Arr[20] with the lower bound as 1 and
Questio
starting base address as 99. Find the address of Arr[6] if the size of
n
each element

Sno 1

Type Mcq
A 117

B 114

C 99

D 111

Answer B

Topic

Mark 1

Level 3

Qno 25

Questio The graph corresponding to which of the following adjacency matrix is a


n simple graph?

Sno 1

Type Mcq

101
A 010
100

111
B 111
111

011
C 101
110

011
D 110
100

Answer B

Topic

Mark 1
Level 3

Qno 26

Consider a binary heap in which the value in a parent node is greater


Questio
than the values in its two children nodes. What is such a binary heap
n
called?

Sno 1

Type Mcq

A Max heap

B Unique heap

C None of the mentioned options

D Min heap

Answer A

Topic

Mark 1

Level 3

Qno 27

Questio James is using heap sort to sort an array in increasing order. What is
n the overall time complexity of the sorting technique used by him?

Sno 1

Type Mcq

A logn

B n*n

C nlogn
D n

Answer C

Topic

Mark 1

Level 3

Qno 28

Consider the following searching algorithms


1. Binary search
Questio 2. Exponential binary search
n
Which of the above searching technique can be used to perform
unbounded searches?

Sno 1

Type Mcq

A Only 2

B Both 1 and 2

C Only 1

D Neither 1 nor 2

Answer B

Topic

Mark 1

Level 3

Qno 29

Questio Consider the following search algorithms –


1. Interpolation search
2. Binary search
n
Which of the above searching techniques works better if the array is
sorted and uniformly distributed?

Sno 1

Type Mcq

A Only 2

B Both 1 and 2 work equally well

C Neither 1 nor 2 works for sorted arrays

D Only 1

Answer B

Topic

Mark 1

Level 3

Qno 30

Suppose there is a 1-D array Arr[20] with the lower bound as 1 and
Questio
starting base address as 60. Find the address of Arr[3] if the size of
n
each elements is 4.

Sno 1

Type Mcq

A 63

B 72

C 68

D 64

Answer C

Topic
Mark 1

Level 3

Qno 31

Consider the following arithmetic expression written in postfix notation:


Question 14 7 2 - *3 +
Find the value of the above expression (using stack data structure)

Sno 1

Type Mcq

A 173

B 172

C 177

D 73

Answer D

Topic

Mark 1

Level 1

Qno 32

Question Which of the following expressions is written is Polish notation?

Sno 1

Type Mcq

A rd–p/s+

B ((a * t) + p) – n
C +/-avfe

D None of the mentioned options

Answer C

Topic

Mark 1

Level 1

Qno 33

Consider the following searching algorithms-

1. Binary search
Questio
2. Fibonacci search
n
Which of the above searching technique divides the array into unequal
parts?

Sno 1

Type Mcq

A Only 1

B Neither 1 nor 2

C Both 1 and 2

D Only 2

Answer A

Topic

Mark 1

Level 1
Qno 34

Question Identify the correct statement about a full binary tree.

Sno 1

Type Mcq

A The number of nodes in full binary tree is always even

B None of the mentioned options

C The number of nodes in full binary tree may be even or odd

D The number of nodes in full binary tree is always odd

Answer C

Topic

Mark 1

Level 1

Qno 35

Consider an array, A = {9, 3, 4, 5, 6, 1, 7}. What is the minimum


Questio
number of swap operations between two elements of the array needed
n
to be done to sort the array in increasing order?

Sno 1

Type Mcq

A 3

B 1

C 4

D 2

Answer D

Topic
Mark 1

Level 1

Qno 36

If you are writing code to find the length of a linked list, then which of
Questio
the following values should you provide for the temp pointer to
n
terminate the program?

Sno 1

Type Mcq

A Maximum data value

B Address of the head pointer

C None of the mentioned options

D Null

Answer D

Topic

Mark 1

Level 1

Qno 37

Consider a stack of integers. The stack is allocated 5 memory cells.


STACK : 1, 4, 1, 12, 45.
Now, consider the following operations:
1. PUSH (STACK, 30)
Questio 2. PUSH (STACK, 310)
n 3. PUSH (STACK, 1310)
4. POP (STACK, ITEM)
What is the maximum number of operations that can be performed in
any sequence from among the above operations, such that no
overflow/ underflow
Sno 1

Type Mcq

Answer

Topic

Mark 1

Level 1

Qno 38

Consider an array, A = {9, 3, 4, 5, 6, 1, 7}. What is the minimum


Questio
number of swap operations between two elements of the array needed
n
to be done to sort the array in increasing order?

Sno 1

Type Mcq

A 3

B 1

C 4

D 2

Answer D

Topic

Mark 1

Level 1
Qno 39

If you are writing code to find the length of a linked list, then which of
Questio
the following values should you provide for the temp pointer to
n
terminate the program?

Sno 1

Type Mcq

A Maximum data value

B Address of the head pointer

C None of the mentioned options

D Null

Answer D

Topic

Mark 1

Level 1

Qno 40

A machine needs a minimum of 1 sec to execute 20 sorting operations


Questio
in Quick-sort. Which of the following will be approximate minimum time
n
needed to sort 200 elements? (200 = 2^7).

Sno 1

Type Mcq

A 73 sec

B 70 sec

C 72 sec

D 71 sec
Answer A

Topic

Mark 1

Level 1

Qno 41

Questio Calculate the total number of triangles in a complete bipartite graph


n represented as K2,3.

Sno 1

Type Mcq

A 1

B 3

C 0

D 2

Answer C

Topic

Mark 1

Level 2

Qno 42

Question Indentify the correct statement about a complete binary tree.

Sno 1

Type Mcq
A The number of the nodes is always odd

B None of the mentioned options

C The number of nodes may be even or odd

D The number of nodes is always even

Answer A

Topic

Mark 1

Level 2

Qno 43

Consider two arrays, A and B.

A = {1, 3, 5}
Questio
B= {2, 0}
n
A new array is formed by joining two arrays. Sorting is done on the new
array. What will be the last second element in the new array?

Sno 1

Type Mcq

A 0

B 1

C 5

D 3

Answer D

Topic

Mark 1

Level 2
Qno 44

Consider an array of integers, A = {a, b, c, d, e, f, g, h, i, j, k}, where a,


Questio b, c, d, e, f, g, h, i, j, and k are constant integers. It is given that sum of
n squares of all elements of array equals 0. Find the sum of all elements
of the array.

Sno 1

Type Mcq

A Cannot be determined

B 3

C 2

D 0

Answer C

Topic

Mark 1

Level 2

Qno 45

Consider an array, A of two integers. It is given that difference of


squares of first and second element equals1, i.e.,
Questio
n (A[0])2 – (A[1])2

How many such arrays are possible?

Sno 1

Type Mcq

A 5

B 2
C 6

D 3

Answer B

Topic

Mark 1

Level 2

Qno 46

Consider a two dimensional array A[10][10]. Assume 2 bytes per


Questio
memory cell, the base address of array A is 150, element first element
n
is A[0][0]. What is the address of A[5][5]?

Sno 1

Type Mcq

A 200

Answer A

Topic

Mark 1

Level 2

You might also like