CS301- Data Structures
MIDTERM EXAMINATION Spring 2010
Question No: 1 ( M a r k s: 1 )
A subscript of an array may be an integer or an integer expression.
► True Click here for detail
► False
Question No: 2 ( M a r k s: 1 )
Doubly Linked List always has one NULL pointer.
► True
► False(Page 43)
Question No: 3 ( M a r k s: 1 )
In which of the traversal method, the recursive calls can be used to traverse a binary tree ?
Ø In preorder traversal only (Page 143)
Ø In inorder traversal only
Ø In postorder traversal only
Ø All ofthe given options
Question No: 4 (M a r k s: 1 ) A tree is an AVL tree if
► Any one node fulfills the AVLcondition
► At least half of the nodes fulfill the AVL condition
► All the nodes fulfill the AVL condition(Page 213)
► None of the given options
Question No: 5 ( M a r k s: 1 )
Suppose currentNode refers to a node in a linked list(using the Node class with member variables called data and nextNode). What boolean expression will be true when cursor refers to the tail node of the list?
► (currentNode ==null)
► (currentNode->nextNode == null)
► (nextNode.data == null)
► (currentNode.data == 0.0)
Question No: 6 ( M a r k s: 1 ) - Please choose one
Suppose that the class declaration of SomeClass includes the following function prototype. bool LessThan( SomeClass anotherObject );
Which of the following tests in the client code correctly compares two class objects alpha and beta?
► if (alpha <beta)
► if (alpha.LessThan(beta)) Click here for detail
► if (LessThan(alpha, beta))
► if (LessThan(alpha).beta)
Question No: 7 (M a r k s: 1 )
In C what is the operation that you can not do with primitive types?
► Assign a value to primitive type using a literal
► Declare primitive types to be constant using theConst keyword
► Create a new instance of primitive type with New keyword Click here for Detail
► None of these
Question No: 8 ( M a r k s: 1 )
The operation for adding an entry to a stack is traditionally called :
► add
► append
► insert
► push(Page 53)
Question No: 9 ( M a r k s: 1 )
The operation for removing an entry from a stack is traditionally called:
► delete
► peek
► pop(Page 53)
► remove
Question No: 10 ( M a r k s: 1 )
Consider the following sequence of push operations in a stack:
stack.push(’7’); stack.push(’8’); stack.push(’9’); stack.push(’10’); stack.push(’11’); stack.push(’12’);
► 7 8 9 10 11 12
► 9 8 11 10 7 12
► 9 10 8 11 12 7
► 9 10 8 12 7 11
Question No: 11 ( M a r k s: 1 )
is the maximum number of nodes that you can have on a stack-linked list ?
► Zero
► 2n (where n is the number of nodes in linked list)
► Any Number Click here fordetail
► None of these
Question No: 12 ( M a r k s: 1 )
Which of the following can be used to reverse a string value,
► StackClick here for detail
► Queue
► Both of these
► None of these
Question No: 14
AVL Tree is,
( M a r k s: 1 )
► Non Lineardata structure Click here for detail
► Linear data structure
► Hybrid data structure (Mixture of Linear and Non Linear)
► None of the given options.
Question No: 15 ( M a r k s: 1 )
The following are statements related to queues.
(i) The last item to be added to a queue is the first item to be removed
(ii) A queue is a structure in which both ends are notused
(iii) The last element hasn’t to wait until allelements preceding it on the queue are removed
(iv)A queue is said to be a last-in-first-out list or LIFO data structure. Which of the above is/are related to normal queues?
► (iii) and (ii) only
► (i), (ii) and (iv) only
► (ii) and (iv) only
► None of the given optionsClick here for detail
Question No: 16 ( M a r k s: 1 )
An array is a group of consecutive related memory locations.
► True Click here for detail
► False