# TRUE/FALSE Quiz Questions with Answers in Data Structures and Algorithms, Data Structures interview questions

##
__Data
Structures and Algorithms TRUE / FALSE Questions – Set 03__

__Data Structures and Algorithms TRUE / FALSE Questions – Set 03__

###
*1. The running time of inserting an item into an unsorted list
is O(n)*

*1. The running time of inserting an item into an unsorted list is O(n)*

(a)
TRUE (b)
FALSE

**View Answer**Answer:
FALSEThe
running time is O(1) for inserting an item into an unsorted list. We
are about to insert an item into an unsorted list, so we can insert the item
at the end of the list if we use an array data structure. |

###
*2. Suppose an array X is
declared as int X[5]; The base
address of the array is 100 and integers take up 4 bytes. Then, the address of X[2]
is 110.*

*2. Suppose an array X is declared as int X[5]; The base address of the array is 100 and integers take up 4 bytes. Then, the address of X[2] is 110.*

(a)
TRUE (b)
FALSE

**View Answer**###
*3. Stack follows First In First Out (FIFO) rule*

*3. Stack follows First In First Out (FIFO) rule*

(a)
TRUE (b)
FALSE

**View Answer**Answer:
FALSEStack
is Last In First Out (LIFO), where the last element inserted will be accessed
first then the next last and so on. Stack supports operations PUSH (insert)
and POP (delete) functions. Both will be executed from the top of the stack. |

###
*4. In a circular doubly linked list with 10 nodes, we will need
to change 4 links if we want to delete a node other than the head node.*

*4. In a circular doubly linked list with 10 nodes, we will need to change 4 links if we want to delete a node other than the head node.*

(a)
TRUE (b)
FALSE

**View Answer**Answer:
FALSEWe
can change the link fields of the nodes that precede and follow the node we
want to delete. So we just need to change 2 links if we want to delete a node
other than the head node. |

###
*5. When using linked list to perform insertion sort, each time we
remove an element from the input list and insert it to the correct position in
the linked list. Assume that we have n numbers to be sorted, the time
complexity for sorting these numbers using the insertion sort algorithm is O(n*^{2}).

*5. When using linked list to perform insertion sort, each time we remove an element from the input list and insert it to the correct position in the linked list. Assume that we have n numbers to be sorted, the time complexity for sorting these numbers using the insertion sort algorithm is O(n*

^{2}).
(a)
TRUE (b)
FALSE

**View Answer**Answer:
TRUEThe
worst case is that we have to search all numbers in the list before we insert
a new number.1
+ 2 + ... + n = n(n − 1)/2The
time complexity for sorting these numbers using the insertion sort algorithm is
O(n^{2}). |

***************

###
**Related links:**

**Related links:**

## No comments:

## Post a Comment