solution - Data Structures and Algorithms : Stack (Test 1)

Question : What is a Stack?

Solution :
246220260611042016 Correct Answer : Linear data structure following LIFO

Description -

Data Structures and Algorithms : Stack (Test 1)

Question : Which operation inserts an element into a stack?

Solution :
656920260611041947 Correct Answer : Push

Description -

Data Structures and Algorithms : Stack (Test 1)

Question : Which operation removes the top element from a stack?

Solution :
617420260611041903 Correct Answer : Pop

Description -

Data Structures and Algorithms : Stack (Test 1)

Question : Which element can be accessed directly in a stack?

Solution :
477920260611041839 Correct Answer : Top element

Description -

Data Structures and Algorithms : Stack (Test 1)

Question : What is the time complexity of Push operation?

Solution :
442120260611041750 Correct Answer : O(1)

Description -

Data Structures and Algorithms : Stack (Test 1)

Question : What is the time complexity of Pop operation?

Solution :
679620260611041700 Correct Answer : O(1)

Description -

Data Structures and Algorithms : Stack (Test 1)

Question : Which condition occurs when attempting to pop from an empty stack?

Solution :
87720260611041629 Correct Answer : Underflow

Description -

Data Structures and Algorithms : Stack (Test 1)

Question : Which condition occurs when pushing into a full array stack?

Solution :
263220260611041536 Correct Answer : Overflow

Description -

Data Structures and Algorithms : Stack (Test 1)

Question : In an array implementation of stack, the top pointer initially is usually:

Solution :
860320260611041500 Correct Answer : -1

Description -

Data Structures and Algorithms : Stack (Test 1)

Question : Which notation uses stacks for evaluation?

Solution :
158720260611041428 Correct Answer : All of these

Description -

Data Structures and Algorithms : Stack (Test 1)

Question : If stack contains [10, 20, 30] (30 at top), after one pop?

Solution :
128820260611041340 Correct Answer : [10,20]

Description -

Data Structures and Algorithms : Stack (Test 1)

Question : What will be the top element after pushing 5, 10, 15?

Solution :
870220260611041259 Correct Answer : 15

Description -

Data Structures and Algorithms : Stack (Test 1)

Question : Which function returns the top element without removing it?

Solution :
770320260611041222 Correct Answer : Peek/Top

Description -

Data Structures and Algorithms : Stack (Test 1)

Question : In linked list implementation of stack, insertion occurs at:

Solution :
148820260611041142 Correct Answer : Head

Description -

Data Structures and Algorithms : Stack (Test 1)

Question : What is the space complexity of a stack containing n elements?

Solution :
739020260611041107 Correct Answer : O(n)

Description -

Data Structures and Algorithms : Stack (Test 1)

Question : Which data structure is used in function call management?

Solution :
966920260611041030 Correct Answer : Stack

Description -

Data Structures and Algorithms : Stack (Test 1)

Question : What is the output?

Push(1)
Push(2)
Pop()
Push(3)
Top element = ?

Solution :
885220260611040953 Correct Answer : 3

Description -

Data Structures and Algorithms : Stack (Test 1)

Question : Which application uses stack?

Solution :
368120260611040908 Correct Answer : All of these

Description -

Data Structures and Algorithms : Stack (Test 1)

Question : Linked list stack avoids:

Solution :
304520260611040813 Correct Answer : Overflow due to fixed size

Description -

Data Structures and Algorithms : Stack (Test 1)

Question : In array stack of size 5, if top = 4:

Solution :
674320260611040733 Correct Answer : Full stack

Description -

Data Structures and Algorithms : Stack (Test 1)

Question : What is the postfix expression of A + B * C?

Solution :
222020260611040652 Correct Answer : ABC*+

Description -

Data Structures and Algorithms : Stack (Test 1)

Question : Evaluate postfix:

5 2 + 3 *

Solution :
435920260611040606 Correct Answer : 21

Description -

Data Structures and Algorithms : Stack (Test 1)

Question : Which stack application checks balanced parentheses?

Solution :
148120260611040456 Correct Answer : Parenthesis Matching

Description -

Data Structures and Algorithms : Stack (Test 1)

Question : For array stack:

Push(10)
Push(20)
Push(30)
Pop()
Push(40)
Top element?

Solution :
492020260611040227 Correct Answer : 40

Description -

Data Structures and Algorithms : Stack (Test 1)

Question : In linked-list stack, push operation complexity is:

Solution :
588620260611040120 Correct Answer : O(1)

Description -

Data Structures and Algorithms : Stack (Test 1)

Question : What is the output?

Push(1)
Push(2)
Push(3)
Pop()
Pop()
Remaining top?

Solution :
879620260611040033 Correct Answer : 1

Description -

Data Structures and Algorithms : Stack (Test 1)

Question : Which traversal of a binary tree can be implemented using a stack?

Solution :
864020260611035911 Correct Answer : DFS

Description -

Data Structures and Algorithms : Stack (Test 1)

Question : Maximum number of elements in an array stack of size n is:

Solution :
546320260611035821 Correct Answer : n

Description -

Data Structures and Algorithms : Stack (Test 1)

Question : Consider stack operations:

Push(5)
Push(10)
Push(15)
Pop()
Push(20)
Pop()
Current top?

Solution :
758920260611035716 Correct Answer : 10

Description -

Data Structures and Algorithms : Stack (Test 1)

Question : What is the postfix form of:
(A+B)*(C-D)

Solution :
862820260611035340 Correct Answer : AB+CD-*

Description -

Data Structures and Algorithms : Stack (Test 1)