Quiz on StackBy sadmanhafij.com / March 5, 2024 QUIZ On STACK Mastering Stacks in C: Learn and Test Your Knowledge Stay curious, keep exploring, and happy coding! 1 / 20 What is a stack in data structure? A) A linear data structure B) A non-linear data structure C) A hierarchical data structure D) A graph data structure 2 / 20 Which operation adds an element to the top of the stack? A) push() B) pop() C) top() D) isEmpty() 3 / 20 In a stack, which element is the first to be inserted? A) Top element B) Bottom element C) Middle element D) None of the above 4 / 20 Which of the following is the correct order of operations for a stack? A) First In Last Out (FILO) B) First In First Out (FIFO) C) Last In Last Out (LILO) D) Last In First Out (LIFO) 5 / 20 What is the time complexity of the push operation in a stack implemented using an array? A) O(1) B) O(n) C) O(log n) D) O(n log n) 6 / 20 Which operation removes an element from the top of the stack? A) push() B) pop() C) top() D) isEmpty() 7 / 20 Which of the following data structures is not suitable for implementing a stack? A) Array B) Linked List C) Queue D) Dynamic Array 8 / 20 What is the minimum number of elements a stack can contain? 0 1 2 3 9 / 20 Which stack operation is used to retrieve the top element without removing it? A) pop() B) push() C) peek() D) empty() 10 / 20 Which of the following data structures can be used to implement a stack in C? A) Array B) Linked List C) Queue E) A & B D) All of the above 11 / 20 In stack implementation using arrays, if the stack is full and push operation is called, what will happen? A) Stack Overflow B) Stack Underflow C) No change D) Undefined behavior 12 / 20 Which of the following is not a standard stack application? A) Expression evaluation B) Parsing HTML/XML tags C) Tower of Hanoi D) Depth First Search (DFS) in graphs 13 / 20 Which operation checks whether the stack is empty? A) push() B) pop() C) top() D) isEmpty() 14 / 20 What happens when pop operation is performed on an empty stack? A) Stack Overflow B) Stack Underflow C) No change D) Undefined behavior 15 / 20 Which stack operation removes all elements from the stack? A) clear() B) pop() C) delete() D) removeAll() 16 / 20 In stack implementation using linked list, what does the 'next' pointer of the top node point to? A) NULL B) Itself C) Previous node D) Next node 17 / 20 Which of the following is not a limitation of stack data structure? A) Limited size B) Random access C) Overflow D) Underflow 18 / 20 Which data structure supports recursion? A) Queue B) Stack C) Linked List D) Tree 19 / 20 Which of the following is the correct way to check if a stack is empty? A) stack.top == 0 B) stack.top == -1 C) stack.top == MAX_SIZE - 1 D) stack.top > 0 20 / 20 What is the primary advantage of using a stack data structure? A) Constant time insertion and deletion B) Constant time search operation C) Support for random access of elements D) Last In First Out (LIFO) property Your score isThe average score is 75% 0% Restart quiz