Monday, 16 October 2017

Multiple Choice Question on Data Structure and Algorithm Design

Q1. In in-order traversal of a binary tree, the root node is visited:
a: after the traversal of right & left sub-trees
b: before the traversal of right and left sub-trees
c. in-between the traversal of  left and right sub-trees
d: none of these
   
Q2.If you wanted to make sure that closing parentheses ‘)’ match the opening parentheses ‘(‘ in a mathematical expression, which data-structure could help you?
a: Linked List
b: stack
c: queue
d: Graph

Q3. A binary search tree is also known as:
a: B-tree
b: binary sorted tree
c. AVL Tree
d: BST


Q4. A binary tree in which the node-values are not repeated is called:
a: B-tree
b: binary search tree
c. AVL Tree
d: B+ tree

Q5. A binary search tree in which the nodes have been inserted in the following order:60,55,95,40,30,100,35, the node with the value 47 will be inserted to the:
a: right of node with value 60
b: right of node with value 55
c: right of node with value 40
d: left of node with value 30

Q6. In the following post-order traversal of a binary tree: E,C,K,A,H,B,G,D,F, the root node is:
a: C
b: A
c: D
d: F

Q7. The complexity of bubble-sort algorithm is:
a: O(n2)
b: O(n*n)
c: O(n log n)
d: O(n*n log n)

Q8. Binary search is more suitable for:
a: array
b: linked list
c: stack
d: Queue

Q9. The complexity of binary-search algorithm is:
a: O(log n)
b: O(n log n)
c: O(n*2)
d: O(n+2)

Q10. The calloc() function can be used to allocate:
a: multiple blocks of memory
b: single block of memory
c: two blocks of memory
d: none of these

Q11. The postfix expression of the infix expression: A+B*(C+D)/F+D*E is:
a: AB+CD+*F/D+E*
b: ABCD+*F/+DE*+
c: A*B+CD/F*DE++
d: A+*BCD/F*DE++

Q12. A linear list of elements in which deletion can be done from one end and insertion can take place at the other end is called:
a: Tree
b: stack
c: Queue
d: Linked list

Q13. Which data-structure is needed to convert infix notation to postfix notation:
a: queue
b: stack
c: tree
d: linked list

Q14. Which of the following sorting procedures is the slowest:
a: Quick sort
b: bubble sort
c: Shell sort
d: insertion sort

Q15. The ‘C’ declaration: int b[50]; reserves ____ successive memory locations, each large enough to contain a single integer:
a: 200
b: 10
c: 1000
d: 50

Q16. If n elements are to be sorted, the complexity of selection-sort is:
a: O(n*2)
b: O(nlog n)
c: O(n+3)
d: O(n2)

Q17. The operation of processing each element in the list is known as:
a: sorting
b: merging
c: inserting
d: traversal

Q18. Arrays are best data structures:
a: for relatively permanent collections
b: when the size of structure is constantly changing
c: for both the above situations
d: for none of the above situations

Q19. The data elements of an array are stored successively in memory cells because:
a: in this way the computer can calculate the address of other elements keeping  track of address of first element
b: computer architecture allows arrays to be stored serially only
c: both of the above
d: none of the above

Q20. Pick the odd one out:
a: insertion sort
b: selection sort
c: counting sort
d: merge sort


Thanks
Mukesh Rajput

No comments:

Post a Comment

Thanks
Mukesh Rajput