Capgemini Pseudo Code MCQs (previously asked)
1)The following numbers are inserted into an empty binary search tree in the given order: 10, 1, 3, 5, 15, 12, 16. What is the height of the binary search tree?
a) 3
b) 4
c) 5
d) 6
Ans: Option a
2) 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)
Ans: Option d
3) 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
Ans: Option d
4)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
Ans: All are correct
5)Each node in a Doubly Linked List contains how many fields?
a) 1
b) 2
c) 3
d) 4
Ans: Option c
6)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
Ans: Option c
7) The number of swappings needed to sort the numbers 8, 22, 7, 9, 31, 5, 13 in ascending order, using bubble sort is
a) 11
b) 12
c) 13
d) 10
Ans: Option 4
8) Find out the correct inorder traversel sequence of a BST?
1) 15, 19, 22, 26, 29, 35
2) 15, 18, 20, 22, 28, 26, 32
3) 14, 17, 19, 21, 26, 31, 33
a) only 1
b) only 1 and 3
c) only 2
d) only 1 and 2
Ans: Option b
For more pseudo codes click here
0 Comments