Questions 11: Consider an array of integer : A
A = {1,2,6,5,7,8,9,6,7},{2,2,2,4,5,2,2,1,2}
A function named "min" takes an array as a parameter and returns the minimum element of the array.
Find the value of the following expression:
min(A[0])+min(A[1])
Answer: a) 2
Questions 12: Consider a stack of integers.
The stack is allocated 5 memory cells.
STACK : 1, 3, 3, _, _
The following operations are performed on the stack :
i) PUSH(STACK,4)
ii) PUSH(STACK,10)
iii) POP(STACK,ITEM)
What value will be stored in ITEM?
Answer: b) 10
Questions 13: Consider an array S of integers :
S = {1, 1, 1, 2, 4, 3, 4, 3, 4, 3, 2, 2, 3, 4, 3}
The following operations are performed on the array:
1. Duplicates are removed.
2. 4 is appended.
3. 1 is appended.
4. 2 is appended.
5. Duplicates are removed.
Calculate the sum of all the elements of the array
Answer: d) 10
Questions 14: Consider a tree, T shown in the diagram below, calculate the number of descendant nodes of the root node
Answer: c) 20
Questions 15: Consider a tree shown in the diagram below.
Which of the following vertices have no siblings?
Answer: b) M
Questions 16: Consider a tree shown in the diagram below.
Calculate the degree of root node in the tree.
Answer: c) 3