Home
MCQS
Data structure MCQ Quiz Hub
Data Structure and Algorithms (DSA) set 5
Choose a topic to test your knowledge and improve your Data structure skills
1. Accessing time of nth node in a linked list is______
0(n)
0(1)
0(n2)
0(log n)
2. An array is referenced by its name.Similarly,a linked list is referenced by____
address of the first node
address of the last node
both (a)and(b)
none of these
3. Time required to search an element in a linked list is____
0(n)
0(log n)
0(n2)
0(n log n)
4. Because of linear structure of linked list having linear ordering,there is similarity between linked list and array in
insertion of a node
deletion of a node
traversal of elements of list
none of the above
5. In a circularly linked list organisation ,insertion of a record involves the modifications of
no pointer
1 pointer
2 pointer
3 pointer
6. What is true about linked kist?
it is a linked structure, where each data gives the address of the next data
it is a dynamic data structure
it is a static data structure
both (a) and (b)
7. A node of linked list contains_______
data field
a self referential pointer
both (a)and(b)
only b
8. Deletion in a linked list requeries modification of______pointers
1
2
3
4
9. Select the set of instructions to insert a node pointed by q after a node pointed by p
q->next=p->next; p->next=q;
p->next=q; q->next=p->next
both (a)and(b)
none of these
10. select the set of operations to insert a node pointed by q at the beginning of the linked list
q->next=head; head=q; B. C.
head=q;q ->next=head;
both (a)and(b)
None of these
11. Select the set of operations to delete the first node from a linked list
p=head;head=head->next;free(p);
free(head)
head=head->next;p=head;free(p)
None of These
12. Select the correct looping condition for positioning apointer p on the second last in a linked list.Assume p=head,initially.
p->next->next!=null
p->next=null
p!=null
None of These
13. If address of the 8th element in a linked list of integers is1022,then address of the 9th element is
1024
1026
1023
unknown
14. The advantages of linked list over an array for representing a list is________
space used is less
deletion is easier
insertion is easier
both (a) and (b)
15. The address returned by malloc()is type casted because
malloc returns integers pointer
malloc returns void pointer
malloc returns an integer value
None of These
16. Which function returns a void pointers?
malloc returns integers pointer
calloc
both (a)and(b)
None of these
17. Select the correct statement
free is used to release memory allocated by malloc
free is used to release memory allocated by calloc
both (a)and(b)
only(a)but not(b)
18. The____linked list can be processed in either direction.
singly
singly circular
doublyly
None of these
19. A polynominal in single variable should be handled using__
an array of structure
singly linked list
gll
both (a) and (b)
20. A node of doubly linked contains
pointer to predecessor
pointer to sucessor
both (a)and(b)
only(a)
21. Each node in a linear list contains an item called____which points to the next node in the list.
node
link
variable
null
22. Which is not dynamic memory allocation function?
malloc returns integers pointer
calloc
alloc
free
23. The function that allocates requested size of bytes and returns a pointer to the first byte of the allocated space is
realloc
malloc
free
None of these
24. NULL link is not present in…
singly linked list
doubly linked list
circular linked list
None of these
25. In a circular linked list
components are all linked together in some sequential manner.
there is no beginning and no end.
components are arranged hierarchically.
forward and backward traversal within the list is permitted.
26. A linear collection of data elements where the linear node is given by means of pointer is called?
linked list
node list
primitive list
none
27. Which of the following operations is performed more efficiently by doubly linked list than by singly linked list?
deleting a node whose location in given
searching of an unsorted list for a given item
inverting a node after the node with given location
traversing a list to process each node
28. 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
i and ii
i and iii
i,ii and iii
i,ii and iv
29. 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? 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 end node of the linked list
i and ii
i and iii
i,ii and iii
i,ii,iii and iv
30. In linked list each node contain minimum of two fields. One field is data field to store the data second field is?
pointer to character
pointer to integer
pointer to node
node
31. What would be the asymptotic time complexity to add an element in the linked list?
o(1)
o(n)
o(n2)
None of these
32. What would be the asymptotic time complexity to insert an element at the second position in the linked list?
o(1)
o(n)
o(n2)
None of these
33. The concatenation of two list can performed in O(1) time. Which of the following variation of linked list can be used?
singly linked list
doubly linked list
circular doubly linked list
array implementation of list
34. Consider the following definition in c programming language 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?
ptr=(node*)malloc(sizeof(node));
ptr=(node*)malloc(node);
ptr=(node*)malloc(sizeof(node*));
ptr=(node)malloc(sizeof(node));
35. 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
doubly linked list
circular linked list
multiply linked list
36. In doubly linked lists, traversal can be performed?
only in forward direction
only in reverse direction
in both directions
None of These
37. What kind of linked list is best to answer question like “What is the item at position n?”
singly linked list
doubly linked list
circular linked list
array implementation of linked list
38. 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?
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.
it is not possible to add a node at the end of the list.
. it is difficult to traverse the list as the pointer of the last node is now not null
all of above
39. A variant of the linked list in which none of the node contains NULL pointer is?
singly linked list
doubly linked list
circular linked list
none
40. In circular linked list, insertion of node requires modification of?
one pointer
two pointer
three pointer
xnone
41. Which of the following statements about linked list data structure is/are TRUE?
addition and deletion of an item to/ from the linked list require modification of the existing pointers
the linked list pointers do not provide an efficient way to search an item in the linked list
linked list pointers always maintain the list in ascending order
None of these
42. Linked lists are not suitable to for the implementation of?
insertion sort
radix sort
polynomial manipulation
binary search
43. In worst case, the number of comparison need to search a singly linked list of length n for a given element is
log n .
n/2
log2n-1
n
44. consider the function f defined here: 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))); } For a given linked list p, the function f returns 1 if and only if
the list is empty or has exactly one element
the element in the list are sorted in non-decreasing order of data value
the element in the list are sorted in non-increasing order of data value
not all element in the list have the same data value
45. Finite sequence S of Zero or more chatacters is called_____
array
list
string
block
46. String with zero characters is called____string
null
binary
totalled
list
47. Groups of consecutive element in a string.Such as words,phrase and sentences are called___
main string
substring
index
block
48. _____operation of word processing invovles replacing one string in the text by another.
insertion
deletion is easier
searching
replacement
49. ___is the problem of deciding whether or not a given string problem p appears in a text T.
pattern matching
searching
sorting
deletion
50. If string1=john,and string2=Rivers are merged,the process is called
insertion
deletion
concatenation
replacement
51. __is a variable whose length may vary during the execution of a program.
dynamic
static
semistatistic
global
52. NurseryLand.Nursery.Students = 10;
the structure students is nested within the structure nursery
the structure nurseryland is nested within the structure nursery.
the structure nursery is nested within the structure nurseryland.
the structure nursery is nested within the structure students
53. If a function is declared as void fn(int *p), then which of the following statements is valid to call function fn?
fn(x) where x is defined as int x;
fn(x) where x is defined as int *x;
fn(&amp;x) where x is defined as int *x;
fn(*x) where x is defined as int *x;
54. To declare an array S that holds a 5-character string, you would write
char s[5]
char s[6]
string s[5]
stringchar s[5]
55. The constructed datatype in C is known as
string
array
structure
pointer
56. A structure definition is called as
template
member
both 1 &amp; 2
None of these
57. 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)
15
6
-16
-1
58. A global variable is a variable
declared in the main ( ) function
declared in any function other than the main ( ) function
declared outside the body of every function.
declared any where in the c program.
59. main ( ) is an example of
library function
user defined function
header
statement
60. While incrementing a pointer, its value gets increased by the length of the data type to which it points. This length is called
scale factor
length factor
pointer factor
increment factor
61. a->b is systematically correct if_____
a is a npointer to a structure in which b is a field
a and b are structure
a is a structure and b is a pointer to a structure
a is a pointer to a structure and b is a structure
62. Which of the following best describes sorting ?
accessing and processing each record exactly once
finding the location of the record with a given key
arranging the data (record) in some given order
adding a new record to the data structure
63. A function which calls itself is called as
library function
directive
recursive function
None of the above
64. Where do we use the operator -> ?
to access a member of structure
to access member of union
to access an array
both(a) and(b).
65. In selection sort of n elements,how many times is the swap function called in the complete execution of the algorithm?
1
n-1
n(n-1)/2
none of these
66. . a->b is systematically correct if_____
a is a pointer to a structure in which b is a field
a and b are structure
a is a structure and b is a pointer to a structure
a is a pointer to a structure and b is a structure
67. Literal means
string
string constant
character
alphabet
68. Each data item in a record may be a groupitem composed of sub-items; those items which are indecomposable are called
Elementary items
Atoms
Scalars
All of the above
69. Binary search algorithm cannot be applied to
Sorted binary trees
Sorted linear array
Pointer array
Sorted linked list
70. When new data are to be inserted into a data structure, but there is no available space; this situation is usually called
Housefull
Saturated
Underflow
Overflow
71. The following is two-way list
Grounded header list
Circular header list
Linked list with header and trailer nodes
None of above
72. 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
Leaf
Branch
Path
Thread
73. In a graph if e=(u, v) means
e begins at u and ends at v
u is processor and v is successor
both B and C are true
none is true
74. If every node u in G is adjacent to every other node v in G, A graph is said to be
Isolated
Complete
Finite
Strongly connected
75. The Worst case occur in linear search algo- rithm when
Item is not in the array at all
Item is the last element in the array
Item is the last element in the array or is not there at all
None of above
76. The Average case occur in linear search al- gorithm
When Item is somewhere in the middle of the array
When Item is not in the array at all
When Item is the last element in the ar- ray
All the above
77. The complexity of the average case of analgorithm is
Much more complicated to analyze than that of worst case
Much more simpler to analyze than that of worst case
Sometimes more complicated and some other times simpler than that of worst case
None of the above
78. The following data structure allows deleting data elements from front and inserting at rear
Stacks
Queues
Deques
Binary search tree
79. This data structure allows deletions at both ends of the list but insertion at only one end.
Input-restricted deque
Output-restricted deque
Priority queues
None of the above
80. The following data structure is non-linear type
Strings
Lists
Stacks
None of the above
81. he following data structure is linear type
Strings
Lists
Queues
All of the above
82. To represent hierarchical relationship be- tween elements, the following data structure is not suitable
Deque
Priority
Tree
All of above
83. A binary tree whose every node has either zero or two children is called
Complete binary tree
Binary search tree
Extended binary tree
None of the above
84. The complexity of Binary search algorithm is
O(n)
O(log )
O(n log n)
None of the above
85. The complexity of Bubble sort algorithm is
O(n)
O (n2)
O(n log n)
None of the above
Submit