You are on page 1of 14

CHENNAI INSTITUTE OF TECHNOLOGY

Sarathy Nagar, Pudupedu, Chennai– 600 069.


Multiple Choice Questions
Date
Subject CS8391 DATA STRUCTURES Year/Semester II/III
Branch Computer Science and Engineering
UNIT - I

1. Which if the following is/are the levels of implementation of data structure


A) Abstract level
B) Application level
C) Implementation level
D) All of the above

2. …………… is not the component of data structure.


A) Operations
B) Storage Structures
C) Algorithms
D) None of above

3. A mathematical-model with a collection of operations defined on that model is called


a) Data Structure
b) Abstract Data Type
c) Primitive Data Type
d) Algorithm

4. Which of the following is not the part of ADT description?


A) Data
B) Operations
C) Both of the above
D) None of the above

5. Which of the following is true about the characteristics of abstract data types?
i) It exports a type.
ii) It exports a set of operations
A) True, False
B) False, True
C) True, True
D) False, False

6. …………… is not the component of data structure.


A) Operations
B) Storage Structures
C) Algorithms
D) None of above

7. Which of the following is not the part of ADT description?


A) Data
B) Operations
C) Both of the above
D) None of the above

8. Which of the following is non-liner data structure?


A) Stacks
B) List
C) Strings
D) Trees

9. Which of the following data structure is linear type?


A) Graph
B) Trees
C) Binary tree
D) Stack

10. Each node in a linked list has two pairs of ………….. and ……………….
A) Link field and information field
B) Link field and avail field
C) Avail field and information field
D) Address field and link field

11. The simplest type of data structure is ………………


A) Multidimensional array
B) Linear array
C) Two dimensional array
D) Three dimensional array

12. Linear arrays are also called ……………….


A) Straight line array
B) One-dimensional array
C) Vertical array
D) Horizontal array

12. Arrays are best data structures …………


A) For relatively permanent collections of data.
B) For the size of the structure and the data in the structure are constantly changing
C) For both of above situation
D) For none of the above

13. Which of the following data structures are indexed structures?


A) Linear arrays
B) Linked lists
C) Graphs
D) Trees

14. Representation of data structure in memory is known as:


A. Recursive
B. Abstract data type
C. Storage structure
D. File structure

15. An ADT is defined to be a mathematical model of a user-defined type along with the collection of all
__________ operations on that model
A. Cardinality
B. Assignment
C. Structured

16. The information about an array that is used in a program will be stored in
A. symbol table
B. activation record
C. system table
D. dope vector

17. Which of the following abstract data types can be used to represent a many to many relation?
A. Tree
B. Plex
C. Graph
D. Both (b) and (c)

18. Which of these best describes an array?


a) A data structure that shows a hierarchical behaviour
b) Container of objects of similar types
c) Arrays are immutable once initialised
d) Array is not a data structure

19. How do you initialize an array in C?


a) int arr[3] = (1,2,3);
b) int arr(3) = {1,2,3};
c) int arr[3] = {1,2,3};
d) int arr(3) = (1,2,3);

20. What are the advantages of arrays?


a) Objects of mixed data types can be stored
b) Elements in an array cannot be sorted
c) Index of first element of an array is 1
d) Easier to store elements of same data type

21. What are the disadvantages of arrays?


a) Data structure like queue or stack cannot be implemented
b) There are chances of wastage of memory space if elements inserted in an array are lesser than the
allocated size
c) Index value of an array can be negative
d) Elements are sequentially accessed

22. Assuming int is of 4bytes, what is the size of int arr[15];?


a) 15
b) 19
c) 11
d) 60

23. In general, the index of the first element in an array is __________


a) 0
b) -1
c) 2
d) 1

24. Elements in an array are accessed _____________


a) randomly
b) sequentially
c) exponentially
d) logarithmically

25. 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) Unordered list

26. 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?
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 list
a) I and II
b) I and III
c) I, II and III
d) I, II and IV

27. 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

28. 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));

29. 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

30. Linked lists are not suitable to for the implementation of?
a) Insertion sort
b) Radix sort
c) Polynomial manipulation
d) Binary search

31. Linked list is considered as an example of ___________ type of memory allocation.


a) Dynamic
b) Static
c) Compile time
d) Heap

32. In Linked List implementation, a node carries information regarding ___________


a) Data
b) Link
c) Data and Link
d) Node

33. Linked list data structure offers considerable saving in _____________


a) Computational Time
b) Space Utilization
c) Space Utilization and Computational Time
d) Speed Utilization

34. Which of the following points is/are not true about Linked List data structure when it is compared
with array?
a) Arrays have better cache locality that can make them better in terms of performance
b) It is easy to insert and delete elements in Linked List
c) Random access is not allowed in a typical implementation of Linked Lists
d) Access of elements in linked list takes less time than compared to arrays

35. Given pointer to a node X in a singly linked list. Only one pointer is given, pointer to head node is not
given, can we delete the node X from given linked list?
a) Possible if X is not last node
b) Possible if size of linked list is even
c) Possible if size of linked list is odd
d) Possible if X is not first node

36. You are given pointers to first and last nodes of a singly linked list, which of the following operations
are dependent on the length of the linked list?
a) Delete the first element
b) Insert a new element as a first element
c) Delete the last element of the list
d) Add a new element at the end of the list

37. Which of the following is not a disadvantage to the usage of array?


a) Fixed size
b) There are chances of wastage of memory space if elements inserted in an array are lesser than the
allocated size
c) Insertion based on position
d) Accessing elements at specified positions

38. Which of the following is false about a doubly linked list?


a) We can navigate in both the directions
b) It requires more space than a singly linked list
c) The insertion and deletion of a node take a bit longer
d) Implementing a doubly linked list is easier than singly linked list

39. What is a memory efficient double linked list?


a) Each node has only one pointer to traverse the list back and forth
b) The list has breakpoints for faster traversal
c) An auxiliary singly linked list acts as a helper list to traverse through the doubly linked list
d) A doubly linked list that uses bitwise AND operator for storing addresses

 40. How do you calculate the pointer difference in a memory efficient double linked list?
a) head xor tail
b) pointer to previous node xor pointer to next node
c) pointer to previous node – pointer to next node
d) pointer to next node – pointer to previous node

41. Consider the following doubly linked list: head-1-2-3-4-5-tail


What will be the list after performing the given sequence of operations?
Node temp = new Node(6,head,head.getNext());
Node temp1 = new Node(0,tail.getPrev(),tail);
head.setNext(temp);
temp.getNext().setPrev(temp);
tail.setPrev(temp1);
temp1.getPrev().setNext(temp1);

a) head-0-1-2-3-4-5-6-tail
b) head-1-2-3-4-5-6-tail
c) head-6-1-2-3-4-5-0-tail
d) head-0-1-2-3-4-5-tail

42. What is the functionality of the following piece of code?


public int function()
{
Node temp = tail.getPrev();
tail.setPrev(temp.getPrev());
temp.getPrev().setNext(tail);
size--;
return temp.getItem();
}
a) Return the element at the tail of the list but do not remove it
b) Return the element at the tail of the list and remove it from the list
c) Return the last but one element from the list but do not remove it
d) Return the last but one element at the tail of the list and remove it from the list

43.Consider the following doubly linked list: head-1-2-3-4-5-tail


What will be the list after performing the given sequence of operations?
Node temp = new Node(6,head,head.getNext());
head.setNext(temp);
temp.getNext().setPrev(temp);
Node temp1 = tail.getPrev();
tail.setPrev(temp1.getPrev());
temp1.getPrev().setNext(tail);
a) head-6-1-2-3-4-5-tail
b) head-6-1-2-3-4-tail
c) head-1-2-3-4-5-6-tail
d) head-1-2-3-4-5-tail

44. What differentiates a circular linked list from a normal linked list?
a) You cannot have the ‘next’ pointer point to null in a circular linked list
b) It is faster to traverse the circular linked list
c) You may or may not have the ‘next’ pointer point to null in a circular linked list
d) Head node is known in circular linked list

45. Which of the following application makes use of a circular linked list?
a) Undo operation in a text editor
b) Recursive function calls
c) Allocating CPU to resources
d) Implement Hash Tables

46. Which of the following is false about a circular linked list?


a) Every node has a successor
b) Time complexity of inserting a new node at the head of the list is O(1)
c) Time complexity for deleting the last node is O(n)
d) We can traverse the whole circular linked list by starting from any point
47. Consider a small circular linked list. How to detect the presence of cycles in this list effectively?
a) Keep one node as head and traverse another temp node till the end to check if its ‘next points to
head
b) Have fast and slow pointers with the fast pointer advancing two nodes at a time and slow pointer
advancing by one node at a time
c) Cannot determine, you have to pre-define if the list contains cycles
d) Circular linked list itself represents a cycle. So no new cycles cannot be generated

48. In linked lists there are noNULL links in:


a. Single linked list
b. Lin ear doubly linked list
c. circular linked list
d. None of the above

49. The disadvantage in using a circular linked list is …………………….


A) It is possible to get into infinite loop.
B) Last node points to first node.
C) Time consuming
D) Requires more memory space

50. A linear list in which each node has pointers to point to the predecessor and successors nodes is called
as
A) Singly Linked List
B) Circular Linked List
C) Doubly Linked List
D) Linear Linked List

51. Which of the following is an application of stack?


A) finding factorial
B) tower of Hanoi
C) infix to postfix conversion
D) all of the above

52. The data structure which is one ended is ………………


A) queue
B) stack
C) tree
D) graph

53. In a circular linked list


a) Components are all linked together in some sequential manner.
b) There is no beginning and no end.
c) Components are arranged hierarchically.
d) Forward and backward traversal within the list is permitted.

54. 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

55. Which of the following operations is performed more efficiently by doubly linked list than by singly
linked list?
a) Deleting a node whose location in given
b) Searching of an unsorted list for a given item
c) Inverting a node after the node with given location
d) Traversing a list to process each node

56. 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 list

a) I and II
b) I and III
c) I,II and III
d) I,II and IV

57. 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
a) I and II
b) I and III
c) I,II and III
d) I,II,III and IV

58. Consider an implementation of unsorted doubly 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?
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
a) I and II
b) I and III
c) I,II and III
d) I,II,III and IV

59. Consider an implementation of unsorted circular 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?
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
a) I and II
b) I and III
c) I, II, III and IV
d) None

 60. Consider an implementation of unsorted circular doubly 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?
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
a) I and II
b) I and III
c) I, II and III
d) I,II,III and IV

61. 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

62. In doubly linked lists, traversal can be performed?


a) Only in forward direction
b) Only in reverse direction
c) In both directions
d) None

63. 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

 64. 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

65. In circular linked list, insertion of node requires modification of?


a) One pointer
b) Two pointer
c) Three pointer
d) None

66. Linked lists are not suitable to for the implementation of?
a) Insertion sort
b) Radix sort
c) Polynomial manipulation
d) Binary search

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
a) the list is empty or has exactly one element
b) the element in the list are sorted in non-decreasing order of data value
c) the element in the list are sorted in non-increasing order of data value
d) not all element in the list have the same data value

67. The following C function takes a singly linked list as input argument. It modifies the list by moving
the last element to the front of the list and returns the modified list. Some part of the code left blank.

typedef struct node


{
int value;
struct node* next;
}Node;
Node* move_to_front(Node* head)
{
Node* p, *q;
if((head==NULL) || (head->next==NULL))
return head;
q=NULL;
p=head;
while(p->next != NULL)
{
q=p;
p=p->next;
}
return head;
}

Choose the correct alternative to replace the blank line

a) q=NULL; p->next=head; head =p ;


b) q->next=NULL; head =p; p->next = head;
c) head=p; p->next=q; q->next=NULL;
d) q->next=NULL; p->next=head; head=p;

68. The following C Function takes a singly- linked list of integers as a parameter and rearranges
the elements of the lists. The function is called with the list containing the integers 1,2,3,4,5,6,7 in the
given order. What will be the contents of the list after the function completes execution?

struct node{
int value;
struct node* next;
};
void rearrange (struct node* list)
{
struct node *p,q;
int temp;
if (! List || ! list->next) return;
p->list; q=list->next;
while(q)
{
temp=p->value; p->value=q->value;
q->value=temp;p=q->next;
q=p?p->next:0;
}
}

a) 1, 2, 3, 4, 5, 6, 7
b) 2, 1, 4, 3, 6, 5, 7
c) 1, 3, 2, 5, 4, 7, 6
d) 2, 3, 4, 5, 6, 7, 1

69. What does the following function do for a given Linked List with first node as head?
void fun1(struct node* head)
{
if(head == NULL)
return;
fun1(head->next);
printf("%d ", head->data);
}

70. A. Prints all nodes of linked lists


B. Prints all nodes of linked list in reverse order
C. Prints alternate nodes of Linked List
D. Prints alternate nodes in reverse order

71. How many pointers are contained as data members in the nodes of a circular, doubly linked list of
integers with five nodes?
a. 5
b. 8
c. 10
d. 15

72. What is the output of following function for start pointing to first node of following linked list? 1->2-
>3->4->5->6
void fun(struct node* start)
{
if(start == NULL)
return;
printf("%d ", start->data);
if(start->next != NULL )
fun(start->next->next);
printf("%d ", start->data);
}
A. 1 4 6 6 4 1
B. 1 3 5 1 3 5
C. 1 2 3 5
D. 1 3 5 5 3 1
73. Which of these is an application of linked lists?
A. To implement file systems
B. For separate chaining in hash-tables
C. To implement non-binary trees
D. All of the mentioned

74. 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?
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 list
A. I and II
B. I and III
C. I, II and III
D. I, II and IV

75. Which of the following points is/are true about Linked List data structure when it is compared with
array
A. Arrays have better cache locality that can make them better in terms of performance
B. It is easy to insert and delete elements in Linked List
C. Random access is not allowed in a typical implementation of Linked Lists
D. All of the mentioned

76.  Given pointer to a node X in a singly linked list. Only one pointer is given, pointer to head node is
not given, can we delete the node X from given linked list?
A. Possible if X is not last node
B. Possible if size of linked list is even
C. Possible if size of linked list is odd
D. Possible if X is not first node

77. Each node in singly linked list has …….. fields.


A. 2
B. 3
C. 1
D. 4

78. Which of the following are two-way lists?


A. Grounded header list
B. Circular header list
C. Linked list with header and trailer nodes

79. Value of first linked list index is ….


A. 0
B. 1
C. -1
D. 2

80.  In linked lists, there are no NULL links in


A. single linked list
B. linear doubly linked list
C. circular linked list
D. linked list

81. Each node in a linked list must contain at least …..


A. Three fields
B. Two fields
C. Four fields
D. Five fields

82. The dummy header in linked list contain …..


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. middle record of the actual data

83. In a linked list the ………. field contains the address of next element in the list.
A. Link field
B. Next element field
C. Start field
D. Info field

84.  To insert a new node in linked list free node will be available in ........
A. Available list
B. Avail list
C. Free node list
D. Memory space list

85. A singly linked list is also called as ........


A. linked list
B. one way chain
C. two way chain
D. right link

86. A ..... list is a header list where the node points back to the header node.
A. Circular header
B. Grounded header
C. Two way header
D. One way header

87. Header linked lists are frequently used for maintaining ........ in memory.
A. Polynomials
B. Binomial
C. Trinomial
D. Quadratic equation

88. The pointer that points to the first node in the list is ........
A. FIRST
B. AVAIL
C. TOP
D. REAR

89. Two-way list may be maintained in memory by means of .............


A. Queues
B. Linear arrays
C. Non linear arrays
D. Stacks

90. A doubly linked list is also called as ..........


A. linked list
B. one way chain
C. two way chain
D. right link

91. If the availability list is null, then the condition is said to be .........
A. nil block
B. availability list underflow
C. availability list overflow
D. memory loss

92. The list which has its own pointer is called ........
A. pointer list
B. self pointer
C. free pool
D. own pointer

93.  Indexing the …….. element in the list is not possible in linked lists.
A. middle
B. first
C. last
D. any where in between

94. A .......... is a header list where the last node contains the null pointer.
A. grounded header list
B. bottom header list
C. down header list
D. dropped header list

95.  In a linked list, insertion can be done as .........


A. beginning
B. end
C. middle
D. all of the above

96. The disadvantage in using a circular linked list is .......


A. it is possible to get into infinite loop
B. last node points to fist node.
C. time consuming
D. requires more memory space.

97. Which of the following conditions checks available free space in avail list?
A. Avail=Null
B. Null=Avail
C. Avail=Max stack
D. Avail=Top

98. …………… is not the component of the data structure.


A) Operations
B) Storage Structures
C) Algorithms
D) None of the above
99. Which of the following is not the part of ADT description?
A) Data
B) Operations
C) Both of the above
D) None of the above

100. Which of the following application makes use of a circular linked list?
A. Undo operation in a text editor
B. Recursive function calls
C. Allocating CPU to resources
D. Implement Hash Tables.

You might also like