MCQOPTIONS
Saved Bookmarks
This section includes 721 Mcqs, each offering curated multiple-choice questions to sharpen your Technical Programming knowledge and support exam preparation. Choose a topic below to get started.
| 401. |
What is direct addressing? |
| A. | Distinct array position for every possible key |
| B. | Fewer array positions than keys |
| C. | Fewer keys than array positions |
| D. | None of the mentioned |
| Answer» B. Fewer array positions than keys | |
| 402. |
If several elements are competing for the same bucket in the hash table, what is it called? |
| A. | Diffusion |
| B. | Replication |
| C. | Collision |
| D. | None of the mentioned |
| Answer» D. None of the mentioned | |
| 403. |
What is a hash table? |
| A. | A structure that maps values to keys |
| B. | A structure that maps keys to values |
| C. | A structure used for storage |
| D. | A structure used to implement stack and queue |
| Answer» C. A structure used for storage | |
| 404. |
What will be the order of new heap created after union of heap H1 and H2 when created by the following code.Initially both are of the order n. FIB_UNION(H1,H2) { H =MAKE_HEAP() min[H]= min[H1] concatenate the root list of H2 with the root list of H if (min[H1] = NIL) or (min[H2]!= NIL and min[H2] < min[H1]) then min[H] = min[H2] n[H]= n[H1] + n[H2] free the objects H1 and H2 return H } |
| A. | n+1 |
| B. | n+n/2 |
| C. | nlogn |
| D. | 2*n |
| Answer» B. n+n/2 | |
| 405. |
What is wrong with the following code of insertion in fibonacci heap. Choose the correct option FIB-INSERT(H, x) degree[x]= 0 p[x]= NIL child[x] =NIL left[x] =x right[x] =x mark[x] =FALSE concatenate the root list containing x with root list H if min[H] = NIL or key[x] > key[min[H]] then min[H]= x n[H]= n[H] + 1 |
| A. | Line -11 |
| B. | Line -3 |
| C. | Line 9 |
| D. | Line 7 |
| Answer» D. Line 7 | |
| 406. |
Choose the option with function having same complexity for a fibonacci heap. |
| A. | Insertion, Union |
| B. | Insertion, Deletion |
| C. | extract_min, insertion |
| D. | Union, delete |
| Answer» B. Insertion, Deletion | |
| 407. |
Given a heap of n nodes.The maximum number of tree for building the heap is. |
| A. | n |
| B. | n-1 |
| C. | n/2 |
| D. | logn |
| Answer» B. n-1 | |
| 408. |
What does this pseudo_code return ? int myfun(heap_arr[]) { int mini=INF; for(int i=0;i<tot_node;i++) mini=min(mini,heap_arr) return mini; } |
| A. | Last added element to heap |
| B. | First element added to heap |
| C. | Root of the heap |
| D. | Leftmost node of the heap |
| Answer» D. Leftmost node of the heap | |
| 409. |
Time taken in decreasing the node value in a binomial heap is |
| A. | O(n) |
| B. | O(1) |
| C. | O(logn) |
| D. | O(nlogn) |
| Answer» D. O(nlogn) | |
| 410. |
What is order of resultant heap after merging two tree of order k? |
| A. | 2*k |
| B. | k+1 |
| C. | k*k |
| D. | k+logk |
| Answer» C. k*k | |
| 411. |
The number of trees in a binomial heap with n nodes is |
| A. | logn |
| B. | n |
| C. | nlogn |
| D. | n/2 |
| Answer» B. n | |
| 412. |
The main distinguishable characterstic of a binomial heap from a binary heap is that |
| A. | it allows union operations very efficiently |
| B. | it does not allow union operations that could easily be implemented in binary heap |
| C. | the heap structure is not similar to complete binary tree |
| D. | the location of child node is not fixed i.e child nodes could be at level (h-2) or (h-3), where h is height of heap and h>4 |
| Answer» B. it does not allow union operations that could easily be implemented in binary heap | |
| 413. |
The leaf node for a heap of height h will be at which position. |
| A. | h |
| B. | h-1 |
| C. | h or h-1 |
| D. | None of the mentioned |
| Answer» D. None of the mentioned | |
| 414. |
The total comparisons in finding both smallest and largest elements are |
| A. | 2*n +2 |
| B. | n + ((n+1)/2) -2 |
| C. | n+logn |
| D. | n2 |
| Answer» C. n+logn | |
| 415. |
What is the worst case time in searching minimum value in weak -heap? |
| A. | O(log n) |
| B. | O(n) |
| C. | O(n logn) |
| D. | O(1) |
| Answer» E. | |
| 416. |
Choose the correct properties of weak-heap. |
| A. | Every node has value greater than the value of child node |
| B. | Every right child of node has greater value than parent node |
| C. | Every left child of node has greater value than parent node |
| D. | None of the mentioned |
| Answer» C. Every left child of node has greater value than parent node | |
| 417. |
For construction of a binary heap with property that parent node has value less than child node.In reference to that which line is incorrect. Line indexed from 1. add(int k) { heap_size++; int i = heap_size - 1; harr[i] = k; while (i != 0 && harr[parent(i)] < harr[i]) { swap(&harr[i], &harr[parent(i)]); i = parent(i); } } |
| A. | Line -3 |
| B. | Line – 5 |
| C. | Line – 6 |
| D. | Line -7 |
| Answer» C. Line – 6 | |
| 418. |
Given an array of element 5,7,9,1,3,10,8,4. Tick all the correct sequences of elements after inserting all the elements in a min-heap. |
| A. | 1,3,4,7,8,9,10 |
| B. | 1,4,3,8,9,5,7,10 |
| C. | 1,3,4,5,8,7,9,10 |
| D. | None of the mentioned |
| Answer» B. 1,4,3,8,9,5,7,10 | |
| 419. |
State the complexity of algorithm gien below int function(vector<int> arr) int len=arr.length(); if(len==0) return; temp=arr[len-1]; arr.pop_back(); return temp; |
| A. | o(n) |
| B. | O(logn) |
| C. | O(1) |
| D. | O(n logn) |
| Answer» D. O(n logn) | |
| 420. |
What is the location of parent node for any arbitary node i? |
| A. | (i/2) position |
| B. | (i+1)/ position |
| C. | floor(i/2) position |
| D. | ceil(i/2) position |
| Answer» D. ceil(i/2) position | |
| 421. |
Given the code ,choose the correct option that is consistent with the code build(A,i) left-> 2*i right->2*i +1 temp- > i if(left<= heap_length[A] ans A[left] >A[temp]) temp -> left if (right = heap_length[A] and A[right] > A[temp]) temp->right if temp!= i swap(A[i],A[temp]) build(A,temp) Here A is the heap |
| A. | It is the build function of max heap |
| B. | It is the build function of min heap |
| C. | It is general build function of any heap |
| D. | None of the mentioned |
| Answer» B. It is the build function of min heap | |
| 422. |
What is the best case complexity in builading a heap? |
| A. | O(nlogn) |
| B. | O(n2) |
| C. | O(n*longn *logn) |
| D. | O(n) |
| Answer» E. | |
| 423. |
What is the space complexity of searching in a heap? |
| A. | O(logn) |
| B. | O(n) |
| C. | O(1) |
| D. | O(nlogn) |
| Answer» C. O(1) | |
| 424. |
An array consist of n elements. We want to create a heap using the elements. The time complexity of building a heap will be in order of |
| A. | O(n*n*logn) |
| B. | O(n*logn) |
| C. | O(n*n) |
| D. | O(n *logn *logn) |
| Answer» C. O(n*n) | |
| 425. |
If we implement heap as maximum heap , adding a new node of value 15 to the left most node of right subtree . What value will be at leaf nodes of the right subtree of the heap. |
| A. | 15 and 1 |
| B. | 25 and 1 |
| C. | 3 and 1 |
| D. | 2 and 3 |
| Answer» B. 25 and 1 | |
| 426. |
If we implement heap as min-heap , deleting root node (value 1)from the heap. What would be the value of root node after second iteration if leaf node (value 100) is chosen to replace the root at start. |
| A. | 2 |
| B. | 100 |
| C. | 17 |
| D. | 3 |
| Answer» B. 100 | |
| 427. |
The worst case complexity of deleting any arbitrary node value element from heap is |
| A. | O(logn) |
| B. | O(n) |
| C. | O(nlogn) |
| D. | O(n2) |
| Answer» B. O(n) | |
| 428. |
What is the complexity of adding an element to the heap |
| A. | O(log n) |
| B. | O(h) |
| C. | O(log n) & O(h) |
| D. | None of the mentioned |
| Answer» D. None of the mentioned | |
| 429. |
In a max-heap, element with the greatest key is always in the which node? |
| A. | Leaf node |
| B. | First node of left sub tree |
| C. | root node |
| D. | First node of right sub tree |
| Answer» D. First node of right sub tree | |
| 430. |
What are double and single threaded trees? |
| A. | when both left, right nodes are having null pointers and only right node is null pointer respectively |
| B. | having 2 and 1 node |
| C. | using single and double linked lists |
| D. | using heaps and priority queues |
| Answer» B. having 2 and 1 node | |
| 431. |
The null left pointer pointing to predecessor and null right pointer pointing to successor. how many types of threaded tree are possible with this convention? |
| A. | inorder, postorder, preorder traversals |
| B. | inorder |
| C. | postorder |
| D. | preorder |
| Answer» B. inorder | |
| 432. |
What are null nodes filled with in a threaded binary tree? |
| A. | inorder predecessor for left node and inorder successor for right node information |
| B. | right node with inorder predecessor and left node with inorder successor information |
| C. | they remain null |
| D. | some other values randomly |
| Answer» B. right node with inorder predecessor and left node with inorder successor information | |
| 433. |
What may be the content of a node in threaded binary tree? |
| A. | leftchild_pointer, left_tag, data, right_tag, rightchild_pointer |
| B. | leftchild_pointer, left_tag |
| C. | leftchild_pointer, left_tag, right_tag, rightchild_pointer |
| D. | leftchild_pointer, left_tag, data |
| Answer» B. leftchild_pointer, left_tag | |
| 434. |
What are the disadvantages of normal binary tree traversals? |
| A. | there are many pointers which are null and thus useless |
| B. | there is no traversal which is efficient |
| C. | complexity in implementing |
| D. | improper traversals |
| Answer» B. there is no traversal which is efficient | |
| 435. |
What is a threaded binary tree traversal? |
| A. | a binary tree traversal using stacks |
| B. | a binary tree traversal using queues |
| C. | a binary tree traversal using stacks and queues |
| D. | a binary tree traversal without using stacks and queues |
| Answer» E. | |
| 436. |
Which of the following options is an application of splay trees? |
| A. | cache Implementation |
| B. | networks |
| C. | send values |
| D. | receive values |
| Answer» B. networks | |
| 437. |
What is a splay operation? |
| A. | moving parent node to down of child |
| B. | moving a node to root |
| C. | moving root to leaf |
| D. | removing leaf node |
| Answer» C. moving root to leaf | |
| 438. |
Why to prefer splay trees? |
| A. | easier to program |
| B. | space efficiency |
| C. | easier to program and faster access to recently accessed items |
| D. | quick searching |
| Answer» D. quick searching | |
| 439. |
Which of the following property of splay tree is correct? |
| A. | it holds probability usage of the respective sub trees |
| B. | any sequence of j operations starting from an empty tree with h nodes atmost, takes O(jlogh) time complexity |
| C. | sequence of operations with h nodes can take O(logh) time complexity |
| D. | splay trees are unstable trees |
| Answer» C. sequence of operations with h nodes can take O(logh) time complexity | |
| 440. |
What are splay trees? |
| A. | self adjusting binary search trees |
| B. | self adjusting binary trees |
| C. | a tree with strings |
| D. | a tree with probability distributions |
| Answer» B. self adjusting binary trees | |
| 441. |
What is the below pseudo code trying to do, where pt is a node pointer and root pointer redblack(Node root, Node pt) : if (root == NULL) return pt if (pt.data < root.data) { root.left = redblack(root.left, pt); root.left.parent = root } else if (pt.data > root.data) { root.right = redblackt(root.right, pt) root.right.parent = root } return root |
| A. | insert a new node |
| B. | delete a node |
| C. | search a node |
| D. | count the number of nodes |
| Answer» B. delete a node | |
| 442. |
When to choose Red-Black tree, AVL tree and B-trees? |
| A. | many inserts, many searches and when managing more items respectively |
| B. | many searches, when managing more items respectively and many inserts respectively |
| C. | sorting, sorting and retrieval respectively |
| D. | retrieval, sorting and retrieval respectively |
| Answer» B. many searches, when managing more items respectively and many inserts respectively | |
| 443. |
How can you save memory when storing color information in Red-Black tree? |
| A. | using least significant bit of one of the pointers in the node for color information |
| B. | using another array with colors of each node |
| C. | storing color information in the node structure |
| D. | using negative and positive numbering |
| Answer» B. using another array with colors of each node | |
| 444. |
Why Red-black trees are preferred over hash tables though hash tables have constant time complexity? |
| A. | no they are not preferred |
| B. | because of resizing issues of hash table and better ordering in redblack trees |
| C. | because they can be implemented using trees |
| D. | because they are balanced |
| Answer» C. because they can be implemented using trees | |
| 445. |
When it would be optimal to prefer Red-black trees over AVL trees? |
| A. | when there are more insertions or deletions |
| B. | when more search is needed |
| C. | when tree must be balanced |
| D. | when log(nodes) time complexity is needed |
| Answer» B. when more search is needed | |
| 446. |
Which of the following is an application of Red-black trees and why? |
| A. | used to store strings efficiently |
| B. | used to store integers efficiently |
| C. | can be used in process schedulers, maps, sets |
| D. | for efficient sorting |
| Answer» D. for efficient sorting | |
| 447. |
What are the operations that could be performed in O(logn) time complexity by red-black tree? |
| A. | insertion, deletion, finding predecessor, successor |
| B. | only insertion |
| C. | only finding predecessor, successor |
| D. | for sorting |
| Answer» B. only insertion | |
| 448. |
All the above formations are incorrect for it to be a redblack tree. then what may be the correct order? |
| A. | 50-black root, 18-red left subtree, 100-red right subtree |
| B. | 50-red root, 18-red left subtree, 100-red right subtree |
| C. | 50-black root, 18-black left subtree, 100-red right subtree |
| D. | 50-black root, 18-red left subtree, 100-black right subtree |
| Answer» B. 50-red root, 18-red left subtree, 100-red right subtree | |
| 449. |
Why do we impose restrictions like . root property is black . every leaf is black . children of red node are black . all leaves have same black |
| A. | to get logarithm time complexity |
| B. | to get linear time complexity |
| C. | to get exponential time complexity |
| D. | to get constant time complexity |
| Answer» B. to get linear time complexity | |
| 450. |
What is the special property of red-black trees and what root should always be? |
| A. | a color which is either red or black and root should always be black color only |
| B. | height of the tree |
| C. | pointer to next node |
| D. | a color which is either green or black |
| Answer» B. height of the tree | |