More Mcqs Data Structure and Algorithms (Set 11)
More Mcqs Data Structure and Algorithms (Set 11)
11 of 14 sets
501. What would be the asymptotic time complexity to find an element in the
linked list?
A. o(1)
B. o(n)
C. o(n2)
D. none
Answer:B
502. What would be the asymptotic time complexity to insert an element at the
second position in the linked list?
o m
A. o(1)
. c
B. o(n)
te
C. o(n2)
a
D. none
q M
Answer:A
c
Mlist can performed in O(1) time. Which of the
503. The concatenation of two
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;
Which of the following c code is used to create new node?
A. ptr=(node*)malloc(sizeof(node));
B. ptr=(node*)malloc(node);
C. ptr=(node*)malloc(sizeof(node*));
D. ptr=(node)malloc(sizeof(node));
Answer:A
505. A variant of linked list in which last node of the list points to the first node of
the list is?
A. singly linked list
B. doubly linked list
C. circular linked list
D. multiply linked list
Answer:C
507. 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
508. 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.
509. A variant of the linked list in which none of the node contains NULL pointer
is?
A. singly linked list
B. doubly linked list
C. circular linked list
D. none
Answer:C
511. 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
512. Linked lists are not suitable to for the implementation of?
A. insertion sort
B. radix sort
C. polynomial manipulation
D. binary search
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)));
}
518. _____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
519. _____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
521. ____is a variable whose length may vary during the execution of a program.
523. 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
524. 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