Persistent Previous Years Solved Sample Placement Papers
- Inheritance occurs when a class adopts all the traits of ________
A) an object
B) a parent class
C) a variable
D) a function
Ans: B) a parent class - Encapsulation means____________
A) Binding of data and code together
B) To inherit properties of base class
C) To reduce code length
D) To define global variable
Ans: A) Binding of data and code together - To derive new class from existing class is known as ________
A) Inheritance
B) Polymorphism
C) Object
D) None of these
Ans: A) Inheritance - Which of the following statement is correct?
A) Class is an instance of object.
B) Object is an instance of a class.
C) Class is an instance of data type.
D) Object is an instance of data type
Ans: B) Object is an instance of a class. - An object consists of -----
A) State
B) Behavior
C) Both A and B
D) None of these
Ans: C) Both A and B - Which of the following provides a reuse mechanism?
A) Inheritance
B) Polymorphism
C) Abstraction
D) Encapsulation
Ans: A) Inheritance - Which of the following is correct about class and structure?
A) Class can have member functions while structure cannot
B) Class data members are public by default while that of structure are private
C) Pointer to structure or classes cannot be declared.
D) Class data members are private by default while that of structure are public by default.
Ans: D) Class data members are private by default while that of structure are public by default. - The major goal of inheritance in c++ is:
A) To facilitate the conversion of data types.
B) To help modular programming.
C) To extend the capabilities of a class.
D) To hide the details of base class.
Ans: C) To extend the capabilities of a class. - Class is __________
A) Built in data type
B) User defined data type
C) Both a& b
D) None of these
Ans: B) User defined data type -
In a B+ tree, both the internal nodes and the leaves have keys.
A) True
B) False (Ans)
Explanation: In a B+ -tree, only the leaves have keys, and these keys are replicated in non-leaf nodes for defining the path for locating individual records.
-
Which of the following is true?
A) B + tree allows only the rapid random access
B) B + tree allows only the rapid sequential access
C) B + tree allows rapid random access as well as rapid sequential access (Ans)
D) B + tree allows rapid random access and slower sequential access
Explanation: The B+ -tree being a variation of B-tree allows rapid random access. In a B+ -tree, the leaves are linked together, so it also provides rapid sequential access.
-
A B+ tree can contain a maximum of 7 pointers in a node. What is the minimum number of keys in leaves?
A) 6
B) 3 (Ans)
C) 4
D) 7
Explanation: Maximum number of pointers in a node is 7, i.e., the order of the B+ -tree is 7. In a B+ tree of order n, each leaf node contains at most n – 1 keys and at least ⌈(n − 1)/2⌉ keys. Therefore, a minimum number of keys each leaf can have = ⌈(7 – 1)/2⌉ = 3.
-
Which of the following is false?
A) A B+ -tree grows downwards
B) A B+ -tree is balanced
C) In a B+ -tree, the sibling pointers allow sequential searching
D) B+ -tree is shallower than B-tree
(Ans) A) A B+ -tree grows downwards.
-
When a node is split during insertion, the middle key is promoted to the parent as well as retained in the right half-node. When a key is deleted from the leaf, it is also deleted from the non-leaf nodes of the tree.
A) Statement 1 is true but statement 2 is false (Ans)
B) Statement 2 is true but statement 1 is false
C) Both the statements are true
D) Both the statements are false
Explanation: During the split, the middle key is retained in the right half node and also promoted to the parent node. When a key is deleted from the leaf, it is retained in non-leaves because it can still be a valid separator between keys in nodes below.
-
Efficiency of finding the next record in a B+ tree is ____.
A) O(n)
B) O(log n)
C) O(n log n)
D) O(1) (Ans)
Explanation: In a B+ -tree, finding the next record (successor) involves accessing an additional leaf at most. So, the efficiency of finding the next record is O(1).
-
What is the maximum number of keys that a B+ -tree of order 3 and of height 3 can have?
A) 3
B) 80
C) 27
D) 26 (Ans)
Explanation: A B+ tree of order n and height h can have at most nh – 1 keys. Therefore, the maximum number of keys = 33 - 1 = 27 - 1 = 26.
-
Which of the following is false?
A) Compared to B-tree, B+ -tree has larger fanout
B) Deletion in B-tree is more complicated than in B+ -tree
C) B+ -tree has greater depth than the corresponding B-tree
D) Both B-tree and B+ -tree have the same search and insertion efficiencies
(Ans) C) B+ -tree has greater depth than the corresponding B-tree.
Explanation: A B+ -tree has a larger fanout and therefore has a depth smaller than that of the corresponding B-tree.