Stack using Array and Linked List MCQs

Stack using Array and Linked List MCQs

 Q1. 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. all of the mentioned. 

Answer= piling up of chairs one above the other


Q2. What does 'stack underflow' refer to?. 

A. accessing item from an undefined stack. 

B. adding items to a full stack. 

C. removing items from an empty stack. 

D. index out of bounds exception. 

Answer= removing items from an empty stack


Q3. 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). 

Answer= O(1)


Q4. 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].. 

Answer= S[N].


Q5. 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 thrown. 

Answer= EmptyStackException is thrown


Q6. '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. all of the mentioned. 

Answer= space allocation for array is fixed and cannot be changed during run-time


Q7. 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].. 

Answer= S[N-1].


Q8. What is the complexity of searching for a particular element in a Singly Linked List?. 

A. O(n). 

B. O(1). 

C. logn. 

D. nlogn. 

Answer= O(n)


Q9. Which of the following statements are correct with respect to Singly Linked List(SLL) and Doubly Linked List(DLL)?. 

A. Complexity of Insertion and Deletion at known position is O(n) in SLL and O(1) in DLL. 

B. SLL uses lesser memory per node than DLL. 

C. DLL has more searching power than SLL. 

D. All of the mentioned. 

Answer= All of the mentioned


Q10. What does 'stack overflow' refer to?. 

A. accessing item from an undefined stack. 

B. adding items to a full stack. 

C. removing items from an empty stack. 

D. index out of bounds exception. 

Answer= adding items to a full stack


Q11. Which of the following data structures can be used for parentheses matching?. 

A. n-ary tree. 

B. queue. 

C. priority queue. 

D. stack. 

Answer= stack


Q12. Minimum number of queues to implement stack is ___________. 

A. 3. 

B. 4. 

C. 1. 

D. 2. 

Answer= 1

Previous Post Next Post