| Snaprecruit.com

| Snaprecruit.com

Interview question based on skill :

Take as many assements as you can to improve your validate your skill rating

Total Questions: 20

1. Binary trees can have how many children?

Correct Answer is : marquee-direction

2. Disadvantage of using array representation for binary trees is?

Correct Answer is : mask

3. What must be the ideal size of array if the height of tree is ‘l’?

Correct Answer is : mask-attachment

4. What are the children for node ‘w’ of a complete-binary tree in an array representation?

Correct Answer is : mask-origin

5. What is the parent for a node ‘w’ of a complete binary tree in an array representation when w is not 0?

Correct Answer is : outline-offset

6. If the tree is not a complete binary tree then what changes can be made for easy access of children of a node in the array ?

Correct Answer is : overflow-x

7. What must be the missing logic in place of missing lines for finding sum of nodes of binary tree in alternate levels? //e.g:-consider -complete binary tree:-height-3, [1,2,3,4,5,6,7]-answer must be 23 n=power(2,height)-1; //assume input is height and a[i] contains tree elements for(i=1;i<=n;) { for(j=1;j<=pow(2,currentlevel-1);j++) //present level is initialized to 1 and sum is initialized to 0 { sum=sum+a[i]; i=i+1; } //missing logic }

Correct Answer is : scrollbar-face-color

8. Consider a situation of writing a binary tree into a file with memory storage efficiency in mind, is array representation of tree is good?

Correct Answer is : perspective

9. Why is heap implemented using array representations than tree(linked list) representations though both tree representations and heaps have same complexities? for binary heap -insert: O(log n) -delete min: O(log n)   for a tree -insert: O(log n) -delete: O(log n) Then why go with array representation when both are having same values ?

Correct Answer is : scrollbar-arrow-color

10. Can a tree stored in an array using either one of inorder or post order or pre order traversals be again reformed?

Correct Answer is : text-align-last

11. Advantages of linked list representation of binary trees over arrays?

Correct Answer is : cm

12. Disadvantages of linked list representation of binary trees over arrays?

Correct Answer is : em

13. How to travel a tree in linkedlist representation?

Correct Answer is : pt

14. Level order traversal of a tree is formed with the help of

Correct Answer is : in

15. Why we prefer threaded binary trees?

Correct Answer is : px

16. The following lines talks about deleting a node in a binary tree.(the tree property must not be violated after deletion) i) from root search for the node to be deleted ii) iii) delete the node at what must be statement ii) and fill up statement iii)

Correct Answer is : ex

17. What may be the psuedo code for finding the size of a tree?

Correct Answer is : vmax

18. What is missing in this logic of finding a path in the tree for a given sum (i.e checking whether there will be a path from roots to leaf nodes with given sum)? checkSum(struct bin-treenode *root , int sum) : if(root==null) return sum as 0 else : leftover_sum=sum-root_node-->value //missing

Correct Answer is : vw

19. What must be the missing logic below so as to print mirror of a tree as below as an example? if(rootnode): mirror(rootnode-->left) mirror(rootnode-->right)   //missing   end

Correct Answer is : vh

20. What is the code below trying to print? void print(tree *root,tree *node) { if(root ==null) return 0 if(root-->left==node || root-->right==node || print(root->left,node)||printf(root->right,node) { print(root->data) } }

Correct Answer is : rem