# Data Structures

## Data Structures – CS301

Question No: 1      ( Marks: 1 ) – Please choose one

A queue where the de-queue operation depends not on FIFO, is called a priority queue

False

True

Question No: 2      ( Marks: 1 ) – Please choose one

The data of the problem is of 2GB and the hard disk is of 1GB capacity, to solve this problem we should

• Use better data structures
• Increase the hard disk space
• Use the better algorithm
• Use as much data as we can store on the hard disk

Question No: 3      ( Marks: 1 ) – Please choose one

Consider the function X as under int X (int& Value)

{

return Value;

}

Now a and b are integers in a calling function. Which one of the following is a valid call to the above function X.

• a = X (b) ;
• a = X (&b) ;
• a = X (*b) ;
• None of the given options

Question No: 4      ( Marks: 1 ) – Please choose one

In the call by value methodology, a copy of the object is passed to the called function.

• False
• True

Question No: 5      ( Marks: 1 ) – Please choose one

The tree data structure is a

• Graphical data structure
• Data structure like queue
• Non-linear data structure
• Linear data structure

Question No: 6 ( Marks: 1 ) – Please choose one

When should you use a const reference parameter?

• Whenever the parameter has huge size.
• Whenever the parameter has huge size, the function changes the parameter within its body, and you do NOT want these changes to alter the actual argument.
• Whenever the parameter has huge size, the function changes the parameter within its body, and you DO want these changes to alter the actual argument.
• Whenever the parameter has huge size, and the function does not change the parameter within its body.

Question No: 7      ( Marks: 1 ) – Please choose one

Here is the start of a C++ class declaration: class foo

{

public:

void x(foo f);

void y(const foo f); void z(foo f) const;

Which of the three member functions can alter the PRIVATE member variables of the foo object that activates the function?

• Only x can alter the private member variables of the object that activates the function.
• Only y can alter the private member variables of the object that activates the function.
• Only z can alter the private member variables of the object that activates the function.
• Two of the functions can alter the private member variables of the object that activates the function.

Question No: 8      ( Marks: 1 ) – Please choose one

What is the maximum depth of recursive calls a function may make?

• 1
• 2
• n (where n is the argument)
• There is no fixed maximum

Question No: 9      ( Marks: 1 ) – Please choose one

Suppose n is the number of nodes in a complete Binary Tree then maximum steps required for a search operation are,

• Log2 (n+1) -1
• Log2 (n+1)
• Log2 (n) – 1
• Log2 (n)

Question No: 10      ( Marks: 1 ) – Please choose one

In the linked list implementation of the stack class, where does the push member function places the new entry on the linked list?

• At the tail
• After all other entries that are greater than the new entry.
• After all other entries that are smaller than the new entry.

Question No: 11      ( Marks: 1 ) – Please choose one

Suppose we have a circular array implementation of the queue class, with ten items in the queue stored at data[2] through data[11]. The CAPACITY is 42, i.e., the array has been declared to be of size 42. Where does the push member function place the new entry in the array?

• data[1]
• data[2]
• data[11]
• data[12]

Question No: 12      ( Marks: 1 ) – Please choose one

The expression AB+C* is called?

Prefix expression

► Postfix expression

Infix expression

None of these

Question No: 13      ( Marks: 1 ) – Please choose one

_________ is a binary tree where every node has a value, every node’s left subtree contains only values less than or equal to the node’s value, and every node’s right subtree contains only values that are greater then or equal?

Strictly Binary Tree

► Binary Search tree

AVL tree

All of these

Question No: 14      ( Marks: 1 ) – Please choose one

We access elements in AVL Tree in,

• Linear way only
• Non Linear way only
• Both linear and non linear ways
• None of the given options.

Question No: 15      ( Marks: 1 )

AVL Tree is,

• Non Linear data structure
• Linear data structure
• Hybrid data structure (Mixture of Linear and Non Linear)
• None of the given options.

Question No: 16   ( Marks: 1 ) – Please choose one

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

• One
• Two
• Three
• Four

Question No: 17     ( Marks: 1 ) – Please choose one

Which one of the following calling methods does not change the original value of the argument in the calling function?

None of the given options

► Call by passing the value of the argument

Call by passing reference of the argument

Call by passing the address of the argument

Question No: 18      ( Marks: 1 ) – Please choose one

A tree is an AVL tree if

• Any one node fulfills the AVL condition
• At least half of the nodes fulfill the AVL condition
• All the nodes fulfill the AVL condition
• None of the given options

Question No: 19    ( Marks: 1 ) – Please choose one

Suppose currentNode refers to a node in a linked list (using the Node class with member variables called data and nextNode). What statement changes currentNode so that it refers to the next node?

• currentNode ++;
• currentNode = nextNode;
• currentNode += nextNode;
• currentNode = currentNode->nextNode;

Question No: 20     ( Marks: 1 ) – Please choose one

A queue where the de-queue operation depends not on FIFO, is called a priority queue

• False
• True

Question No: 21     ( Marks: 1 ) – Please choose one

Which one is a self- referential data type?

• Stack
• Queue
• All of these

Question No: 22     ( Marks: 1 ) – Please choose one

Each node in doubly link list has,

1 pointer

► 2 pointers

3 pointers

4 pointers

Question No: 23    ( Marks: 1 ) – Please choose one

I have implemented the queue with a linked list, keeping track of a front pointer and a rear pointer. Which of these pointers will change during an insertion into an EMPTY queue?

• Neither changes
• Only front pointer changes.
• Only rear pointer changes.
• Both change.

Question No:24      ( Marks: 1 ) – Please choose one

The nodes with no successor are called _________

• Root Nodes
• Leaf Nodes
• Both of these
• None of these

Question No: 25      ( Marks: 1 ) – Please choose one

AVL Tree is,

• Non Linear data structure
• Linear data structure
• Hybrid data structure (Mixture of Linear and Non Linear)
• None of the given options.

Question No: 26      ( Marks: 1 ) – Please choose one

We access elements in AVL Tree in,

• Linear way only
• Non Linear way only
• Both linear and non linear ways
• None of the given options.

Question No: 27      ( Marks: 1 ) – Please choose one

Consider the following statements.

• A binary tree can contain at least 2L Nodes at level L.
• A complete binary tree of depth d is a binary tree that contains 2L Nodes at each level L between 0 and d, both inclusive.
• The total number of nodes (Tn ) in a complete binary tree of depth d is 2 d+1 – 1 .
• The height of the complete binary tree can be written as h = log 2 (Tn+1)-1 where Tn is Total number of Nodes.

Which one of the following is correct in respect of the above statements regarding the Binary trees?

• (i) and (iii) only
• (i), (ii) and (iii) only
• (ii) and (iii) only
• (ii), (iii) and (iv) only

Question No: 28      ( Marks: 1 ) – Please choose one

“+” is a _________operator.

• Unary
• Binary
• Ternary
• None of the above

Question No: 29   ( M a r k s: 1 ) – Please choose one

A subscript of an array may be an integer or an integer expression.

• True
• False

Question No: 30   ( M a r k s: 1 ) – Please choose one

Doubly Linked List always has one NULL pointer.

• True
• False

Question No: 31   ( M a r k s: 1 ) – Please choose one

In which of the traversal method, the recursive calls can be used to traverse a binary tree  ?

• In preorder traversal only
• In inorder traversal only
• In postorder traversal only
• All of the given options

Question No: 32  ( M a r k s: 1 ) – Please choose one

A tree is an AVL tree if

• Any one node fulfills the AVL condition
• At least half of the nodes fulfill the AVL condition
• All the nodes fulfill the AVL condition
• None of the given options

Question No: 33 ( M a r k s: 1 ) – Please choose one

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: 34   ( M a r k s: 1 ) – Please choose one

The operation for removing an entry from a stack is traditionally called:

• delete
• peek
• pop
• remove

Question No: 35   ( M a r k s: 1 ) – Please choose one

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: 36   ( M a r k s: 1 ) – Please choose one

________ 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
• None of these

Question No: 37   ( M a r k s: 1 ) – Please choose one

Which of the following can be used to reverse a string value,

• Queue
• Stack
• Both of these
• None of these

Question No: 38   ( M a r k s: 1 ) – Please choose one

AVL Tree is,

• Non Linear data structure
• Linear data structure
• Hybrid data structure (Mixture of Linear and Non Linear)
• None of the given options.

Question No: 39   ( M a r k s: 1 ) – Please choose one

The following are statements related to queues.

• The last item to be added to a queue is the first item to be removed
• A queue is a structure in which both ends are not used
• The last element hasn’t to wait until all elements 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 options

Question No: 40   ( M a r k s: 1 ) – Please choose one

An array is a group of consecutive related memory locations.

• True
• False