Data Structure Interview Practice Questions - Stack



Top Interview Questions On Stack - Data Structures


What is a stack?

Stack is another common linear data structure; a stack is very similar to a list

except that a stack is more restricted where elements that are inserted last are

removed first.


What are the restrictions in stack?

We have restricted the access of elements in a stack, where we use one end of the

list by using the pop and push operations.

 

What is LIFO?

[Last In First Out]To get to the bottom item, we must first remove all the items

above it. This behavior is sometimes described as "last-in, first-out" or LIFO

since the last item to enter the stack is the first item to leave the stack.

 

Define depth of a stack?

The depth of stack is the number of elements it contains. An empty stack has

depth zero.


What is the benefit of using stacks?

Stacks provide a very efficient storage structure for manipulating data that is

accessed according to the LIFO method. Stacks are often used as temporary

storage where the elements stored last needs to be removed first.

 

What are the basic operations in stack?

Push- Add and item

Pop-Remove an item

Stack Top – Top elements of the stack.


Practice Questions on Stack

User push 1 element in the stack having already five elements and having stack size as 5 then stack becomes ___________.

 a).Underflow

 b).Overflow

 c).Crash

 d).User Flow

 

In the stack, If user try to remove element from the empty stack then it called as _______

 a).Garbage Collection

 b). Underflow of Stack

 c). Empty collection

 d). Overflow of stock.

 

Process of removing element from the stack is called as _______.

 a).Pop

 b). Delete

 c). Push

 d). Remove

 

In the stack process of inserting an element in the stack is called as ___________.

 a).Pop

 b).Push

 c).Evaluation

 d).Create

 

Stack in data structure is _________.

 a) FIFO

 b) None of these

 c) LILO

 d) LIFO


Comments

Popular Posts