MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

DATA STRUCTURES

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
In stack we can not insert an element in between the elements that are already inserted.
A
True
B
False
C
Either A or B
D
None of the above
Explanation: 

Detailed explanation-1: -Which of the following is not the correct statement for a stack data structure? Explanation: The answer is b because Stack does not follow FIFO. It follows LIFO.

Detailed explanation-2: -In a stack, push() is a function used to insert an element into the stack. In a stack, the new element is always inserted at top position. Push function takes one integer value as parameter and inserts that value into the stack.

Detailed explanation-3: -It means insertion and deletion in the stack data structure can be done only from the top of the stack. You can access only the top of the stack at any given point in time. Inserting a new element in the stack is termed a push operation. Removing or deleting elements from the stack is termed pop operation.

Detailed explanation-4: -It will cause a stack overflow, and how that is handled is also up to how you implemented your stack. Ideally, the stack implementation should know when it is at full capacity. When the stack is at capacity and a push is attempted, it will generally throw an exception and not attempt to add an element at all.

There is 1 question to complete.