Join Regular Classroom : Visit ClassroomTech

Capgemini Sample Question Paper I | Codewindow.in

Q1. Convert the given postfix expression into infix.

ab-c*d/

a) (a-b)(c/d)
b) (a-(bc))/d
c) a-((bc)/d)
d) (((a-b)c)/d)

Answer: d) (((a-b)*c)/d)

Q2. Find out the array representation of the given max heap, if the value 12 is deleted from it.
18, 15, 12, 9, 6, 3

a) 18, 15, 9, 6, 3
b) 9, 6, 18, 15, 3
c) 18, 3, 6, 9, 15
d) 18, 15, 3, 9, 6

Answer: d) 18, 15, 3, 9, 6

Q3. Find out the array representation of the given min heap, if the value 4 is deleted from it.
2, 4, 6, 8, 10

a) 2, 10, 6, 8
b) 2, 6, 8, 10
c) 6, 10, 8, 2
d) 2, 8, 6, 10

Answer: d) 2, 8, 6, 10

Q4. Which of the following traversal of a binary tree always yields all the nodes?

a) In-order traversal
b) Post-order traversal
c) Pre-order traversal
d) Level order traversal

Answer: All are correct

Q5. Each node in a Doubly Linked List contains how many fields?

a) 1
b) 2
c) 3
4) 4

Answer: c) 3

Explanation: [prev, data, next]

 

Q6. Linked Lists are used to implement which of the following?
1.Stack
2.Queue
3.Trees

a) 1 and 3
b) 2 and 3
c) 1, 2 and 3
d) 1 and 2

Answer: c) 1, 2 and 3

Q7. If we draw a binary search tree by inserting the given numbers from left to right, then what would be the height of the BST?
150, 250, 350, 140, 120

a) 5
b) 2
c) 4
d) 3

Answer: b) 2

Explanation: The height of a node in a binary search tree is the largest number of edges in a path from a leaf node to a target node.

                150
	140		250
120				350

Q8. Find out the array representation of the given max heap, if the value 7 is inserted in it.
10, 8, 6, 4, 2

a) 10, 8, 7, 4, 2, 6
b) 10, 7, 8, 4, 2, 6
c) 10, 8, 7, 2, 4, 6
d) 10, 8, 7, 6, 4, 2

Answer: a) 10, 8, 7, 4, 2, 6

Q9. If the base address of a two dimensional array A[10][10] is 8, then find out the address of an element A[5][5] in the array.
**assume 2 words per memory cell and elements are arranged in column major order.

a) 115
b) 108
c) 118
d) 128

Answer: c) 118

Explanation: Address of A[5][5] = 8 + (10 * 5 + 5) * 2 = 118

Q10. If the base address of a two dimensional array A[5][10] is 10, then find out the address of an element A[2][8] in the array.
**assume 2 words per memory cell and elements are arranged in column major order.

a) 85
b) 105
c) 92
d) 94

Answer: d) 94

Explanation: Address of A[2][8] = 10 + (8 * 5 + 2) * 2 = 94

Recent Posts