0% found this document useful (0 votes)
2K views52 pages

cs301 Quiz

The document contains 64 multiple choice questions related to data structures and algorithms concepts like stacks, queues, linked lists, trees, binary search trees, AVL trees etc. It tests knowledge on operations, properties and implementations of various data structures. The questions cover topics like tree traversals, balancing of AVL trees, implementations of stacks, queues and linked lists, dynamic memory allocation, recursion, time complexities etc.

Uploaded by

Hunzala Ahmad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2K views52 pages

cs301 Quiz

The document contains 64 multiple choice questions related to data structures and algorithms concepts like stacks, queues, linked lists, trees, binary search trees, AVL trees etc. It tests knowledge on operations, properties and implementations of various data structures. The questions cover topics like tree traversals, balancing of AVL trees, implementations of stacks, queues and linked lists, dynamic memory allocation, recursion, time complexities etc.

Uploaded by

Hunzala Ahmad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 52

Consider the following infix expression.

7/8 + 9
If one converts the above expression into postfix, what would be the resultant
expression?
a) 7 8 9 / +
b) 7 8 / + 9
c) / 7 8 + 9
d) 7 8 / 9 +

2. ___ objects (objects accessed by pointers) are called anonymous objects.


a) Private
b) Nameless
c) Friend
d) Public

3. ___ is a self-balancing tree.


a) AVL
b) Binary Tree
c) Binary Search Tree
d) ALV

4. Which of the following operation returns but do not removes top value of the
stack?
a) Push
b) Pop
c) Top
d)First
5. Int htdiff = height(root->getLeft()) height(root->getRight());
The above line of code is taken from AVL insert method.
Complete it by selecting an appropriate symbol.
a) -
b) +
c) /
d) *

6. Which operation of the queue data structure is used to insert an element


into the Queue?
a) Enqueue()
b) Dequeue()
c) Fornt()
d) Remove()

7. For making binary search tree for strings we need, data type.
a) Char
b) Int
c) Float
d) Double

8. Local variables defined inside function body are automatically at the end
of function execution.
a) Created
b) Destroyed
c) Incremented
d) Decremented

9. If a node has three fields, then this node will be related to


a) Linked list
b) Doubly linked list
c) Circular linked list
d) All of the given

10. ___ is an area in computer memory that is allocated dynamically.


a) Heap
b) Stack
c) Queue
d) Linked list

11. Linked list use to store data.


a) Array
b) 2-D Array
c) Variables
d) Linked Memory

12. The lifetime of a transient object cannot exceed that of the application.
a) True
b) False
c) In some cases
d) None of the given
13. To represent hierarchical relationship between elements, which data
structure is suitable?
a) Dequeue
b) Priority
c) Stack
d) Tree

14. Local variables of a function are stored in,


a) Binary search tree
b) Stack
c) Queue
d) AVL tree

15. In-order traversal method traverses tha data in


a) Non sorted order
b) Random order
c) Sorted order
d) None of the given

16. Dequeue() operation of queue data structure is used to


a) Get an element from the front of the queue
b) Remove an element from the front and return it
c) Insert an element at the front
d) Insert an element at the back

17. In a tree, we link the nodes in such a way that it a linear structure.
a) Does not remain
b) Forms
c) Reverses
d) Remains

18. Factorial is an example of function.


a) Recursive
b) Non-recursive
c) Cube
d) Log

19. All the objects created using operator have to be explicitly destroyed
using delete operator.
a) New
b) Delete
c) Del
d) Create

20. In the calling function, after the execution of the function called, the
program continues its execution from the after the function call.
a) Previous line
b) Next line
c) Beginning
d) None of the above
21. Last node in circular linked list contains
a) At least one null pointer
b) No null pointer
c) Maximum two null pointers
d) None of the given

22. One should be careful about transient that are stored by reference in data
structures.
a) Objects
b) Stack
c) Function
d) Tree

23) Binary search tree violates the condition of AVL tree when any node has
balance equal to
a) 2 or -2
b) 1 or -1
c) 0
d) None of the options

24. Security of data is the main usage of AVL tree.


a) True
b) False
c) In some cases
d) None of the given

25. A binary tree whose every node has either zero or two children is called
.
a) Complete binary tree
b) Binary search tree
c) Strictly binary tree
d) None of above

26. In internal memory organization of a process, there is some area of


memory for static data that holds variables.
a) Static
b) Global
c) Not static neither global
d) Both static and global

27. Following is true in case of using recursive method calls.


a) The code becomes very long
b) There is no effect on length of code
c) The code becomes very short
d) Code becomes very easy to understand

28. In which traversal method, the recursive calls can be used to traverse a
binary tree?
a) In preorder traversal only
b) In inorder traversal only
c) In postorder traversal only
d) All of the given options

29. If we use doubly linked list to implement list then there is an issue of
a) Next pointer of first node and pre pointer of last node are NULL
b) Next pointer of first node and next pointer of last node are NULL
c) Pre pointer of first node and next pointer of last node are NULL
d) Pre pointer of first node and pre pointer of last node are NULL
30. In case of insertion of left outer node in BST,
a) We apply single right rotation to make it AVL tree.
b) We apply single left rotation to make it AVL tree.
c) We first apply right rotation and then left rotation to make it AVL tree.
d) We first apply left rotation and then right rotation to make it AVL tree.

31. Whenever we call a function, the complier makes a stack, the top element
of the stack is of the function.
a) First argument
b) Return address
c) Last argument
d) None of the above

32. Suppose a stack class has been defined using template. Now, we want to
declare a Stack object of an int type. What will be the correct syntax?
a) <int>Stack stack;
b) Stack<int> stack;
c) Stack int stack;
d) Int Stack stack;

33) In node class one field is an integer data and other field will be
a) Pointer to class
b) Pointer to node
c) Pointer to integer
d) None of given options
34. If there are 100,0000 unique members (nodes) stored in a complete binary
tree, the tree will have levels.
a) 10
b) 20
c) 30
d) 40

35. ~BinarySearchTree() is a .
a) Constructor
b) Destructor
c) Switch case
d) Template method call

36. ___ is utilized at the time of memory allocation in dynamic manner.


a) Stack
b) Queue
c) Heap
d) All of the given

37. How many cases of rotation are there in AVL tree?


a) 2
b) 4
c) 6
d) 8

38. A list is the collection of items of the


a) May be of same or may be of different type
b) Different type
c) Same type
d) None of the above

39. Int * i = new int[10]; Above given code will:


a) Create an integer having value 10
b) Allocate memory for 9 integers
c) Allocate memory for 10 integers
d) Create 10 pointers of integer type

40. The depth of a binary tree is


a) Total number of nodes in the tree
b) Number of leaf nodes in the tree
c) Number of non-leaf nodes in the tree
d) Maximum level of a leaf

41. A model attempts to model a real-world phenomenon


a) Physical
b) Logical
c) Simulation
d) Conceptual

42. In level-order traversal for binary search tree, we visit the nodes at each
level before proceeding to the next level, in a order.
a) Right-to-left
b) Left-to-right
c) Top-to-bottom
d) Bottom-to-top

43. The balance of a node in a binary tree is defined as the height of its sub
tree minus height of its right sub tree.
a) Right
b) Left
c) Upper
d) Lower

44. Allocating and de-allocating memory for linked list nodes does take __
time than pre- allocated array.
a) Less
b) More
c) Equal
d) No

45. Consider we have performed the following operations on a stack of size


5.
Push(10);
Push(20);
Push(30);
Pop();
Pop();
Pop();
Push(40);
Push(50);
Pop();
After the completion of all operation, the top element in stack is .
a) 10
b) 20
c) 40
d) 50

46. Each operator in a postfix expression refers to the previous operand(s).


a) One
b) Two
c) Three
d) Four

47. In doubly linked list a node consists of three parts:


a) 1 pointer and 2 objects
b) 2 pointers and 1 object
c) 3 objects
d) 3 pointers

48. For reference variables, sign is used.


a) Ampersand
b) Asterisk
c) Sigma
d) Dollar

49. Which of the following data structure is linear type?


a) Stack
d) List
c) Queue
d) All of the above

50. The ___ is a decrement operator in C++ that decreases the value of the
operand by .
a) One
b) Two
c) Three
d) Four

51. Which of the following statement is correct for the variable “current __“?
a) Current = current + 1
b) Current = current - 1
c) Current = current - 2
d) Current – 1 = current

52. When an executable program runs, it is loaded in the computer memory


and becomes a
.
a) Thread
b) .h file
c) Process
d) None of the above

53. start() method of list class is used to:


a) Moves the “current” pointer to very first element
b) Moves the “current” pointer to very last element
c) Moves the “current” pointer to one step after the first element of the array
d) Moves the “current” pointer to one step before the first element of the array

54. a * (b + c) – d is an example of expression.


a) Infix
b) Prefix
c) Postfix
d) Alfix

55. In a program a reference variable, say x, can be declared as a) int &x;


b) int *x;
c) int x;
d) none of the given options
56. We allocate memory dynamically by using operator.
a) This
b) New
c) Increment
d) Decrement

57. Get(?) method of list class is used to:


a) Get element from the last position
b) Get element from the first position
c) Get element from the middle position
d) Get element at the given position

58. STL is a that is a part of the official standard of C++.


a) C program file
b) .h file
c) .cpp file
d) Library

59. There are cases for deleting a node from binary search tree.
a) 1
b) 2
c) 3
d) 4

60. In a list, tail() method of current pointer


a) Returns the last element of the “current” pointer
b) Moves the “current” pointer to the very first element
c) Moves the “current” pointer to the very last element
d) Returns the first element of the “current” pointer

61. Suppose we have been given the following data set for a queue: 3 7 5 2 4
What will be the resultant queue if we call a front() method?
a) 7 5 2 4
b) 3 7 5 2 4
c) 7 5 2 4 3
d) 5 2 4

62. Suppose we have been given the following data set for a queue: 7 5 2 4
What will be the resultant queue if we call enqueue(3) method? Note that 7 is
the front element whereas 4 is rear element of queue.
a) 7 5 2 4
b) 3 7 5 2 4
c) 7 5 2 4 3
d) 5 2 4 3

63. Maximum time that an insertion operation can take in AVL tree is .
Here log stands for log to the base of 2.
a) Log (n)
b) 1.44 log (n)
c) 1.66 log (n)
d) Log (n+1)

64. ___ is when function is calling to itself.


a) Loop
b) Recursion
c) Iteration
d) Nested loop

65. Left, right, info, and parent are the operations of data structure.
a) Stack
b) Tree
c) Queue
d) Linked list

66. Following is a keyword of C++


a) Del
b) Delete
c) Remove
d) Eliminate

67. The expression DE+H* is called


a) Prefix expression
b) Infix expression
c) Postfix expression
d) Hybrid expression

68. A software solution is said to be efficient if it solves the problem .


a) By using some extra resources
b) Within no time
c) By consuming more hardware resources
d) Within its resources constraints

69. Each node in a singly linked list contains two fields, one field called data
field while other field contains:
a) Pointer to an integer
b) Pointer to character
c) Pointer to next node
d) Pointer to class

70. Each node in singly linked list contains


a) One pointer
b) Two pointers
c) No pointer
d) NULL pointer
71. Every AVL tree is a binary search tree.
a) True
b) False
c) Not in some cases
d) None of the given

72. In singly linked list “next” field of node contains:


a) Address of next node
b) Object of next node
c) Object of current node
d) Address of head node

73. Two common models of simulation are and .


a) Circuit-based simulation and Event- based simulation
b) Circuit-based simulation and Time-based simulation
c) Time-based simulation and Event- based simulation
d) None of the above

74. Stack and Queue can be implements using .


a) Singly Link List
b) Binary Tree
c) Binary search Tree
d) AVL Tree

75. What are the basic things associated with data structures?
a) Space for each data item it stores
b) Time to perform each basic operation
c) Programming effort
d) All of the above

76. In AVL tree insertion occurs on the inside in case and 3 which a single
rotation cannot fix.
a) 1
b) 2
c) 4
d) 5

77. add(12) method of linked list class will


a) Add 12 nodes in linked list
b) Add 12 pointers in linked list
c) Add 12 as value in linked list
d) Add 12 values in linked list

78. Which of the following is a non- linear data structure?


a) Stack
b) Queue
c) Tree
d) Linked list

79. Which data structure allows deleting data elements from front anf inserting
at rear?
a) Stacks
b) Queues
c) Deques
d) Binary search tree

80. Array cells are in computer memory.


a) Contiguous
b) Random
c) Store in multiple Variables
d) Store in multiple functions

81. A kind of expression where the operator is present between two operands
called expressions.
a) Infix
b) Postfix
c) Prefix
d) None of the above

82. back() method of list class is used to


a) Moves the "current" pointer to backward one element.
b) Moves the "current" pointer to backward two element.
c) Moves the "current" pointer to backward three element.
d) Moves the "current" pointer to backward four element.

83. next() method of List class is used to:


a) Moves the Current position backward one element
b) Moves the "Current" pointer to two steps after the last element of the array
c) Moves the Current position forward one element
d) Moves the "Current" pointer to two steps before the last element of the
array

84. ___ tree has been named after two persons Adelson-Velskii and Landis.
a) Binary
b) Black
c) AVL
d) VLA

85. There are four cases of rotation in an tree.


a) ELV
b) EVL
c) AVL
d) ALV

86. is used for reference variable in C++.


a) !
b) @
c) #
d) &

87. A is a tree in which every level, except possibly the last, is completely
filled, and all nodes are as far left as possible.
a) Strict binary tree
b) Full binary tree
c) Perfect binary tree
d) Complete binary tree
88. A queue is a data structure where elements are
a) Inserted at the front and removed from the back
b) Inserted and removed from the top
c) Inserted at the back and removed from the front
d) Inserted and removed from both ends

89. Longest path from root node to farthest leaf node is called of tree.
a) Level
b) Length
c) Depth
d) Node level

90. New items are added at the of the stack.


a) Bottom
b) Middle
c) Center
d) Top

91. Length() method of list class is used to:


a) Return the length of the array
b) Return the length of the list
c) Return the length of empty part of the array
d) Return the length of empty part of the list

92. The function calls are made with the help of .


a) Stack
b) Heap
c) Dynamic memory
d) External memory

93. An efficient program execute faster and helps in the usage of resources
like memory and disk
a) Maximizing
b) Minimizing
c) Equalizing
d) None of the given

94. Generalized code written for a class is called:


a) Function
b) Template
c) Structure
d) Stack

95. "set()" method of list class is used to:


a) Set the value of Pointer
b) Set the value of Null Nodes
c) Set the value of objects
d) Set the value of Value
96. In C++, we place the class interface in file.
a) .cpp
b) .cppp
c) .h
d) .hh

97. Every tree is a binary search tree.


a) AVL
b) binary
c) big
d) small

98. If both left and right nodes of a node are NULL then this type of node is
called node.
a) Non leaf
b) internal
c) inner
d) leaf

99. Which of the following function don’t belongs to the stack class?
a) push()
b) pop()
c) crash()
d) top()

100. For a complete binary tree, the depth is calculated as


a) log2(number of nodes+1)-1
b) log2(number of nodes*1)+1
c) log2(number of nodes-1)-1
d) log2(number of nodes-1)+1
101. only removes items in reverse order as they were entered
a) Queue
b) Stack
c) Both of these
d) None of these

102. What will be the postfix expression of following infix expression?


D+E*F/G
a) DE*F/G
b) DE+F*G/
c) DEF*/+
d) DE+FG*/

103. The of a node in a binary tree is defined as the height of its sub
tree minus height of its right sub tree.
a) Height
b) Balance
c) Width
d) None

104. The back() method decreases the value of Variable current by


a) Four
b) Three
c) Two
d) One
105. In doubly linked list there is/are pointer/s in each node.
a) One
b) Two
c) Three
d) Four

106. Suppose we have the following values to be inserted in constructing AVL


tree, 10, 13, 15, 5, 7, 8
Tell when first rotation will take place.
a) After inserting node 13
b) After inserting node 15
c) After inserting node 5
d) After inserting node 7

107. Binary search algorithm cannot be applied to


a) Sorted linked list
b) sorted binary trees
c) sorted linear array
d) None of given option

108. During the execution of a process operating system constructs focus


things for that process which of the following is not part of that process
a) A section for static data including global variable
b) Stack
c) Heap
d) Linked list
109. Which one of the following method does not change the original value of
the argument in the calling function?
a) Call by passing reference of the argument
b) Call by passing the address of the argument
c) Call by passing the value of the argument
d) None of the given options
110. is the major factor to see the efficiency of a program.
a) Quality
b) Time
c) Correctness
d) None of the given

111. While implementing stack with an array and to achieve LIFO behavior,
we used push and pop elements at .
a) The start of the array
b) The end of the array
c) The mid of the array
d) At least one position before array starting index.

112. A template is a function or class that is written with a


a) Specific
b) Definite
c) Generic
d. None of the above
113. In the linked list implementation of the stack class, where does the push
member function places the new entry on the linked list?
a) After all other entries that are greater than the new entry
b. At the head
c) After all other entries that are smaller than the new entry
d) At the tail

114. The next field in the last node in a singly-linked list is set to .
a) 0
b) 1
c) NULL
d) False

115. Consider the linked list having data [6, 72, 35, 65,25] stored in it. While
current pointer is pointing memory location having 72 stored in it. After calling
remove() function on the following linked list current point will point to memory
location having value?
a) 6
b) 35
c) 65
d) 25

116. If we write functions for recursive and non recursive inorder traversal
method of BST, what will be the difference between its functions prototypes?
a) Different return types
b) Different function names
c) Different arguments list
d) Nothing will be different
117. In singly linked list a node comprises of field/s.
a) One
b) Two
c) Three
d) Four

118. Doubly linked list always has NULL pointers in a node.


a) One
b) Two
c) Three
d) Four

119. A BST generated from the data in ascending order is .


a) Linear
b) Nonlinear
c) Balanced
d) Un sorted

120. Linked list is generally considered an example of type of memory


location.
a) Static
b) Compile time
c) Dynamic
d) None of given options
121. What’s wrong with following loop? while((i < 10) && (i > 24)){
}
a) The logical operator && cannot be used in a test condition
b) The while loop is an exit-condition loop
c) The test condition is always false
d) The test condition is always true

122. Making the tree unbalanced, it violates the rule.


a) Linked list
b) Stack
c) AVL
d) Queue

123. copy() method of list data structure


a) copy first item of list
b) set one list to be a copy of another
c) copy last item of list
d) copy any item of list

124. Deleting a node in BST is a case.


a) Root, simplest
b) Left child, simplest
c) Right child, simplest
d) Leaf, simplest

125. We can not remove items randomly from


a) Stack
b) Queue
c) Both of these
d) None of these

126. NULL is an invalid address and .


a) Accessible
b) Inaccessible
c) Points to the start point of the list
d) Points to the last point of the list

127. A stack carries behavior.


a) FIFO
b) LIFO
c) AVCO
d) FEFO

128. The tree data structure is a


a) Linear data structure
b) Non-linear data structure
c) Graphical data structure
d) Data structure like queue

129. Can we store elements with different data types in a single array?
a) Yes
b) No
c) In some cases
d) None of given

130. The lifetime of a transient object can exceed that of application which is
accessing it.
a) True
b) False
c) In some cases
d) None of the given

131. In a complete binary tree, for 25000 nodes the depth will be .
a) 13
b) 14
c) 15
d) 16

132. The smallest value element in a binary search tree(Each node with left
and right pointer) lies at
a) Root Node
b) Left Child of Root
c) Right Most Node
d) Left Most Node

133. If there are nodes in an avl tree its levels will be roughly as log2(10
million)
a) 100 million
b) 10 million
c) 5 million
d) 2 million

134. Which one is the correct function call for the following function of
calculatincube? int cube(int&num)
{
.
.
.
a) Cube(&num)
b) Cube(&&num)
c) Cube(*num)
d) Cube(num)

135. Which of the following is the correct option for priority Queue?
a) The type of Queue that is not FIFO i.e the person who comes first may not
leave first
b) The type of Queue that is not FIFO i.e the person who comes first
should leave first
c) The type of Queue that is not FIFO i.e the person who comes first should
leave first
d) The type of Queue that is not FIFO i.e the person who comes first may not
leave first

136. For String-based Binary Search Tree, We use ASCII values of characters
for comparing among letters. This method is known as
a) Lexicographic order
b) Alphabet coding procedure
c) Asymmetric technique
d) heap-based approach

137. Elements in a queue data structure are added from and remove from
.
a) Rear end. front end
b) Front end. Rear end
c) Front end
d) rear end

138. If numbers 5,222,4,48 are inserted in a queue. Which one will be remove
first?
a) 48
b) 4
c) 222
d) 5

139. A zigzag rotation is performed. In Left-Left case of rotation in AVL tree.


a) True
b) False
c) In some cases
d) None of the above

140. During deletion of node from BST. if we found this node don't have in-
order successor and predecessor. it means this node is
a) Left Most node in the binary search tree
b) Right most node in the binary search tree
c) Root node
d) None of the given option

141. _ rule applies for evaluating operators of same precedence in an


expression
a) right to left
b) Cascading
c) Associative
d) None of the above

142. What will be result of following postfix expression? 1 2 3 * + 2 –


a) 3
b) 4
c) 5
d) 10

143. The main use of AVL tree is:


a) Searching of data
b) Storing of data
c) Insertion of data
d) Security of data

144. 145. y = &x[0];


In the above statement, we get the address of the fist location of the array x
and store it in y. Here “y” is:
a) rvalue
b) xvalue
c) lvalue
d) zvalue

145. what will be postfix expression of the following infix expression?


Infix expression a+b*c-d
a) ab+c*d-
b) abc*+d-
c) abcd+*-
d) abc+*d-

146. Which of the following is the correct conversion of infix to postfix


expression?
Z+B-(D-H)/K
a) ZB+D-H-K/
b) ZB+DH-K-/
c) ZB+DH-K/-
d) ZB+DHK--/

147. Leaf node of binary search tree contains .


a) One null pointer
b) Three null pointers
c) Two null pointers
d) All of the given

148. A tree is an AVL tree if


a) Any one node ful fills tha AVL condition
b) At least half of the nodes fulfill the AVL condition
c) All the nodes fulfill the AVL condition
d) None of the given options

149. The of a binary tree is the maximum level of its leaves (also called the
depth).
a) Level
b) Width
c) Height
d) None of the above
150. Memory address is stored in
a) Address operator
b) Reference
c) Pointer
d) All of the given

151. A binary tree is said to be a binary tree if every non-leaf node fu tree
has non-empty left and right sub trees.
a) Complete
b) Strictly
c) AVL
d) Perfect

152. “+” is aoperator.


a) Unary
b) Binary
c) Ternary
d) None of the above
153. Consider the following push operations of a Stack
Stack.push(4)
Stack.push(6)
Stack.push(5)
Stack.push(8)
If a user calls a pop() operation, then which value will be returned?
Select the correct option
a) 4
b) 6
c) 8
d) 5

154. In AVL tree during insertion, a single rotation can fix the balance in cases
_________ and 4.
1

155. If a node is inserted in outer side of a node in binary search tree then to
make it AVL tree,
We may have to apply single rotation

156. A zigzag rotation is performed. In Left-Left case of rotation in AVL tree.


False
157. The principal benefit of a linked list over a conventional array is that the
order of the linked items may be_______ from the order that the data items
are stored in memory.
Same

158. Stack.push(15) will push 15 on _________.


Top of the stack

159. Suppose we have the following values to be inserted in constructing AVL


tree,
10,13,15,5,7,8
Tell when first rotation will take place,
After inserting the node 15
160. All the objects created using ___________ operator have to be explicitly
destroyed using the delete operator.
New

161. During the execution of a process, operating system constructs four


things for that process. Which of the following is not part of that process?
Linked list

162. There are _________cases of Rotation in AVL tree.


4

163. Which of the following line of code is incorrect?


Float *I = float new (not confirmed)

164. In simple or singly linked list there is/are ________ pointer/s in each
node.
One

165. Suppose there are three nodes tree with three numbers 14, 4, 15.
Following is not a permutation, or combination for output them.
(4, 4, 15)

166. The type of expression in which operator succeeds its operands


is___________ expression.
Postfix

167. The _________ of a node in a binary tree is defined as the height of its
left subtree minus height of its right subtree.
Balance

168. If both left and right nodes of a node are NULL then this type of node is
called a ______ node.
Non leaf (not confirmed)

167. The function calls are made with the help of__________.
Stack

169. Which data structure is needed to convert infix expression to postfix


expression?
Stack
170. In case of insertion of right inner node in BST,
Left rotation then right to make AVL

171. A BST generated from the data in ascending order is ____________.


Linear

172. Which operation of queue data structure is used to get front element from
the queue and then remove it from the queue?
Remove ()

173. In _________ various cells of memory are not located continuously.


Linked list

174. The _______ method of list will position the currentNode and
lastCurrentNode at the start of the list.
Start

175. Which operation of queue data structure is used to insert an element into
the Queue?
Enqueuer ()

176. From Operating System point of view, the recursive function calls are
made with the help of __________.
Queue

177. We can make a lexicographic order of characters based on their


_____________.
ASCII values

178. What are the basic things associated with data structures?
All of the above

179. Consider the following push operations of a Stack:


Stack.push(4);
Stack.push(6);
Stack.push(5);
Stack.push(8);
If a user calls a pop() operation, then which value will be returned?
8 (stack is last in fist out)

180. ~BinarySearchTree( ) is a _______________.


Destructor

181. Array cells are _________ in computer memory.


Contiguous

182. Leaf node of binary search tree contains ________


One Null Pointer

183. dequeue() operation of queue data structure is used to____________


remove an element from the front and return it

184. The depth of a binary tree is


Maximum level of a leaf

185. Which of the following operation returns but do not removes top value of
the stack?
Top

186. Which of the following data structure is linear type?


All of above

187. In doubly linked list a node consists of three parts:


2 pointers and 1 object

188. Last node in circular linked list contains


No null pointer

189. A_________ model attempts to model a real-world phenomenon


Simulation

190. Factorial is an example of __________function.


Recursive

191. The balance of a node in a binary tree is defined as the height of its
_______ sub tree minus height of its right sub tree.
Left

192. In case of insertion of left outer node in BST,


We first apply left rotation and then rotation to make it an AVL Tree.
193. int htdiff = height(root->getLeft()) height(root->getRight()); The above
line of code is taken from AVL insert method. Complete it by selecting an
appropriate symbol.
Minus (-)

194. Each operator in a postfix expression refers to the previous _______


operand(s).
Two

195. For making Binary Search Tree for Strings we need, ________ data
type.
Int

196. A _________model attempts to model a real-world phenomenon


Simulation

197. The lifetime of a transient object cannot exceed that of the application.
True

198. Which one of the following calling method does not change the original
value of the argument in the calling function?
Call by passing the value of the argument

199. In level-order traversal for Binary Search Tree, we visit the nodes at each
level before proceeding to the next level, in a _________ order.
Left-to-right

200. In doubly linked list a node consists of three parts:


1 pointer and 2 objects

201. Binary Search Tree voilates the condition of AVL tree when any node
has balance equal to
1 or -1

202. To search an element in ALV tree, it takes maximum 1.88 Log 2n time
True

203. HOW many cases of rotation are there in AVL tree?


4
204. __________ tree has been named after two persons Adelson-Velskii and
Landis.
AVL

205. Which of the following is a nonlinear data structure?


Tree

206. AVL tree is nonlinear data structure.


True

207. _________ is when function is calling to itself.


Recursion

208. Which of the following function don't belongs to the stack class?
Crash ()

209. Which one is the cored function call for the following function of
calculating cube?
int cube(int& num)
cube (num)

210. Binary search algorithm cannot be applied to ____


None of the given

211. copy() method of list data structure __________


Set one list to be a copy of another

212. While implementing non-recursive traversal for Binary Search Tree, we


need to implement
Stack

213. Following is true in case of using Recursive method calls


The code becomes very short

214. ________is a self-balancing tree.


Binary Search Tree

215. While implementing stack with an array and to achieve LIFO behavior,
we used push and pop elements at
The start of the array
216. Generalized code written for a class is called
Structure

217. Army cells are ___________ in computer memory


Contiguous

218. In singly linked list a node comprises of __________ field/s.


Two

219. Which of the following statement is false?


Pointers store the next data element of a list

220. Leaf node of binary search tree contains ________


One null Pointer

221. What will be the result of evaluating following expression? 5+3*2/(6-3)


7

222. Want and de-allocating memory for linked lest nodes does take hrne than
pre-allocated array
MORE

223. Suppose you are writing a class for Node class and forgot to write the
constructor of the class, then
Compiler will automatically generate a default constructor

224. Factorial is an example of __________function.


Recursive

225. A binary tree is said to be a _____ binary tree if every non-leaf node in a
binary tree has non-empty left and right subtrees.
Strictly

226. Memory address is stored in


Pointer

227. In level-order traversal for Binary Search Tree, __________ data


structure is used.
Queue
228. Which of the following is the correct option for priority Queue?
The type of queues that is FIFO i.e. the person who comes first should
leave first.

229. AVL tree is linear data structure.


False

230. AVL tree is a binary search tree


True

231. The post order traversal of a binary tree is DEBFCA. Find out the pre
order traversal

A
Ʌ
B C
Ʌ ̸
DEF
ABDCEF

232. In a tree, we link the nodes in such a way that it ___________ a linear
structure.
Does not remain

233. add(12) method of linked list class will:


Add 12 as value in linked list

234. Which of the following is the correct conversion of infix to postfix


expression?
Z+B-(D-H)/K
ZB+DH-K/-

235. In singly linked list “next” field of node contains:


Address of next node

236. Which of the following line of code is incorrect?


The lifetime of a transient object can exceed that of the application
which is accessing it.

237. A list is the collection of items of the _________


same type
238. back() method of List class is used to:
Moves the “current” pointer to backward one element.

239. Suppose you are writing a class for Node class and forgot to write the
constructor of the class, then _________ is the maximum height of the AVL
tree.
1.44log2n

240. length() method of List class is used to:


Return the length of the list

241. There are four cases of rotation in an __________ tree.


AVL

242. Allocating and de-allocating memory for linked list nodes does take
_________ time than pre-allocated array.
More

243. ________ is utilized at the time of memory allocation in dynamic manner.


Heap

244. In which case of insertion we require double rotation to make the AVL
tree balance.
None

245. The back() method decreases the value of variable current by


__________.
One

246. In array list the worst case of removing an element is


To remove the item from start

247. Left, right, info, and parent are the operations of _________ data
structure.
Tree

248. Which of the following is TRUE for search operations in a binary tree as
compared to linked list or an array?
It increase the number of comparison
249. Which of the following is a correct statement?
An AVL tree is identical to BST except the height of left and right subtree
can differ by at least 1

250. length() method of List class is used to:


Return the length of the list

251. Whenever we call a function, the compiler makes a stack, the top
element of the stack is _______ of the function.
Return Address

252. Whenever we call a function, the compiler makes a _________ that it


uses to fulfill this function call.
Stack

253. _______ is the major factor to see the efficiency of a program.


Time

254. __________ rule applies for evaluating operators of same precedence in


an expression
None

255. The postfix form of the expression A + B * C and (A + B) * C will be


_______.
Same

256. If we use array to implement list, then there is an issue that it gives
difficulty when:
We will access value randomly

257. During in-order traversal using recursive calls, if we found a node is


NULL. It means this node will satisfy following condition.
It will not have left child

258. Which one the following is more closer to AVL tree, (chose the best
option)
Binary Search Tree

259. start() method of List class is used to:


Move the current pointer to first element
260. Consider the following infix expression.
7/8 + 9
If one converts the above expression into postfix, what would be the resultant
expression?
78/9+

261. In internal memory organization of a process, there is some area of


memory for static data that holds ____________ variables.
Both Static and Global

262. In Left-Right case of rotation in ________ tree. A double rotation is


performed.
AVL

263. If numbers 5, 222, 4, 48 are inserted in a queue, which one will be


removed first?
5

264. Which one is not the property of binary tree?


Sibling node should be same parent (Not Sure)

265. Each node in singly linked list contains_______


One Pointers

266. What's wrong with following loop? while( (i < 10) && (i > 24)) { }
The Condition is always false

267. Josephus problem is resolved by the implementation of ___.


a) Circular Linked list
b) Stack
c) Queue
d) List

268. In which of the following tree for each node, the value of root node is
greater than left child and smaller than right child?
a) Binary search Tree
b) Full Binary Tree
c) Complete Binary Tree
d) Perfect Binary Tree
269. The first statement in the given code is called as:
a) Forward Declaration
b) Binary Declaration
c) Pre Class Declaration
d) Post Class Declaration

270. Convert the given infix from 12+60-23 of expression in postfix form.
a) 12 60 + -30
b) 12 60 + 23 –
d) +12 60 -23

271. The ___ sign before the name of the variable means that the address of
the variable is being
a) ||
b) #
c) ::
d) &

272. The first step to add a node in a linked list between the existing nodes is
a) newNode->getNext();
b) currenntNode->getNext();
c) newNode->setNext();
d) newNode->getNext(currentNode->getNext());

273. If we return the reference of a local variable from a function it will cause:
a) deletion of local variable from memory
b) duplication of local variable
c) reference overloading
d) dangling reference

274. After performing which task on the list, implementing array has to shift
the entire remaining elements one place to the left.
a) By adding element at last
b) By removing element at the end
c) By removing element at start
d) By searching of element

275. If a function has recursive call as the last statement, it is known as ___.
a) Local Recursion
b) Function recursion
c) Tail recursion
d) Last recursion

276. For searching a particular number in Binary Search Tree (if it is not
perfect), the maximum number of comparisons will be ___ comparison at
each level.
a) 4
b) 3
c) 2
d) 1

277. Which kind of data structure is used to evaluate postfix expression?


a) Linked List
b) Queue
c) Stack
d) Tree

278. Level-order traversal for binary search tree can be implemented ___
a) Only through recursive method
b) Through max-heap
c) Only through non-recursive method
d) Through both recursive method call and non-recursive method call

279. The computer memory can be thought of as a/an


a) Array
b) Queue
c) List
d) Stack

280. The ___ of every node should be 1,0 or -1 otherwise, it will not be an
AVL tree.
a) size
b) width
c) length
d) balance

281. Which of the following is not a form of expression?


a) Postfix
b) Pastfix
c) Prefix
d) Infix
282. A BST generated form the data in ascending order is ___.
a) Un sorted
b) Nonlinear
c) Linear
d) Balanced

283. Which of the following is true for search operations in a binary tree as
cooperated to linked list or an array?
It reduces the number of comparisons

284. When a function, the parameters and return address of the calling
function are put in____________
Stack

285. Supppose we have a value for Queue 2 1 4 6 3


Where front is at 2 and rear is at 3. After deqeue one element from that
queue. What will be the resultant Queue?
1463

286. Josephus problem is resolved by the implementation of ____________


Circular link list

287. in which of the following tree for each node, the value of root node is
greater than the left child and smaller than right child?
Binary search tree

288. The first statement in the given code is called as:


Class BinarySearchTree;
Class BinaryNode {
Friend class BinarySearchTree;
};
Forward declaration

289. The _ of every node has 1,0 or -1 otherwise, it will not be an AVL tree.
Balance

290. Which of the following operations returns the contents of a binary tree
node?
Info(p)

291. In a complete binary tree the number of nodes at level 5 are


32

292. At the time while evaluating an expression, if we want to give higher


precedence to lower precedence operator, we used
Parenthesis

293. To create a ----------we link the last node with the first node in the list.
Circularly-linked list

294. The first statement in the given code is called as:


Class Binarysearch tree;
Class binaryNode {
Friend class BinarySearchTree;
}
Pre class Declaration

295. If we want to return first element of the list which one method will be
used.
Get();

296. Convert the given infix form 12+60-23 of expression in postfix form.
12 60+23-

297. In which of the following function signatures, the value of variable “num”
cannot be changed in function body?
Int cube(const int&num)

298. A Queue is a ----------data structure, whereas a stack is a ------- data


structure.
FIFO, LIFO

299.when a function calls another function., the parameters and return


address of the calling functions are put in-------.
Stack

You might also like