Data Structures

Home Page
Q & A
1A solution is said to be efficient if it solves the problem within its resource constraints i.e. hardware and timeTrueFalse  A
2Which one of the following is known as "Last-In, First-Out" or LIFO Data Structure?Linked ListStackQueueTreeB
3What will be postfix expression of the following infix expression? Infix Expression : a+b*c-dab+c*d-abc*+d-abc+*d-abcd+*-B
4For compiler a postfix expression is easier to evaluate than infix expression?TrueFalse  A
5declare a stack of characters, while ( there are more characters in the word to read ){read a character; push the character on the stack;} while ( the stack is not empty ){pop a character off the stack; write the character to the screen;} input "apples"?selpaselppaapplesaaappppplleessB
6Consider the following function: void test_a(int n) {cout << n << " "; if (n>0) test_a(n-2); } What is printed by the call test_a(4)?4 20 2 40 22 4A
7If there are N external nodes in a binary tree then what will be the no. of internal nodes in this binary tree?N -1N +1N+2NA
8If there are N internal nodes in a binary tree then what will be the no. of external nodes in this binary tree?N -1N +1N+2NB
9If we have 1000 sets each containing a single different person. Which of the following relation will be true on each set:ReflexiveSymmetricTransitiveAssociativeA
10Which one of the following is NOT the property of equivalence relationReflexiveSymmetricTransitiveAssociativeD
11A binary tree of N nodes has _______Log10 N levelsLog2 N levelsN / 2 levelsN x 2 levelsB
12The easiest case of deleting a node from BST is the case in which the node to be deleted ___________Is a leaf nodeHas left subtree onlyHas right subtree onlyHas both left and right subtreeA
13If there are N elements in an array then the number of maximum steps needed to find an element using Binary Search is _______NN^2Nlog2Nlog2ND
14Merge sort and quick sort both fall into the same category of sorting algorithms. What is this category?O(nlogn) sortsInterchange sortAverage time is quadraticNone of the given optionsD
15If one pointer of the node in a binary tree is NULL then it will be a/an _______External nodeRoot nodeInner nodeLeaf nodeA
16We convert the ________ pointers of binary to threads in threaded binary treeLeftRightNULLNone of the given optionsC
17If the bottom level of a binary tree is NOT completely filled, depicts that the tree is NOT aExpression treeThreaded binary treecomplete Binary treePerfectly complete Binary treeC
18What is the best definition of a collision in a hash table?Two entries are identical except for their keysTwo entries with different data have the exact same keyTwo entries with different keys have the same exact hash valueTwo entries with the exact same key have different hash valuesC
19Suppose that a selection sort of 100 items has completed 42 iterations of the main loop. How many items are now guaranteed to be in their final spot (never to be moved again )21414243C
20Suppose you implement a Min heap (with the smallest element on top) in an array. Consider the different arrays below; determine the one that cannot possibly be a heap:16, 18, 20, 22, 24, 28, 3016, 20, 18, 24, 22, 30, 2816, 24, 18, 28, 30, 20, 2216, 24, 20, 30, 28, 18, 22D
21Which of the following statement is correct about find(x) operationA find(x) on element x is performed by returning exactly the same node that is foundA find(x) on element x is performed by returning the root of the tree containing xA find(x) on element x is performed by returning the whole tree itself containing xA find(x) on element x is performed by returning TRUEB
22Which of the following statement is NOT correct about find operationIt is not a requirement that a find operation returns any specific name, just that finds on two elements return the same answer if and only if they are in the same setOne idea might be to use a tree to represent each set, since each element in a tree has the same root, thus the root can be used to name the setInitially each set contains one elementInitially each set contains one element and it does not make sense to make a tree of one node onlyB
23In complete binary tree the bottom level is filled from ________Left to rightRight to leftNot filled at allNone of the given optionsA
24Here is an array of ten integers: 5 3 8 9 1 7 0 2 6 4 The array after the FIRST iteration of the large loop in a selection sort (sorting from smallest to largest)0 3 8 9 1 7 5 2 6 42 6 4 0 3 8 9 1 7 52 6 4 9 1 7 0 3 8 50 3 8 2 6 4 9 1 7 5A
25What requirement is placed on an array, so that binary search may be used to locate an entry?The array elements must form a heapThe array must have at least 2 entriesThe array must be sortedThe array‟s size must be a power of twoC