Q1: A queue where the dequeue operation depends not on FIFO is called a priority queue.
(A) False
(B) True
Answer: (B) True
Q2: The data of the problem is 2GB and the hard disk is 1GB. To solve this problem we should:
(A) Use better data structures
(B) Increase the hard disk space
(C) Use a better algorithm
(D) Use as much data as we can store on the hard disk
Answer: (B) Increase the hard disk space
Q3: Consider the function int X(int &Value). Which of the following is a valid call if a and b are integers?
(A) a = X(b);
(B) a = X(&b);
(C) a = X(*b);
(D) None of the given options
Answer: (A) a = X(b);
Q4: In the call-by-value methodology, a copy of the object is passed to the called function.
(A) False
(B) True
Answer: (B) True
Q5: The tree data structure is a:
(A) Linear data structure
(B) Non-linear data structure
(C) Graphical data structure
(D) Data structure like queue
Answer: (B) Non-linear data structure
Q6: When should you use a const reference parameter?
(A) Whenever the parameter has huge size
(B) Whenever the parameter has huge size and the function does not change it
(C) Whenever the parameter has huge size and the function changes it but you do NOT want changes to alter the actual argument
(D) Whenever the parameter has huge size and the function changes it and you DO want changes to alter the actual argument
Answer: (D) Whenever the parameter has huge size, and the function does not change it (const reference ensures no change)
Q7:Which member functions can alter the private member variables of the object that activates the function?
(A) Only x
(B) Only y
(C) Only z
(D) Two of the functions
Answer: (A) Only x (y has const parameter, z is const function)
Q8: What is the maximum depth of recursive calls a function may make?
(A) 1
(B) 2
(C) n (where n is the argument)
(D) There is no fixed maximum
Answer: (D) There is no fixed maximum
Q9: Suppose n is the number of nodes in a complete Binary Tree. Maximum steps required for a search operation are:
(A) log₂(n+1) – 1
(B) log₂(n+1)
(C) log₂(n) – 1
(D) log₂(n)
Answer: (A) log₂(n+1) – 1
Q10: In a linked list implementation of the stack, where does the push member function place the new entry?
(A) At the head
(B) At the tail
(C) After all other entries greater than the new entry
(D) After all other entries smaller than the new entry
Answer: (A) At the head
Q11: In a circular array implementation of the queue with 10 items stored at data[2] through data[11] (capacity 42), where does the push function place the new entry?
(A) data[1]
(B) data[2]
(C) data[11]
(D) data[12]
Answer: (D) data[12]
Q12: The expression AB+C* is called:
(A) Prefix expression
(B) Postfix expression
(C) Infix expression
(D) None of these
Answer: (B) Postfix expression
Q13: A binary tree where left subtree ≤ node value and right subtree ≥ node value is called:
(A) Strictly Binary Tree
(B) Binary Search Tree
(C) AVL Tree
(D) All of these
Answer: (B) Binary Search Tree
Q14: If a node A in a BST is deleted, which two nodes are candidates to take its place?
(A) J and I
(B) H and E
(C) D and E
(D) L and M
Answer: (C) D and E (in-order predecessor or successor)
Q15: Consider insertion cases in AVL tree: left-left and right-right. What rotation is required?
(A) Single rotation fixes both cases
(B) Single rotation cannot fix
Answer: (A) Single rotation fixes both cases
Q16: We access elements in an AVL tree in:
(A) Linear way only
(B) Non-linear way only
(C) Both linear and non-linear ways
(D) None of the given options
Answer: (B) Non-linear way only