Unit 1 MCQ
Unit 1 MCQ
Unit 1 MCQ
Answer: b
Answer: c
b) int arr[];
Answer: c
a) int[] arr;
b) int arr[[]];
c) int[][]arr;
1 www.studymaterialz.in
CS8391 DATA STRUCTURES
d) int[[]] arr;
Answer: c
5. a) 3 and 5
b) 5 and 3
c) 2 and 4
d) 4 and 2
Answer: a
6. a) 4
b) 5
c) ArrayIndexOutOfBoundsException
d) InavlidInputException
Answer: c
a) Compile-time
b) Run-time
c) Not an error
Answer: b
a) Binary trees
b) Scheduling of processes
c) Caching
d) Spatial locality
Answer: d
2 www.studymaterialz.in
CS8391 DATA STRUCTURES
Answer: d
b) There are chances of wastage of memory space if elements inserted in an array are lesser than the
allocated size
Answer: b
a) 15
b) 19
c) 11
d) 60
Answer: d
a) 0
b) -1
c) 2
d) 1
Answer: a
a) randomly
b) sequentially
c) exponentially
3 www.studymaterialz.in
CS8391 DATA STRUCTURES
d) logarithmically
Answer: a
a) Fixed size
b) There are chances of wastage of memory space if elements inserted in an array are lesser than the
allocated size
Answer: d
15. What is the time complexity of inserting at the end in dynamic arrays?
a) O(1)
b) O(n)
c) O(logn)
Answer: d
16. What is the time complexity to count the number of elements in the linked list?
a) O(1)
b) O(n)
c) O(logn)
d) O(n2)
Answer: b
Answer: c
4 www.studymaterialz.in
CS8391 DATA STRUCTURES
a) O(1)
b) O(n)
d) O(logn)
Answer: a
Answer: d
c) Find and return the position of the given element in the list
Answer: c
Answer: d
22. What is the worst case time complexity of inserting a node in a doubly linked list?
a) O(nlogn)
b) O(logn)
c) O(n)
5 www.studymaterialz.in
CS8391 DATA STRUCTURES
d) O(1)
Answer: c
23. 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
Answer: c
24. 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
Answer: b
25. 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
Answer: b
26. 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
c) You may or may not have the ‘next’ pointer point to null in a circular linked list
Answer: c
6 www.studymaterialz.in
CS8391 DATA STRUCTURES
Answer: b
28. What is the time complexity of searching for an element in a circular linked list?
a) O(n)
b) O(nlogn)
c) O(1)
d) O(n2)
Answer: a
29. Which of the following application makes use of a circular linked list?
Answer: c
b) Returns the data and deletes the node at the end of the list
d) Returns the data and deletes the node from the beginning of the list
Answer: d
b) Returns the data and deletes the node at the end of the list
d) Returns the data and deletes the node from the beginning of the list
Answer: b
7 www.studymaterialz.in
CS8391 DATA STRUCTURES
b) Time complexity of inserting a new node at the head of the list is O(1)
d) We can traverse the whole circular linked list by starting from any point
Answer: b
33. 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
d) Circular linked list itself represents a cycle. So no new cycles cannot be generated
Answer: b
34. 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
Answer: a
35. 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?
Answer: b
36. 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
8 www.studymaterialz.in
CS8391 DATA STRUCTURES
c) Pointer to node
d) Node
Answer: c
37. 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
38. What would be the asymptotic time complexity to insert an element at the front of the linked list
(head is known)?
a) O(1)
b) O(n)
c) O(n2)
d) O(n3)
Answer: a
39. 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) O(n4)
Answer: b
40. 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)
9 www.studymaterialz.in
CS8391 DATA STRUCTURES
d) O(n3)
Answer: a
41. The concatenation of two list can performed in O(1) time. Which of the following variation of
linked list can be used?
Answer: c
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
10 www.studymaterialz.in