More MCQs
301.

The operation of processing each element in the list is known as

A. sorting
B. merging
C. inserting
D. traversal
Answer» D. traversal
302.

Arrays are best data structures

A. for relatively permanent collections of data
B. for the size of the structure and the data in the structure are constantly changing
C. for both of above situation
D. for none of above situatio
Answer» A. for relatively permanent collections of data
303.

Which of the following statement is true?i) Using singly linked lists and circular list, it is not possible to traverse the list backwards.ii) To find the predecessor, it is required to traverse the list from the first node in case of singly linked list.

A. i-only
B. ii-only
C. both i and ii
D. none of the above
Answer» C. both i and ii
304.

What will be the value of top, if there is a size of stack STACK_SIZE is 5

A. 5
B. 6
C. 4
D. none of the above
Answer» C. 4
305.

………… is not the operation that can be performed on queue.

A. insertion
B. deletion
C. retrieval
D. traversal
Answer» D. traversal
306.

A data structure where elements can be added or removed at either end but not in the middle is called …

A. linked lists
B. stacks
C. queue
D. dequeue
Answer» D. dequeue
307.

Which of the following name does not relate to stacks?

A. fifo lists
B. lifo list
C. piles
D. push-down lists
Answer» A. fifo lists
308.

The term "push" and "pop" is related to the

A. array
B. lists
C. stacks
D. all of the above
Answer» C. stacks
309.

Which data structure allows deleting data elements from front and inserting at rear?

A. stacks
B. queue
C. dequeue
D. binary search tree
Answer» B. queue
310.

node.next -> node.next.next; will make

A. node.next inaccessible
B. node.next.next inaccessible
C. this node inaccessible
D. none of the above
Answer» A. node.next inaccessible
311.

A circular linked list can be used for

A. stack
B. queue
C. both stack & queue
D. neither stack or queue
Answer» C. both stack & queue
312.

In doubly linked lists

A. a pointer is maintained to store both next and previous nodes.
B. two pointers are maintained to store next and previous nodes.
C. a pointer to self is maintained for each node.
D. none of the above
Answer» B. two pointers are maintained to store next and previous nodes.
313.

The disadvantage in using a circular linked list is …………………….

A. it is possible to get into infinite loop
B. last node points to first node.
C. time consuming
D. requires more memory space
Answer» A. it is possible to get into infinite loop
314.

A linear list in which each node has pointers to point to the predecessor and successors nodes is called as

A. singly linked list
B. circular linked list
C. doubly linked list
D. linear linked list
Answer» C. doubly linked list
315.

The situation when in a linked list START=NULL is

A. underflow
B. overflow
C. housefull
D. saturated
Answer» A. underflow
316.

In doubly linked lists, traversal can be performed?

A. only in forward direction
B. only in reverse direction
C. in both directions
D. none of the above
Answer» C. in both directions
317.

What differentiates a circular linked list from a normal linked list?

A. you cannot have the ‘next’ pointer point to null in a circular linked list
B. it is faster to traverse the circular linked list
C. you may or may not have the ‘next’ pointer point to null in a circular linked list
D. head node is known in circular linked list
Answer» C. you may or may not have the ‘next’ pointer point to null in a circular linked list
318.

How do you count the number of elements in the circular linked list?

A. public int length(node head) { int length = 0; if( head == null) return 0; node temp = head.getnext(); while(temp != head) { temp = temp.getnext(); length++; } return length; }
B. public int length(node head) { int length = 0; if( head == null) return 0; node temp = head.getnext(); while(temp != null) { temp = temp.getnext(); length++; } return length; }
C. public int length(node head) { int length = 0; if( head == null) return 0; node temp = head.getnext(); while(temp != head && temp != null) { temp = head.getnext(); length++; } return length; }
D. public int length(node head) { int length = 0; if( head == null) return 0; node temp = head.getnext(); while(temp != head && temp == null) { temp = head.getnext(); length++; } return length; }
Answer» A. public int length(node head) { int length = 0; if( head == null) return 0; node temp = head.getnext(); while(temp != head) { temp = temp.getnext(); length++; } return length; }
319.

public int function()
{
if(head == null)
return Integer.MIN_VALUE;
int var;
Node temp = head;
while(temp.getNext() != head)
temp = temp.getNext();
if(temp == head)
{
var = head.getItem();
head = null;
return var;
}
temp.setNext(head.getNext());
var = head.getItem();
head = head.getNext();
return var;
} What is the functionality of the following code? Choose the most appropriate answer.

A. return data from the end of the list
B. returns the data and deletes the node at the end of the list
C. returns the data from the beginning of the list
D. returns the data and deletes the node from the beginning of the list
Answer» D. returns the data and deletes the node from the beginning of the list
320.

What is the functionality of the following code? Choose the most appropriate answer. public int function()
{
if(head == null)
return Integer.MIN_VALUE;
int var;
Node temp = head;
Node cur;
while(temp.getNext() != head)
{
cur = temp;
temp = temp.getNext();
}
if(temp == head)
{
var = head.getItem();
head = null;
return var;
}
var = temp.getItem();
cur.setNext(head);
return var;
}

A. return data from the end of the list
B. returns the data and deletes the node at the end of the list
C. returns the data from the beginning of the list
D. returns the data and deletes the node from the beginning of the list
Answer» B. returns the data and deletes the node at the end of the list
321.

How do you insert a node at the beginning of the list?

A. public class insertfront(int data) { node node = new node(data, head, head.getnext()); node.getnext().setprev(node); head.setnext(node); size++; }
B. public class insertfront(int data) { node node = new node(data, head, head); node.getnext().setprev(node); head.setnext(node); size++; }
C. public class insertfront(int data) { node node = new node(data, head, head.getnext()); node.getnext().setprev(head); head.setnext(node); size++; }
D. public class insertfront(int data) { node node = new node(data, head, head.getnext()); node.getnext().setprev(node); head.setnext(node.getnext()); size++; }
Answer» A. public class insertfront(int data) { node node = new node(data, head, head.getnext()); node.getnext().setprev(node); head.setnext(node); size++; }
322.

What is a dequeue?

A. a queue with insert/delete defined for both front and rear ends of the queue
B. a queue implemented with a doubly linked list
C. a queue implemented with both singly and doubly linked lists
D. a queue with insert/delete defined for front side of the queue
Answer» A. a queue with insert/delete defined for both front and rear ends of the queue
323.

Suppose a circular queue of capacity (n – 1) elements is implemented with an array of n elements. Assume that the insertion and deletion operation are carried out using REAR and FRONT as array index variables, respectively. Initially, REAR = FRONT = 0. The conditions to detect queue full and queue empty are

A. full: (rear+1) mod n == front, empty: rear == front
B. full: (rear+1) mod n == front, empty: (front+1) mod n == rear
C. full: rear == front, empty: (rear+1) mod n == front
D. full: (front+1) mod n == rear, empty: rear == front
Answer» A. full: (rear+1) mod n == front, empty: rear == front
324.

Suppose implementation supports an instruction REVERSE, which reverses the order of elements on the stack, in addition to the PUSH and POP instructions. Which one of the following statements is TRUE with respect to this modified stack?

A. a queue cannot be implemented using this stack.
B. a queue can be implemented where enqueue takes a single instruction and dequeue takes a sequence of two instructions.
C. a queue can be implemented where enqueue takes a sequence of three instructions and dequeue takes a single instruction.
D. a queue can be implemented where both enqueue and dequeue take a single instruction each.
Answer» C. a queue can be implemented where enqueue takes a sequence of three instructions and dequeue takes a single instruction.
325.

Suppose you are given an implementation of a queue of integers. The operations that can be performed on the queue are:
i. isEmpty (Q) — returns true if the queue is empty, false otherwise.
ii. delete (Q) — deletes the element at the front of the queue and returns its value.
iii. insert (Q, i) — inserts the integer i at the rear of the queue.
Consider the following function:
void f (queue Q) {
int i ;
if (!isEmpty(Q)) {
i = delete(Q);
f(Q);
insert(Q, i);
}
}What operation is performed by the above function f ?

A. leaves the queue q unchanged
B. reverses the order of the elements in the queue q
C. deletes the element at the front of the queue q and inserts it at the rear keeping the other elements in the same order
D. empties the queue q
Answer» B. reverses the order of the elements in the queue q
326.

Consider the following statements:i. First-in-first out types of computations are efficiently supported by STACKS.
ii. Implementing LISTS on linked lists is more efficient than implementing LISTS on
an array for almost all the basic LIST operations.
iii. Implementing QUEUES on a circular array is more efficient than implementing QUEUES
on a linear array with two indices.
iv. Last-in-first-out type of computations are efficiently supported by QUEUES.Which of the following is correct?

A. (ii) and (iii) are true
B. (i) and (ii) are true
C. (iii) and (iv) are true
D. (ii) and (iv) are true
Answer» A. (ii) and (iii) are true
327.

Which of the following option is not correct?

A. if the queue is implemented with a linked list, keeping track of a front pointer, only rear pointer s will change during an insertion into an non-empty queue.
B. queue data structure can be used to implement least recently used (lru) page fault algorithm and quick short algorithm.
C. queue data structure can be used to implement quick short algorithm but not least recently used (lru) page fault algorithm.
D. both (a) and (c)
Answer» C. queue data structure can be used to implement quick short algorithm but not least recently used (lru) page fault algorithm.
328.

Consider a standard Circular Queue 'q' implementation (which has the same condition for Queue Full and Queue Empty) whose size is 11 and the elements of the queue are q[0], q[1], q[2].....,q[10]. The front and rear pointers are initialized to point at q[2] . In which position will the ninth element be added?

A. q[0]
B. q[1]
C. q[9]
D. q[10]
Answer» A. q[0]
329.

Overflow condition in linked list may occur when attempting to .............

A. create a node when free space pool is empty
B. traverse the nodes when free space pool is empty
C. create a node when linked list is empty
D. none of these
Answer» A. create a node when free space pool is empty
330.

Which of the following is not a type of Linked List ?

A. doubly linked list
B. singly linked list
C. circular linked list
D. hybrid linked list
Answer» D. hybrid linked list
331.

Linked list is generally considered as an example of _________ type of memory allocation.

A. static
B. dynamic
C. compile time
D. none of these
Answer» B. dynamic
332.

Each Node contain minimum two fields one field called data field to store data. Another field is of type _________.

A. pointer to class
B. pointer to an integer
C. pointer to character
D. pointer to node
Answer» D. pointer to node
333.

If in a linked list address of first node is 1020 then what will be the address of node at 5th position ?

A. 1036
B. 1028
C. 1038
D. none of these
Answer» D. none of these
334.

In Circular Linked List insertion of a node involves the modification of ____ links.

A. 3
B. 4
C. 1
D. 2
Answer» D. 2
335.

If a list contains no elements it is said to be

A. hollow
B. empty
C. finite
D. infinite
Answer» B. empty
336.

Linked list uses

A. random memory allocation
B. static memory allocation
C. fixed memory allocation
D. dynamic memory allocation
Answer» D. dynamic memory allocation
337.

Standard approach for implementation of a list is/are of

A. 1 type
B. 2 type
C. 3 type
D. 4 type
Answer» B. 2 type
338.

First link node of list is accessed from a pointer named

A. tail
B. head
C. terminator
D. initiator
Answer» B. head
339.

A linked list is made up of a set of objects known as

A. nodes
B. arrays
C. entities
D. instances
Answer» A. nodes
340.

How do you calculate the pointer difference in a memory efficient double linked list?

A. head xor tail
B. pointer to previous node xor pointer to next node
C. pointer to previous node – pointer to next node
D. pointer to next node – pointer to previous node
Answer» B. pointer to previous node xor pointer to next node
341.

A ……………….. is a linear list in which insertions and deletions are made to from either end of the structure.

A. circular queue
B. random of queue
C. priority
D. dequeue
Answer» D. dequeue
342.

Which of the following name does not relate to stacks?

A. fifo lists
B. lifo list
C. piles
D. push-down lists
Answer» A. fifo lists
343.

A data structure where elements can be added or removed at either end but not in the middle is called …

A. arrays
B. stacks
C. queues
D. deque
Answer» D. deque
344.

The postfix form of the expression (A + B)∗(C∗D − E)∗F / G is

A. ab + cd∗e − fg /∗∗
B. / ab + cd ∗ e − f ∗∗g /
C. ab + cd ∗ e − ∗f ∗ g /
D. ab + cde ∗ − ∗ f ∗ g /
Answer» A. ab + cd∗e − fg /∗∗
345.

What is the postfix form of the following prefix expression -A/B*C$DE ?

A. abcde$*/-
B. a-bcde$*/-
C. abc$ed*/-
D. a-bcde$*/
Answer» A. abcde$*/-
346.

The data structure required to evaluate a postfix expression is

A. queue
B. stacks
C. array
D. linked-list
Answer» B. stacks
347.

What is the postfix form of the following prefix: *+ab–cd

A. ab+cd–*
B. abc+*–
C. ab+*cd–
D. ab+*cd–
Answer» A. ab+cd–*
348.

A queue is a,

A. fifo (first in first out) list
B. lifo (last in first out) list
C. ordered array
D. linear tree
Answer» A. fifo (first in first out) list
349.

In stack terminology, the __________operations are known as push and pop operations respectively.

A. delete
B. insert
C. both (a) and (b)
D. none of the above
Answer» C. both (a) and (b)
350.

A common example of a queue is people waiting in line at a__________.

A. bus stop
B. movie hall
C. shopping mall
D. none of the above
Answer» A. bus stop
351.

What is one of the common examples of a stack?

A. a pile of books
B. bus stop
C. a basket of fruits
D. a carat of eggs
Answer» A. a pile of books
352.

When a stack is organized as an array, a variable named Top is used to point to the top element of the stack. Initially, the value of Top is set to_______to indicate an empty stack.

A. -1
B. 0
C. 1
D. x
Answer» A. -1
353.

What happens when the stack is full and there is no space for a new element, and an attempt is made to push a new element?

A. overflow
B. underflow
C. top
D. none of the above
Answer» A. overflow
354.

The total number of elements in a stack at a given point of time can be calculated from the value of______.

A. overflow
B. top
C. queues
D. underflow
Answer» B. top
355.

When the push operation is performed on stack the value of TOS will be ______

A. decrement
B. increment
C. one
D. none of these
Answer» B. increment
356.

A double linked list contains reference to _____

A. previous node
B. next node
C. current node
D. both a & b
Answer» D. both a & b
357.

Data Structure that are created by user as per their requirement are known as

A. primitive data structure
B. non-primitive data structure
C. both a & b
D. none of these
Answer» A. primitive data structure
358.

To insert element at start, the previous pointer of newly added node would point to ______

A. null
B. next node
C. new node
D. head node
Answer» A. null
359.

In linked list implementation, a node carries information regarding

A. the data
B. the link
C. both a & b
D. none of these
Answer» C. both a & b
360.

Which of the following data structure is linear type?

A. strings
B. stack
C. queue
D. all of these
Answer» D. all of these
361.

Stack is ____ type of data structure.

A. lifo
B. fifo
C. both a & b
D. none of these
Answer» A. lifo
362.

In stack deletion operation is referred as _____

A. push
B. pop
C. peek
D. none of these
Answer» B. pop
363.

Queue is _____ type of data structure.

A. lifo
B. fifo
C. both a & b
D. none of these
Answer» B. fifo
364.

Data structre is divided into _____ parts.

A. 4
B. 3
C. 2
D. 1
Answer» C. 2
365.

In ___ Data Structure data can be processed one by one sequentially

A. array
B. linked list
C. tree
D. none of these
Answer» B. linked list
366.

When we insert an element in Queue, which pointer is increased by one?

A. front
B. rear
C. both a & b
D. none of these
Answer» B. rear
367.

Which of the following is not the possible operation on stack?

A. push
B. pop
C. display
D. enqueue
Answer» D. enqueue
368.

Which of the following is a possible operation on queue?

A. push
B. pop
C. display
D. enqueue
Answer» D. enqueue
369.

In stack, to display the lastly inserted element without removing it, which function is used?

A. push
B. pop
C. display
D. peek
Answer» D. peek
370.

if there are no nodes in linked list then start pointer will point at which value?

A. null
B. garbage
C. 1
D. 2
Answer» A. null
371.

Worst space complexity of queue data structure is

A. o(n)
B. o(log(n))
C. o(1)
D. n/a
Answer» A. o(n)
372.

Worst space complexity of stack data structure is

A. o(log(n))
B. o(1)
C. n/a
D. o(n)
Answer» D. o(n)
373.

Worst space complexity of singly linked list is

A. o(n)
B. o(1)
C. o(log(n))
D. n/a
Answer» A. o(n)
374.

A ___________refers to a single unit of values.

A. data value.
B. attribute value.
C. data item.
D. elementary.
Answer» C. data item.
375.

Data items that are divided into subitems are called ___________.

A. single items.
B. group items.
C. elementary items.
D. entity items.
Answer» B. group items.
376.

Which of these best describes an array?

A. A data structure that shows a hierarchical behavior
B. Container of objects of similar types
C. Container of objects of mixed types
D. All of the mentioned
Answer» B. Container of objects of similar types
377.

In _______________all the records contain the same data items with the same amount of space.

A. variable-length records.
B. fixed-length records.
C. subscripted variable.
D. superscripted variable.
Answer» B. fixed-length records.
378.

The logical or mathematical model of a particular organization of data is called a _______________.

A. data structure.
B. algorithms.
C. structure.
D. logic structure.
Answer» A. data structure.
379.

Arrays are best data structures for _____________________________.

A. relatively permanent collections of data.
B. the size of the structure and the data in the structure are constantly changing.
C. both of above situation.
D. None of the above.
Answer» A. relatively permanent collections of data.
380.

How do the nested calls of the function get managed?

A. Through Queues.
B. Through Stacks.
C. Through Trees.
D. Through Graphs.
Answer» B. Through Stacks.
381.

__________is combining the records in two different sorted files in to a single sorted file.

A. Sorting.
B. Searching.
C. Listing.
D. Merging.
Answer» D. Merging.
382.

In linear search algorithm the Worst case occurs when ____________.

A. The item is somewhere in the middle of the array.
B. The item is not in the array at all.
C. The item is the last element in the array.
D. The item is the last element in the array or is not there at all.
Answer» D. The item is the last element in the array or is not there at all.
383.

The complexity of Binary search algorithm is ____________.

A. O(n).
B. O(log n ).
C. O(n2).
D. O(n log n).
Answer» B. O(log n ).
384.

The complexity of Bubble sort algorithm is _________.

A. O(n).
B. O(log n).
C. O(n2).
D. O(n log n).
Answer» C. O(n2).
385.

Inorder traversal of binary search tree will produce _______________.

A. unsorted list.
B. sorted list.
C. reverse of input.
D. none of these.
Answer» B. sorted list.
386.

Sub algorithms fall into two basic categories: function sub algorithms and ____________ sub algorithms.

A. procedure.
B. argument.
C. processor.
D. methods.
Answer» A. procedure.
387.

Two main measures for the efficiency of an algorithm are____________.

A. Processor and memory.
B. Complexity and capacity.
C. Time and space.
D. Data and space.
Answer» C. Time and space.
388.

New data are to be inserted into a data structure, but there is no available space; this situation is usually called__________.

A. Underflow.
B. Overflow.
C. Houseful.
D. Saturated.
Answer» B. Overflow.
389.

Which of the following data structure is linear data structure?

A. Tree.
B. Graph.
C. Array.
D. Linked list.
Answer» C. Array.
390.

Which of the following is an example of dynamic programming approach?

A. Fibonacci Series
B. Tower of Hanoi
C. Dijkstra Shortest Path
D. All of the above
Answer» D. All of the above
391.

The memory address of the first element of an array is called_________.

A. floor address.
B. foundation address.
C. first address.
D. base address.
Answer» D. base address.
392.

Which data structure allows deleting data elements from front and inserting at rear?

A. Stacks.
B. Queues.
C. Dequeues.
D. Binary search tree.
Answer» B. Queues.
393.

Binary search algorithm cannot be applied to________ concept.

A. unsorted linked list.
B. sorted binary trees.
C. sorted linear array.
D. pointer array.
Answer» A. unsorted linked list.
394.

Graph traversal is different from a tree traversal, because

A. trees are not connected.
B. graphs may have loops.
C. trees have root.
D. None is true as tree is a subset of graph.
Answer» C. trees have root.
395.

Linked lists are suitable for which of the following problems?

A. Insertion sort
B. Binary search
C. Radix sort
D. dequeue.
Answer» B. Binary search
396.

Identify the data structure which allows deletions at both ends of the list but insertion at only one end___________.

A. Input-restricted dequeue.
B. Output-restricted dequeue.
C. Priority queues.
D. Data structure.
Answer» A. Input-restricted dequeue.
397.

Which of the following data structure is non-linear type?

A. Strings.
B. Lists.
C. Stacks.
D. Hierarchical.
Answer» D. Hierarchical.
398.

To represent hierarchical relationship between elements, which data structure is suitable?

A. Dequeue.
B. Priority.
C. Tree.
D. Binary tree.
Answer» C. Tree.
399.

When does the ArrayIndexOutOfBoundsException occur?

A. Compile-time
B. Run-time
C. Not an error
D. None of the mentioned
Answer» B. Run-time
400.

The depth of a complete binary tree is given by__________.

A. Dn = n log2n.
B. Dn = n log2n+1.
C. Dn = log2n.
D. Dn = log2n+1.
Answer» D. Dn = log2n+1.
Tags
Question and answers in Data Structures (DS), Data Structures (DS) multiple choice questions and answers, Data Structures (DS) Important MCQs, Solved MCQs for Data Structures (DS), Data Structures (DS) MCQs with answers PDF download