Data-Structure-And-Algorithms (Set 3)
Data-Structure-And-Algorithms (Set 3)
3 of 4 sets
201. _______ refers to situation where one wants to delete data form a data
structure that is empty.
A. free storage
B. underflow
C. overflow
D. compaction
Answer:B
202. ________ is an organization that provides faster request and return time
response.
o m
A. stack
. c
B. queue
te
C. buddy system
a
D. recursion
q M
Answer:C
c
M of fragmentation by moving all the allocated
203. _______ attacks the problem
blocks to one end of memory, thus combining all the holes.
A. garbage collection
B. garbage compaction
C. buddy system
D. queue
Answer:B
204. A _______ list structure can be traversed in two directions-- in the forward
direction from beginning of the list to end, or in the backward direction, from the
end of the list to the beginning.
A. one way
B. linear array
C. two way
D. header
Answer:C
205. _________ header list combines the advantages of a two-way list and a
circular header list.
A. one way
B. two way circular
C. two way
D. header
Answer:B
213. To insert a node in a circular list at rear end it should be inserted at …...of the
queue
A. front position
B. front-1position
C. rear position
D. rear-1 position
Answer:C
225. Time required to delete a node with given address in a linked list is____
A. 0(n)
B. 0(log n)
C. 0(1)
D. 0(n log n)
Answer:A
226. Select the set of instructions to insert a node pointed by q after a node pointed
by p
A. q->next=p->next; p->next=q;
B. p->next=q; q->next=p->next
C. both (a)and(b)
D. none of these
Answer:A
227. select the set of operations to insert a node pointed by q at the beginning of the
linked list
A. q->next=head; head=q;
B. head=q;q ->next=head;
C. both (a)and(b)
D. none of these
Answer:A
228. Select the set of operations to delete the first node from a linked list
A. p=head;head=head->next;free(p);
B. free(head)
C. head=head->next;p=head;free(p)
D. none of these
Answer:A
229. Select the correct looping condition for positioning apointer p on the second
last in a linked list.Assume p=head,initially.
230. If address of the 8th element in a linked list of integers is1022,then address of
the 9th element is
A. 1024
B. 1026
C. 1023
D. unknown
Answer:D
231. The advantages of linked list over an array for representing a list is________
A. space used is less
B. deletion is easier
C. insertion is easier
D. both (a) and (b)
Answer:D
238. Each node in a linear list contains an item called____which points to the next
node in the list.
A. node
B. link
C. variable
D. null
Answer:B
240. The function that allocates requested size of bytes and returns a pointer to the
first byte of the allocated space is
A. realloc
B. malloc
C. free
D. none of these
Answer:B
243. A linear collection of data elements where the linear node is given by means of
pointer is called?
A. linked list
B. node list
C. primitive list
D. none
Answer:A
245. Consider an implementation of unsorted singly linked list. Suppose it has its
representation with a head and tail pointer. Given the representation, which of the
following operation can be implemented in O(1) time?
i) Insertion at the front of the linked list
ii) Insertion at the end of the linked list
iii) Deletion of the front node of the linked list
iv) Deletion of the last node of the linked lis
A. i and ii
B. i and iii
C. i,ii and iii
D. i,ii and iv
Answer:C
246. Consider an implementation of unsorted singly linked list. Suppose it has its
representation with a head pointer only. Given the representation, which of the
following operation can be implemented in O(1) time?
247. Consider an implementation of unsorted doubly linked list. Suppose it has its
representation with a head pointer and tail pointer. Given the representation,
which of the following operation can be implemented in O(1) time?
248. In linked list each node contain minimum of two fields. One field is data field
to store the data second field is?
A. pointer to character
B. pointer to integer
C. pointer to node
D. node
Answer:C
249. What would be the asymptotic time complexity to add a node at the end of
singly linked list, if the pointer is initially pointing to the head of the list?
A. o(1)
B. o(n)
C. ? (n)
D. ? (1)
Answer:C
250. What would be the asymptotic time complexity to add an element in the linked
list?
A. o(1)
B. o(n)
C. o(n2)
D. none
Answer:B
251. What would be the asymptotic time complexity to find an element in the
linked list?
A. o(1)
252. What would be the asymptotic time complexity to insert an element at the
second position in the linked list?
A. o(1)
B. o(n)
C. o(n2)
D. none
Answer:A
253. The concatenation of two list can performed in O(1) time. Which of the
following variation of linked list can be used?
A. singly linked list
B. doubly linked list
C. circular doubly linked list
D. array implementation of list
Answer:C
struct node
{
int data;
struct node * next;
}
typedef struct node NODE;
NODE *ptr;
257. What kind of linked list is best to answer question like “What is the item at
position n?”
A. singly linked list
B. doubly linked list
C. circular linked list
D. array implementation of linked list
Answer:D
258. A variation of linked list is circular linked list, in which the last node in the list
points to first node of the list. One problem with this type of list is?
A. it waste memory space since the pointer head already points to the first node and thus the list
node does not need to point to the first node.
B. it is not possible to add a node at the end of the list.
C. it is difficult to traverse the list as the pointer of the last node is now not null
D. all of above
Answer:C
259. A variant of the linked list in which none of the node contains NULL pointer
is?
A. singly linked list
B. doubly linked list
261. Which of the following statements about linked list data structure is/are
TRUE?
A. addition and deletion of an item to/ from the linked list require modification of the existing
pointers
B. the linked list pointers do not provide an efficient way to search an item in the linked list
C. linked list pointers always maintain the list in ascending order
D. the linked list data structure provides an efficient way to find kth element in the list
Answer:B
262. Linked lists are not suitable to for the implementation of?
A. insertion sort
B. radix sort
C. polynomial manipulation
D. binary search
Answer:D
263. In worst case, the number of comparison need to search a singly linked list of
length n for a given element is
A. log n
B. n/2
C. log2n-1
D. n
Answer:D
struct item
{
int data;
struct item * next;
};
int f (struct item *p)
{
return((p==NULL) ||((p->next==NULL)||(p->data<=p->next->data) && (p-
>next)));
}
268. _____operation of word processing invovles replacing one string in the text by
another.
A. insertion
B. deletion is easier
C. searching
D. replacement
Answer:D
269. _____is the problem of deciding whether or not a given string problem p
appears in a text T.
A. pattern matching
B. searching
C. sorting
D. deletion
Answer:A
271. ____is a variable whose length may vary during the execution of a program.
A. dynamic
B. static
C. semistatistic
D. global
Answer:A
273. If a function is declared as void fn(int *p), then which of the following
statements is valid to call function fn?
A. fn(x) where x is defined as int x;
B. fn(x) where x is defined as int *x;
C. fn(&x) where x is defined as int *x;
D. fn(*x) where x is defined as int *x;
Answer:B
274. To declare an array S that holds a 5-character string, you would write
A. char s[5]
B. char s[6]
C. string s[5]
D. stringchar s[5]
Answer:A
277. If a, b and c are integer variables with the values a=8, b=3 and c=-5. Then
what is the value of the arithmetic expression: 2 * b + 3 * (a-c)
280. While incrementing a pointer, its value gets increased by the length of the data
type to which it points. This length is called
A. scale factor
B. length factor
C. pointer factor
D. increment factor
Answer:A
285. In selection sort of n elements,how many times is the swap function called in
the complete execution of the algorithm?
A. 1
B. n-1
C. n(n-1)/2
D. none of these
Answer:B
288. Each data item in a record may be a group item composed of sub-items; those
items which are indecomposable are called
A. Elementary items
B. Atoms
C. Scalars
D. All of above
Answer:D
291. When new data are to be inserted into a data structure, but there is no
available space; this situation is usually called
A. Housefull
B. Saturated
C. Underflow
D. Overflow
Answer:D
295. In a binary tree, certain null entries are re- placed by special pointers which
point to nodes higher in tree for efficiency. These special pointers are called
A. Leaf
B. Branch
C. Path
D. Thread
Answer:D
299. The Worst case occur in linear search algo- rithm when
A. Item is not in the array at all
B. Item is the last element in the array
C. Item is the last element in the array or is not there at all
D. None of above
Answer:C