InterviewSolution
This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
Given only a single array of size 10 and no other memory is available. Which of the following operation is not feasible to implement (Given only push and pop operation)?(a) Push(b) Pop(c) Enqueue(d) ReturntopQuery is from Queue using Stacks topic in portion Abstract Data Types of Data Structures & Algorithms II have been asked this question in an interview for internship. |
|
Answer» RIGHT choice is (c) Enqueue The best explanation: To perform Enqueue using just push and pop OPERATIONS, there is a NEED of another ARRAY of same size. But as there is no extra available memeory, the given operation is not feasible. |
|
| 2. |
Why is implementation of stack operations on queues not feasible for a large dataset (Asssume the number of elements in the stack to be n)?(a) Because of its time complexity O(n)(b) Because of its time complexity O(log(n))(c) Extra memory is not required(d) There are no problemsThis key question is from Queue using Stacks topic in portion Abstract Data Types of Data Structures & Algorithms II have been asked this question in homework. |
|
Answer» The CORRECT answer is (a) Because of its time complexity O(N) |
|
| 3. |
What is the time complexity to insert a node based on position in a priority queue?(a) O(nlogn)(b) O(logn)(c) O(n)(d) O(n^2)My query is from Priority Queue in portion Abstract Data Types of Data Structures & Algorithms II have been asked this question in quiz. |
|
Answer» Right option is (c) O(n) |
|
| 4. |
Which of the following is not an advantage of a priority queue?(a) Easy to implement(b) Processes with different priority can be efficiently handled(c) Applications with differing requirements(d) Easy to delete elements in any caseThis is a very interesting question from Priority Queue topic in chapter Abstract Data Types of Data Structures & Algorithms II got this question in examination. |
|
Answer» The correct answer is (d) EASY to DELETE elements in any case |
|
| 5. |
Which of the following is true about linked list implementation of queue?(a) In push operation, if new nodes are inserted at the beginning of linked list, then in pop operation, nodes must be removed from end(b) In push operation, if new nodes are inserted at the beginning, then in pop operation, nodes must be removed from the beginning(c) In push operation, if new nodes are inserted at the end, then in pop operation, nodes must be removed from end(d) In push operation, if new nodes are inserted at the end, then in pop operation, nodes must be removed from beginningMy question is taken from Queue using Linked List in portion Abstract Data Types of Data Structures & Algorithms II got this question in class test. |
|
Answer» The CORRECT ANSWER is (a) In push operation, if NEW nodes are inserted at the beginning of LINKED list, then in pop operation, nodes must be removed from end |
|
| 6. |
The essential condition which is checked before deletion in a linked queue is?(a) Underflow(b) Overflow(c) Front value(d) Rear valueThe question is from Queue using Linked List in division Abstract Data Types of Data Structures & Algorithms IThis question was posed to me in an online interview. |
|
Answer» Correct OPTION is (a) Underflow |
|
| 7. |
The essential condition which is checked before insertion in a linked queue is?(a) Underflow(b) Overflow(c) Front value(d) Rear valueI'm obligated to ask this question of Queue using Linked List in division Abstract Data Types of Data Structures & Algorithms IThis question was posed to me by my college professor while I was bunking the class. |
|
Answer» The CORRECT answer is (b) Overflow |
|
| 8. |
In linked list implementation of a queue, the important condition for a queue to be empty is?(a) FRONT is null(b) REAR is null(c) LINK is empty(d) FRONT==REAR-1This interesting question is from Queue using Linked List in portion Abstract Data Types of Data Structures & Algorithms II got this question during an interview. |
|
Answer» CORRECT CHOICE is (a) FRONT is null Explanation: Because front REPRESENTS the deleted NODES. |
|
| 9. |
In linked list implementation of a queue, from where is the item deleted?(a) At the head of link list(b) At the centre position in the link list(c) At the tail of the link list(d) Node before the tailOrigin of the question is Queue using Linked List topic in section Abstract Data Types of Data Structures & Algorithms II had been asked this question during an internship interview. |
|
Answer» Correct ANSWER is (a) At the head of link list |
|
| 10. |
In case of insertion into a linked queue, a node borrowed from the __________ list is inserted in the queue.(a) AVAIL(b) FRONT(c) REAR(d) NULLMy question is from Queue using Linked List in section Abstract Data Types of Data Structures & Algorithms IThe question was posed to me in an international level competition. |
|
Answer» The CORRECT choice is (a) AVAIL |
|
| 11. |
In linked list implementation of a queue, front and rear pointers are tracked. Which of these pointers will change during an insertion into EMPTY queue?(a) Only front pointer(b) Only rear pointer(c) Both front and rear pointer(d) No pointer will be changedThis intriguing question originated from Queue using Linked List topic in portion Abstract Data Types of Data Structures & Algorithms IThis question was posed to me in quiz. |
|
Answer» Correct choice is (c) Both FRONT and rear pointer |
|
| 12. |
In linked list implementation of a queue, front and rear pointers are tracked. Which of these pointers will change during an insertion into a NONEMPTY queue?(a) Only front pointer(b) Only rear pointer(c) Both front and rear pointer(d) No pointer will be changedThis interesting question is from Queue using Linked List topic in portion Abstract Data Types of Data Structures & Algorithms II have been asked this question in semester exam. |
|
Answer» CORRECT answer is (b) Only rear pointer Easiest explanation - Since QUEUE follows FIFO so NEW element inserted at last. |
|
| 13. |
In linked list implementation of a queue, where does a new element be inserted?(a) At the head of link list(b) At the centre position in the link list(c) At the tail of the link list(d) At any position in the linked listI want to ask this question from Queue using Linked List topic in portion Abstract Data Types of Data Structures & Algorithms IThis question was posed to me in homework. |
|
Answer» Right option is (C) At the tail of the LINK list |
|
| 14. |
In linked list implementation of queue, if only front pointer is maintained, which of the following operation take worst case linear time?(a) Insertion(b) Deletion(c) To empty a queue(d) Both Insertion and To empty a queueMy question is taken from Queue using Linked List topic in portion Abstract Data Types of Data Structures & Algorithms II got this question during an interview for a job. |
|
Answer» RIGHT OPTION is (d) Both Insertion and To empty a queue The best I can explain: Since front pointer is used for DELETION, so worst TIME for the other two cases. |
|
| 15. |
Minimum number of queues to implement stack is ___________(a) 3(b) 4(c) 1(d) 2My query is from Stack using Linked List in chapter Abstract Data Types of Data Structures & Algorithms IThe question was asked in homework. |
|
Answer» Correct choice is (c) 1 |
|
| 16. |
Which of the following array element will return the top-of-the-stack-element for a stack of size N elements(capacity of stack > N)?(a) S[N-1](b) S[N](c) S[N-2](d) S[N+1]The question is from Stack using Array in portion Abstract Data Types of Data Structures & Algorithms IThe question was posed to me in an online interview. |
|
Answer» CORRECT option is (a) S[N-1] Best explanation: Array INDEXING start from 0, hence N-1 is the LAST INDEX. |
|
| 17. |
Array implementation of Stack is not dynamic, which of the following statements supports this argument?(a) space allocation for array is fixed and cannot be changed during run-time(b) user unable to give the input for stack operations(c) a runtime exception halts execution(d) improper program compilationMy question comes from Stack using Array topic in division Abstract Data Types of Data Structures & Algorithms IThe question was posed to me in my homework. |
|
Answer» RIGHT option is (a) space allocation for array is FIXED and cannot be changed during run-time For explanation: You cannot modify the SIZE of an array once the MEMORY has been allocated, ADDING fewer elements than the array size would cause wastage of space, and adding more elements than the array size at run time would cause Stack Overflow. |
|
| 18. |
What happens when you pop from an empty stack while implementing using the Stack ADT in Java?(a) Undefined error(b) Compiler displays a warning(c) EmptyStackException is thrown(d) NoStackException is thrownMy query is from Stack using Array topic in portion Abstract Data Types of Data Structures & Algorithms IThis question was addressed to me during an internship interview. |
|
Answer» Right CHOICE is (c) EMPTYSTACKEXCEPTION is thrown |
|
| 19. |
Which of the following array position will be occupied by a new element being pushed for a stack of size N elements(capacity of stack > N)?(a) S[N-1](b) S[N](c) S[1](d) S[0]This intriguing question originated from Stack using Array in chapter Abstract Data Types of Data Structures & Algorithms II had been asked this question during a job interview. |
|
Answer» Right ANSWER is (B) S[N] |
|
| 20. |
What is the time complexity of pop() operation when the stack is implemented using an array?(a) O(1)(b) O(n)(c) O(logn)(d) O(nlogn)My enquiry is from Stack using Array in division Abstract Data Types of Data Structures & Algorithms II have been asked this question in an interview for job. |
|
Answer» The correct answer is (a) O(1) |
|
| 21. |
Which of the following real world scenarios would you associate with a stack data structure?(a) piling up of chairs one above the other(b) people standing in a line to be serviced at a counter(c) offer services based on the priority of the customer(d) tatkal Ticket Booking in IRCTCEnquiry is from Stack using Array in division Abstract Data Types of Data Structures & Algorithms II have been asked this question in examination. |
|
Answer» Correct option is (a) piling up of chairs one above the other |
|
| 22. |
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 generatedThis question is from Circular Linked List in section Abstract Data Types of Data Structures & Algorithms II had been asked this question during an online exam. |
|
Answer» Correct choice is (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 |
|
| 23. |
In the worst case, the number of comparisons needed to search a singly linked list of length n for a given element is?(a) log2 n(b) ^n⁄2(c) log2 n – 1(d) nThe above asked question is from Singly Linked List Operations topic in portion Abstract Data Types of Data Structures & Algorithms IThe question was asked in quiz. |
|
Answer» CORRECT answer is (d) n The BEST I can explain: The worst-case happens if the REQUIRED ELEMENT is at last or the element is absent in the list. For this, we need to compare every element in the linked list. If n elements are there, n COMPARISONS will happen in the worst case. |
|
| 24. |
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 listThis intriguing question originated from Singly Linked List Operations topic in section Abstract Data Types of Data Structures & Algorithms IThe question was posed to me during an online exam. |
|
Answer» Right choice is (c) Delete the last element of the list |
|
| 25. |
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 nodeMy question is from Singly Linked List Operations topic in division Abstract Data Types of Data Structures & Algorithms II had been asked this question by my college director while I was bunking the class. |
|
Answer» Correct OPTION is (a) POSSIBLE if X is not last node |
|
| 26. |
Which of the following sorting algorithms can be used to sort a random linked list with minimum time complexity?(a) Insertion Sort(b) Quick Sort(c) Heap Sort(d) Merge SortI want to ask this question from Singly Linked List Operations in division Abstract Data Types of Data Structures & Algorithms IThis question was posed to me in my homework. |
|
Answer» The correct option is (d) Merge Sort |
|
| 27. |
Which of the following points is/are not true about Linked List data structure when it is compared with an 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 arraysQuery is from Singly Linked List Operations topic in chapter Abstract Data Types of Data Structures & Algorithms II have been asked this question in a job interview. |
|
Answer» RIGHT option is (d) Access of elements in linked list takes less time than compared to ARRAYS Easy explanation - To access an element in a linked list, we need to TRAVERSE every element until we reach the desired element. This will take more time than arrays as arrays PROVIDE random access to its elements. |
|
| 28. |
Linked list data structure offers considerable saving in _____________(a) Computational Time(b) Space Utilization(c) Space Utilization and Computational Time(d) Speed UtilizationMy query is from Singly Linked List Operations in portion Abstract Data Types of Data Structures & Algorithms II had been asked this question by my school teacher while I was bunking the class. |
|
Answer» The correct answer is (c) SPACE Utilization and COMPUTATIONAL Time |
|
| 29. |
In Linked List implementation, a node carries information regarding ___________(a) Data(b) Link(c) Data and Link(d) NodeEnquiry is from Singly Linked List Operations in division Abstract Data Types of Data Structures & Algorithms IThis question was posed to me in class test. |
|
Answer» Correct answer is (c) DATA and LINK |
|
| 30. |
Linked list is considered as an example of ___________ type of memory allocation.(a) Dynamic(b) Static(c) Compile time(d) HeapQuery is from Singly Linked List Operations in section Abstract Data Types of Data Structures & Algorithms IThis question was addressed to me in a job interview. |
|
Answer» RIGHT choice is (a) Dynamic Best EXPLANATION: As memory is ALLOCATED at the run TIME. |
|
| 31. |
Linked lists are not suitable for the implementation of ___________(a) Insertion sort(b) Radix sort(c) Polynomial manipulation(d) Binary searchI want to ask this question from Singly Linked List Operations topic in section Abstract Data Types of Data Structures & Algorithms II had been asked this question in final exam. |
|
Answer» CORRECT choice is (d) Binary search Best explanation: It cannot be implemented USING linked LISTS. |
|
| 32. |
What kind of linked list is best to answer questions 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 listMy question is from Singly Linked List Operations in section Abstract Data Types of Data Structures & Algorithms II had been asked this question in an online interview. |
|
Answer» Right option is (d) Array implementation of linked LIST |
|
| 33. |
The concatenation of two lists can be performed in O(1) time. Which of the following variation of the linked list can be used?(a) Singly linked list(b) Doubly linked list(c) Circular doubly linked list(d) Array implementation of listOrigin of the question is Singly Linked List Operations in portion Abstract Data Types of Data Structures & Algorithms IThis question was addressed to me in class test. |
|
Answer» The correct ANSWER is (c) CIRCULAR doubly linked LIST |
|
| 34. |
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(n^2)(d) O(n^3)My question is based upon Singly Linked List Operations topic in division Abstract Data Types of Data Structures & Algorithms IThis question was addressed to me in class test. |
|
Answer» Right OPTION is (a) O(1) |
|
| 35. |
What would be the asymptotic time complexity to find an element in the linked list?(a) O(1)(b) O(n)(c) O(n^2)(d) O(n^4)This is a very interesting question from Singly Linked List Operations topic in chapter Abstract Data Types of Data Structures & Algorithms II got this question by my college director while I was bunking the class. |
|
Answer» Correct ANSWER is (B) O(n) |
|
| 36. |
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(n^2)(d) O(n^3)The doubt is from Singly Linked List Operations in chapter Abstract Data Types of Data Structures & Algorithms II have been asked this question during an online interview. |
|
Answer» The correct OPTION is (a) O(1) |
|
| 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)Question is from Singly Linked List Operations in portion Abstract Data Types of Data Structures & Algorithms II had been asked this question in an international level competition. |
|
Answer» Right choice is (C) θ(n) |
|
| 38. |
In linked list each node contains a 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) NodeQuestion is from Singly Linked List Operations in portion Abstract Data Types of Data Structures & Algorithms IThis question was posed to me in class test. |
|
Answer» Right OPTION is (C) Pointer to NODE |
|
| 39. |
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 listMy question is taken from Singly Linked List Operations topic in portion Abstract Data Types of Data Structures & Algorithms IThis question was addressed to me at a job interview. |
|
Answer» The correct option is (a) Linked list |
|
| 40. |
Which of the following is not the type of queue?(a) Ordinary queue(b) Single ended queue(c) Circular queue(d) Priority queueMy question is from Queue Operations in chapter Abstract Data Types of Data Structures & Algorithms IThis question was posed to me in exam. |
|
Answer» The CORRECT choice is (B) Single ended queue |
|
| 41. |
Queues serve major role in ______________(a) Simulation of recursion(b) Simulation of arbitrary linked list(c) Simulation of limited resource allocation(d) Simulation of heap sortThe above asked question is from Queue Operations topic in portion Abstract Data Types of Data Structures & Algorithms II have been asked this question during an interview for a job. |
|
Answer» Correct choice is (c) Simulation of LIMITED RESOURCE allocation |
|
| 42. |
A normal queue, if implemented using an array of size MAX_SIZE, gets full when?(a) Rear = MAX_SIZE – 1(b) Front = (rear + 1)mod MAX_SIZE(c) Front = rear + 1(d) Rear = frontQuestion is taken from Queue Operations topic in division Abstract Data Types of Data Structures & Algorithms IThe question was posed to me in my homework. |
|
Answer» Correct ANSWER is (a) Rear = MAX_SIZE – 1 |
|
| 43. |
A data structure in which elements can be inserted or deleted at/from both ends but not in the middle is?(a) Queue(b) Circular queue(c) Dequeue(d) Priority queueAsked question is from Queue Operations in portion Abstract Data Types of Data Structures & Algorithms IThe question was asked in examination. |
|
Answer» Correct answer is (C) Dequeue |
|
| 44. |
If the elements “A”, “B”, “C” and “D” are placed in a queue and are deleted one at a time, in what order will they be removed?(a) ABCD(b) DCBA(c) DCAB(d) ABDCMy question comes from Queue Operations topic in portion Abstract Data Types of Data Structures & Algorithms II got this question in homework. |
|
Answer» Right answer is (a) ABCD |
|
| 45. |
Circular Queue is also known as ________(a) Ring Buffer(b) Square Buffer(c) Rectangle Buffer(d) Curve BufferMy enquiry is from Queue Operations topic in portion Abstract Data Types of Data Structures & Algorithms II had been asked this question in examination. |
|
Answer» The CORRECT choice is (a) Ring BUFFER |
|
| 46. |
A queue follows __________(a) FIFO (First In First Out) principle(b) LIFO (Last In First Out) principle(c) Ordered array(d) Linear treeMy doubt is from Queue Operations topic in portion Abstract Data Types of Data Structures & Algorithms IThe question was asked in final exam. |
|
Answer» CORRECT answer is (a) FIFO (First In First Out) PRINCIPLE For explanation: ELEMENT first added in queue will be DELETED first which is FIFO principle. |
|
| 47. |
The data structure required for Breadth First Traversal on a graph is?(a) Stack(b) Array(c) Queue(d) TreeMy doubt is from Queue Operations topic in section Abstract Data Types of Data Structures & Algorithms IThe question was posed to me in quiz. |
|
Answer» Right CHOICE is (c) Queue |
|
| 48. |
A linear list of elements in which deletion can be done from one end (front) and insertion can take place only at the other end (rear) is known as _____________(a) Queue(b) Stack(c) Tree(d) Linked listThe question is from Queue Operations topic in section Abstract Data Types of Data Structures & Algorithms IThis question was posed to me at a job interview. |
|
Answer» The correct option is (a) Queue |
|
| 49. |
If the elements “A”, “B”, “C” and “D” are placed in a stack and are deleted one at a time, what is the order of removal?(a) ABCD(b) DCBA(c) DCAB(d) ABDCThis intriguing question comes from Stack Operations in chapter Abstract Data Types of Data Structures & Algorithms IThis question was addressed to me in homework. |
|
Answer» RIGHT CHOICE is (B) DCBA The explanation is: Stack follows LIFO(Last In First Out). So the removal order of elements are DCBA. |
|
| 50. |
The type of expression in which operator succeeds its operands is?(a) Infix Expression(b) Prefix Expression(c) Postfix Expression(d) Both Prefix and Postfix ExpressionsI would like to ask this question from Stack Operations topic in division Abstract Data Types of Data Structures & Algorithms II got this question during an online interview. |
|
Answer» The correct choice is (c) Postfix Expression |
|