# Data Structures and Algorithms MCQs

## Data Structures and Algorithms

A ____________ is a well defined list for solving a particular problem.

A. algorithm.

B. complexity.

C. time.

D. space.

Each array declaration need not give, implicitly or explicitly, the information about

A. the name of array

B. the data type of array

C. the first data from the set to be stored

D. the index set of the array

The __________notation is used when the function f(n) is bounded both from above and below by the function g(n).

A. Omega

B. Little Oh

C. Oh

D. Theta

Which of the following is not a limitation of binary search algorithm

A. must use a sorted array

B. requirement of sorted array is expensive when a lot of insertion and deletions are needed

C. there must be a mechanism to access middle element directly

D. binary search algorithm is not efficient when the data elements more than 1500.

State True or False for internal sorting algorithms. i) Internal sorting are applied when the entire collection if data to be sorted is small enough that the sorting can take place within main memory. ii) The time required to read or write is considered to be significant in evaluating the performance of internal sorting.

A. i-True, ii-True

B. i-True, ii-False

C. i-False, ii-True

D. i-False, ii-False

The memory address of fifth element of an array can be calculated by the formula

A. LOC(Array=Base(Array)+w(5-lower bound), where w is the number of words per memory cell for the array

B. LOC(Array)=Base(Array)+(5-lower bound), where w is the number of words per memory cell for the array

C. LOC(Array)=Base(Array)+(5-Upper bound), where w is the number of words per memory cell for the array

D. None of above

In fixed- length storage, all records have same number of __________.

A. record.

C. code.

D. field.

In variable length storage, two dollar signs are used to denote the __________.

A. end of the string.

B. beginning of the string.

C. mid-level of the string.

D. index.

In linked storage, linearly ordered sequence of memory cells is called as__________.

B. nodes.

D. list.

The ________notation is used when the function g(n) defines a lower bound for the function f(n).

A. Omega

B. Theta

C. Little Oh

D. Big Oh

The ___________ notation defines an upper bound function g(n) for f(n)which represents the space/time complexity of the algorithm.

A. Big Oh

B. Little Oh

C. Omega

D. Theta

Arrays whose rows or columns begin with different numbers of data elements and end with unused storage locations are said to be ______.

A. multidimensional array

B. jagged array

C. row matrix

D. column matrix

In preorder traversal the root is processed ________.

A. first

B. second

C. third

D. randomly

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.

The time factor, when determining the efficiency of algorithm is measured by ____________.

A. counting microseconds.

B. counting the number of key operations.

C. counting the kilobytes of algorithm.

D. counting number of lines.

The space factor when determining the efficiency of algorithm is measured by __________.

A. counting the maximum memory needed by the algorithm.

B. counting the minimum memory needed by the algorithm.

C. counting the average memory needed by the algorithm.

D. counting the maximum disk space needed by the algorithm.

Which of the following case does not exist in complexity theory

A. Best case.

B. Worst case.

C. Average case.

D. Null case.

The Worst case occur in linear search algorithm when _____________.

A. item is somewhere in the middle of the array.

B. item is not in the array at all.

C. item is the last element in the array.

D. item is the first element in the array.

Processing each element in list is called as ____________.

A. Indexing.

B. Traversing.

C. Sorting.

D. Searching.

Finding the location of the element is called as______________.

A. traversing

B. searching.

C. concatenation.

D. indexing.

Combine two elements to a single list called as_______________.

A. merging.

B. traversing.

C. searching.

D. sorting.

Arranging elements in some type of order _______________.

A. merging.

B. traversing.

C. searching.

D. sorting.

A ________________ is a list of finite number and of homogeneous data elements.

A. linear array.

B. sequential array.

C. selection array.

D. pointer.

The free node linked list is also called as ________.

A. free pool.

B. empty pool.

C. unavailable list.

D. inaccessible list

25. ______________ is a collection of related data items.

A. Record.

B. Attribute.

C. Field.

D. Identifiers.

The user defined names given to various data items are called as_____________.

A. record.

B. attributes.

C. field.

D. identifiers.

______________ is a collection of similar records.

A. Records.

B. File.

C. Field.

D. Identifiers.

A record may be collection of ______________ data.

A. homogeneous.

B. non-homogeneous.

C. sequential.

D. indexed.

Array elements are referenced by__________.

A. position.

B. pointer.

C. index set.

D. number.

Let the address of an array element be A[K],then K is called as the_________.

A. subscript.

B. subscripted variable.

C. bound.

D. index variable.

What will be the output of the following arithmetic expression  5+3*2%10-8*6

A. -37.

B. -42.

C. -32.

D. -28.

An m x n array has _________number of elements.

A. m.

B. n.

C. m2.

D. m x n.

The sequence (1,1.,(2,1.,(3,1.,(1,2.,(2,2.,(3,2.,….represents _________.

A. row major order.

B. column major order.

C. random order.

D. successive order.

A. last element.

B. first element.

C. middle element.

D. pivot element.

Pointers stores ______of an element.

A. value.

C. operation.

D. data.

Records can be represented using _______ in memory.

A. strings.

B. two dimensional arrays.

C. linear arrays.

D. parallel arrays.

A BST is traversed in the following order recursively: Right, root, left The output sequence will be in

A. Ascending order

B. Descending order

C. Bitomic sequence

D. No specific order

The first step of development of an algorithm is______.

A. Problem analysis.

B. Problem statement.

C. Algorithm analysis.

D. Implementation.

Separating group items from sub items is called________.

A. separation.

B. quantification.

C. qualification.

D. purification.

A linked list has __________ parts in each node.

A. two.

B. three.

C. four.

D. five.

The pointer of last node contains __________.

A. list pointer.

B. next pointer.

C. start.

D. null pointer.

Collection of deleted space onto free-pool is ________.

A. collection.

B. storage.

C. garbage collection.

D. tagging.

The situation that arises when trying to insert an item in linked list when free pool is empty is called _________.

A. underflow.

B. empty.

C. null.

D. overflow.

________ is the situation where linked list is empty and trying to delete an item.

A. Overflow.

B. Underflow.

C. Null.

D. Empty.

Which of the following is true while inserting a new node in the list

A. Check there is node in the list.

B. Check there is node in the free pool.

C. Check node in the list and free pool.

D. All the above.

Which of the following is true, while deleting a node from the list

A. Check if there is node in the list.

B. Check in the free pool.

C. Check node in the list and free pool.

D. All the above.

A. end B. beginning

C. middle

D. second position

___________is the header list where last node contains null pointer.

B. 2 way list.

C. start.

D. null pointer.

Collection of deleted space onto free-pool is ________.

A. collection.

B. storage.

C. garbage collection.

D. tagging.

The situation that arises when trying to insert an item in linked list when free pool is empty is called _________.

A. underflow.

B. empty. C. null.

D. overflow.

________ is the situation where linked list is empty and trying to delete an item.

A. Overflow.

B. Underflow.

C. Null. D. Empty.

Which of the following is true while inserting a new node in the list

A. Check there is node in the list.

B. Check there is node in the free pool.

C. Check node in the list and free pool. D. All the above.

Which of the following is true, while deleting a node from the list

A. Check if there is node in the list.

B. Check in the free pool.

C. Check node in the list and free pool. D. All the above.

A. end

B. beginning

C. middle

D. second position

___________is the header list where last node contains null pointer.

B. 2 way list.

________ is the header list where last node points back to header node.

A. circular.

B. grounded.

D. 2-way.

The list which can be traversed forward & backward is ___________ list.

A. circular

C. 2-way

D. grounded

_________ is an operation to add a new value.

A. Traversing.

B. Inserting.

C. Searching.

D. Looking.

Which of the following data structure can’t store the non-homogeneous data elements

A. Arrays.

B. Records.

C. Structure.

D. All of the above.

Which of the following is the best way to represent matrices

A. linear arrays.

B. two dimensional arrays.

C. pointers.

D. structure.

In bubble sort algorithm, the condition flag=0 indicates that _________.

A. the list is not sorted.

B. there are no items in the list.

C. the items are interchanged.

D. the list is already sorted

Which of the following is true regarding the difference between linear array and a record?(I). An array is suitable for homogeneous data but the data items in a record may have different data type. (II). In a record, there may not be a natural ordering in opposed to linear array. (III). A record form a hierarchical structure but a linear array does not.

A. Only I is true.

B. Only II is true

C. II and III are true.

D. I,II and III are true.

Which of the following statement is false

A. Arrays are dense lists and static data structure.

B. Data elements in linked list need not be stored in adjacent space in memory.

C. Pointers store the next data element of a list.

D. Linked lists are collection of the nodes that contain information part and next pointer.

Binary search algorithm can not be applied to ____________.

B. sorted binary trees.

C. sorted linear array.

D. pointer array.

LINK [START]=NULL in the grounded linked list indicates that the __________. A. list is full

B. list is empty

C. list cannot store items

D. no space to insert items

START=NULL should be true for ____________ to occur

A. underflow.

B. overflow.

C. houseful.

D. saturated.

Which of the following is two way lists

Which of the following name does relate to stack

A. FIFO lists.

B. LIFO list.

C. Files.

D. Circular list

A __________ is a list of elements in which an element may be inserted or deleted at only one end.

A. deque.

B. queue.

C. stack.

D. recursion.

_________________ is the term used to delete an element from a stack.

A. Push.

B. Pop.

C. Queue.

D. Priority queue.

When the operator symbol placed before two operands, then the notation is called ______________.

A. reverse polish.

B. postfix.

C. polish.

D. Prefix.

A _____________ is a list of elements in which elements are inserted at one end and deletion at the other end.

A. deque.

B. queue.

C. stack

D. recursion.

Queue is also called as __________.

A. FIFO.

B. LIFO.

C. SIRO.

D. RISO.

Which one of the following sequence can obtain the output using stack assuming that the input is 1,2,3,4,5

A. 3,4,5,1,2. B. 3,4,5,2,1.

C. 1,5,2,3,4.

D. 5,4,3,2,1.

A collection of elements in which the element has been assigned a priority___________.

A. priority queue.

B. stack.

C. deque.

D. queue.

FIFO is the short form of ___________. A. First In First Out.

B. First In Final Out.

C. Final In First Out.

D. Final In Final Out.

The term deque is a contraction of the name________.

A. double ended queue.

B. single ended queue.

C. double queue.

D. single queue.

In executing the procedure PUSH, one must first test whether there is room in the stack for the stack new item; if not then we have the condition known as_________.

A. underflow.

B. overflow.

C. pop.

D. none.

A_________ operation into STACK is accomplished by inserting a node into the front or start of the list.

A. POOP.

B. PUSH.

C. START.

D. none.

A pointer variable ___________ contains the location of the top element of the stack.

A. MAXSTX.

B. TOP.

C. null.

D. BOTTOM.

The ________field of the nodes hold the data elements of the stack.

A. INFO.

C. stack.

D. queues.

In executing the procedure POP ,one must test whether there is an element in the stack to be deleted, if not then the condition is known as___________.

A. stack.

B. recursion.

C. overflow.

D. underflow.

A _________operation is undertaken by deleting the node pointed to by the START pointer in stack. A. MAXSTK.

B. POP.

D. INFO.

The condition TOP=0 indicates ___________.

A. stack is empty.

B. stack is full.

C. stack is unavailable.

D. stack overflows.

Recursion can be implemented by the use of ___________ data structure.

A. stack.

B. queues.

D. pointer.

The ______ is not a sorting algorithm.

A. quick sort.

B. binary search.

C. bubble sort.

D. heap sort.

Linear search is also called as __________.

A. consecutive search.

B. reverse search

C. sequential search.

D. binary search.

The address of the first and last element of each sub list called as_________.

A. push values.

B. pop values.

C. boundary values.

D. pointer.

Deletion in a queue occurs at _________ end.

A. front.

B. rear.

C. top.

D. both.

Insertion in queue takes place at the ________ end.

A. front.

B. rear.

C. push.

D. pop.

The __________ function is a function with two arguments each of which can be assigned any non negative integer.

A. Linear

B. Polynomial

C. Well defined

D. Ackermann

The length Li in a multidimensional arrays is calculated by using the formula ______.

A. Li =upper bound – lower bound + 1.

B. Li = upper bound + lower bound – 1

C. Li = upper bound – lower bound – 1.

D. Li = upper bound – lower bound.

In a circular queue the value of r will be ___________.

A. r=r+1

B. r=(r+1)% [QUEUE_SIZE -1]

C. r=(r+1)% QUEUE_SIZE

D. r=(r-1)% QUEUE_SIZE

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

The initial configuration of the queue is a,b,c,d (a is the front end). To get the configuration d,c,b,a one needs a minimum of

A. 2 deletions and 3 additions

B. 3 additions and 2 deletions

C. 3 deletions and 3 additions

D. 3 deletions and 4 additions

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

A. input-restricted deque.

B. output-restricted deque.

C. priority queues.

D. none of above.

The number of possible ordered trees with three nodes A,B,C is

A. 11

B. 12

C. 13

D. 14

The __________ function is a function with two arguments each of which can be assigned any non negative integer.

A. Linear

B. Polynomial

C. Well defined

D. Ackermann

The length Li in a multidimensional arrays is calculated by using the formula ______.

A. Li =upper bound – lower bound + 1.

B. Li = upper bound + lower bound – 1

C. Li = upper bound – lower bound – 1.

D. Li = upper bound – lower bound. ANSWER: A

In a circular queue the value of r will be ___________.

A. r=r+1

B. r=(r+1)% [QUEUE_SIZE -1]

C. r=(r+1)% QUEUE_SIZE

D. r=(r-1)% QUEUE_SIZE

Which of the following data structure is linear type

A. Tree.

B. Forest.

C. Queues.

D. None of the above.

Which data structure is suitable for representing hierarchical relationship between the elements

A. Dequeue.

C. Tree.

D. Array.

An expression is a collection of ___________.

A. operands.

B. operators.

C. symbols.

D. operands and operators.

A binary tree T is defined as a finite set of elements called________.

A. nodes.

B. arrays.

C. stacks.

D. terminal.

The nodes with no successor are called as________.

A. successive nodes.

B. terminal node.

C. sub tree.

D. child.

The number of binary trees with 3 nodes which when traversed in postorder given the sequence A,B,C is ____________.

A. 3.

B. 9.

C. 7.

D. 5.A

NSWER: D

A terminal node in a tree is called as _________.

A. leaf.

B. branch.

C. node.

D. root.

98. The path ending in a leaf of a tree is called as___________.

A. branch.

B. node.

C. pointer.

D. root.

Any invalid address is denoted by _____________.

A. null.

B. pointer.

C. avail.

D. memory.

Matrices with a relatively high proportion of zero entries are called __________.

A. sparse matrices.

B. diagonal matrices.

C. triangular matrices.

D. zero order matrices.

Special pointers in a binary tree are called as_________.

B. tags.

C. nodes.

An elegant sorting algorithm that uses heap is called _________.

A. heap.

B. heap sort.

C. max heap.

D. quick sort.A

NSWER: B

The second matrix, where nonzero entries can only occur on the diagonal or on elements immediately above or below the diagonal is called a _________.

A. sparse matrix.

B. triangular matrix.

C. tridiagonal matrix.

D. zero-order matrix.

Tower of Hanoi is an example application for ___________.

A. stack.

B. queue.

C. recursion.

D. linear list.

___________data structures combine the advantages of the sorted array and the linked list.

A. Sorted .

C. Binary search tree.

D. Tree.

106. When the operator symbol is placed between its two operands the notation is called ________.

A. infix.

B. postfix.

C. prefix.

D. inter operator.

If s1 is left successor of node N and s2 is the right successor of node N then, N is _______of s1 and s2.

A. child.

B. grandchild.

C. parent.

D. descendant.

How many standard ways are there to traverse a binary tree

A. one.

B. two.

C. three.

D. four.

The tree T is said to be ________ if all its levels, except possibly the last, have the maximum number of possible nodes, and if all the nodes at the last level appear as far left as possible.

A. weighted tree.

B. complete.

C. extended.

D. B-tree.

List of adjacency nodes, are also called as _________.

A. successors.

B. boundary.

C. edges.

D. root.

The root is processed before its subtrees in _______ traversal.

A. inorder.

B. preorder.

C. postorder.

D. all of the above.

The average running time f(n) to search an item in a binary tree T with n elements is ______.

A. O(n2).

B. O(log2n).

C. O(n).

D. O(n3).

The following sequence of operation is performed on stack : push(1),push(2),pop,push(1),push(2),pop,pop,pop,push(2),pop. The sequence of popped out values are

A. 2,2,1,1,2

B. 2,2,1,2,2

C. 2,1,2,2,1

D. 2,1,2,2,2

Tree is a ___________ structure.

A. linear.

B. non-linear.

C. circular.

D. pointer.

The number of swapping needed to sort numbers 8,22,7,9,31,19,5,13 in ascending order using bubble sort is

A. 11

B. 12

C. 13

D. 14

116. Binary trees with special pointers namely threads are called ____________.

B. pointing trees.

C. extended trees.

A tree T is called __________ , if each node N in T satisfies – the value at N is greater than every value in the left subtree of N and is less than the value in the right subtree of N.

A. binary search tree.

B. extended tree.

C. B-tree.

D. rooted tree.

__________ is the level number of the root node.

A. 1.

B. 0.

C. -1.

D. 5.A

NSWER: B

119. _______is the technique that is used to restore the balance of the search tree.

A. Rotations.

B. Resolutions.

C. Revolutions.

D. Recursions.

Which of the following data structure is used in retrieval and manipulation of data stored in external memory

A. Binary search.

B. Quick sort.

C. m-way search trees.

D. Heap sort.

The ___________ pointer of header node points the root node.

A. left.

B. right.

C. null.

D. node.

The pointer which replaces null entries pointing to higher nodes are ___________.

A. next.

B. full.

C. high.

The complexity of linear search algorithm is __________.

A. O(n).

B. O(log n).

C. O(n2).

D. O(n log n).

The complexity of Binary search algorithm is ____________.

A. O(n).

B. O(log2n).

C. O(n2).

D. O(n log n).

The complexity of Bubble sort algorithm is _____________.

A. O(n).

B. O(log n).

C. O(n2).

D. O(n log n).

The complexity of merge sort algorithm is_____________.

A. O(n).

B. O(log n).

C. O(n2).

D. O(n log n).

Which of the following linked list does not have any NULL links

If yyy, xxx and zzz are the elements of a lexically ordered binary tree, then in preorder traversal which node will be traverse first

A. xxx.

B. yyy.

C. zzz.

D. cannot be determined.

In a balance binary tree the height of two sub trees of every node can not differ by more than __________.

A. 2.

B. 1.

C. 0.

D. 3.A

NSWER: B

130. The result of evaluating prefix expression */b+-dacd, where a = 3, b = 6, c = 1, d= 5 is __________.

A. 0.

B. 5.

C. 10.

D. 15.

In an array representation of binary tree the right child of root will be placed at the _______ location.

A. second.

B. fifth.

C. third.

D. first.

A. first record of the actual data.

B. last record of the actual data.

C. pointer to the last record of the actual data.

D. all the above.

In which of the following algorithm, the smallest element is found first and placed in the first position,

then the next smallest in the second place, and so on

A. Merge sort.

B. Selection sort.

C. Insertions sort.

Given two sorted lists of size m and n respectively.The number of comparisons needed in the worst case by the merge sort algorithm will be _______.

A. mn.

B. max(m,n).

C. min(m,n).

D. m+n-1.

Very slow way of sorting is _______________.

A. insertion sort.

B. heap sort.

C. bubble sort.

D. quick sort.

Sorting a file F usually refers to sorting F with respect to a particular key called _____________.

A. basic key.

B. primary key.

C. starting key.

D. index key.

Selection sort first finds the _________________ element in the list and put it in the first position.

A. middle element.

B. largest element.

C. last element.

D. smallest element.

The operation that combines the element is of A and B in a single sorted list C is called _______________.

A. inserting.

B. mixing.

C. merging.

D. sharing.

__________________ sorting is good to use when alphabetizing large list of names.

A. Merge.

B. Heap.

D. Bubble.

Which of the following sorting algorithm is of divide-and-conquer type

A. Bubble Sort.

B. Insertion Sort.

C. Quick Sort.

D. Merge Sort.

____________ is the complexity of the merge sort algorithm for both worst and average case.

A. O(n log n).

B. O(n log+n).

C. O(n+log n).

D. O(log n).

____________ algorithm is frequently used when the total number of elements is small.

A. Heap sort.

B. Insertion sort.

C. Bubble sort.

D. Quick sort.

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

A. Deque

B. Tree

C. Stack

D. all the above

One can convert a binary tree into its mirror image by traversing it in__________.

A. inorder.

B. preorder.

C. postorder.

D. any order.

The best average behaviour is shown by______

A. Quick Sort

B. Merge Sort

C. Insertion Sort

D. Heap Sort

If the node N is a terminal node in a binary tree then its ______

A. right and left tree is empty.

B. left tree is empty and right tree is full.

C. right tree is empty and left tree is full.

D. right and left tree is full.

If the address of A and A are 1000 and 1010 respectively occupies 2 bytes then the array has been stored in _________ order.

A. row major

B. column major

C. matix major

D. none of these

An algorithm is made up of two independent time complexities in the order ______________.

A. f(n) x g(n).

B. Max ( f(n),g(n)).

C. Min (f(n),g(n)).

D. f(n) + g(n).

Which of the following condition shows that stack is full

A. TOP=NULL. .

B. TOP=MAX.

C. TOP=MAX+1.

D. POP=MAX-1

The elements are removed from a stack in _______ order.

A. hierarchical.

B. inorder.

C. reverse.

D. alternate.

A. hierarchical.
B. inorder.
C. reverse.
D. alternate.

A. TOP=NULL..
B. TOP-MAX.
C. TOP-MAX+1.
D. POP=MAX-1

## An algorithm is made up of two independent time complexities in the order

A. f(n) x g(n).
B. Max (f(n),g(n)).
C. Min (f(n),g(n)).
D. f(n) + g(n).

A. row major
B. column major
C. matix major
D. none of these

## If the node N is a terminal node in a binary tree then its

A. right and left tree is empty.
B. left tree is empty and right tree is full.
C. right tree is empty and left tree is full.
D. right and left tree is full.

## The best average behaviour is shown by_

A. Quick Sort
B. Merge Sort
C. Insertion Sort
d. Heap Sort

A. inorder.
B. preorder.
C. postorder.
D. any order.

A. Deque
B. Tree
C. Stack
D. all the above