We consider a discrete time queue with finite capacity and i.i.d. and Markov modulated arrivals. Efficient algorithms are developed to calculate the moments and the distributions of the first time to overflow and the regeneration length. Results are extended to the multiserver queue. Some illustrative numerical examples are provided. This revised version was published online in June 2006 with corrections to the Cover Date.