a isFull b Push c the constructors d top e pop and topSoluti

a) isFull

b) Push

c) the constructors

d) top

e) pop and top

Solution


StackOverFlow exception usually occurs while inserting data in to Stack.

(a)  
   Method: isFull
  
   1.   This method whether stack is full or not. Stack full condition is checked using top variable.
   2.   Once top variable reaches stack size, isFull method returns True, else returns False.
  
   This method doesn\'t involve any insertion operation. So this method doesn\'t throw StackOverFlow exception.
  

(b)
   Method: Push
  
   1.   This method inserts data into stack at the index pointed by top and top value is incremented.
   2.   While insertion if isFull condition of stack is not checked there is a chance of throwing StackOverFlow Exception.
  
   So this method might throw StackOverFlow exception.
  
  
(c)
   Constructors just initializes the values. So there is no chance of throwing StackOverFlow exception.
  

(d)
   top is not a method, it is just a variable to point the stack index. So there is no chance of throwing StackOverFlow exception.
  

(e)
   Method: pop
  
   1.   This method removes an element from Stack.
   2.    After removing an element variable top is decremented.
  
   This method doesn\'t involve any insertion operation. So this method doesn\'t throw StackOverFlow exception.
  

   Hence, correct option is (b)

a) isFull b) Push c) the constructors d) top e) pop and topSolution StackOverFlow exception usually occurs while inserting data in to Stack. (a) Method: isFull

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site