Data Structures and Algorithms - Stacks

8. If memory for the run-time stack is only 150 cells(words), how big can N be in Factorial(N) before encounterring stack overflow?

  • Option : C
  • Explanation : Given that, the size of a run-time stack is of 150 cells (words). The arguments to evaluate the factorial are placed on the stack. A function call is made to calculate the factorial. The subroutine is executed for each time the function call is made. Each funcall creates a stack frame of co words (Cells), 2 words for n, 2 words for program counter (PC), and 2 words for some other information. The value of n should be such that, the size of the stack should not exceed 150 cells. If we consider the value of n to be 26, it executes 25 procedure calls each of it with a 6-word stack frame. In this case, the total number of words of stack space would be 150 (6 words × 25 procedure calls = 150) cells. Therefore, the value of n will be 26 is n! before encountering a stack overflow for the stack of size 150 cells (words)
Cancel reply
Cancel reply

Syllabus covered in this section is-

  • Abstract data types
  • Algorithms
  • Stacks, Queues
  • Linked Lists
  • Trees, Binary search trees
  • Binary heaps

This Section covers Stacks Questions Answers using C language .
Who can benefit – 

  • Any student who is pursuing B.Sc. in Information Technology can also use this Stacks mcq section. 
  • Stacks MCQs can also be used by any student who is pursuing any undergraduate or postgraduate degree in Computer Science.
  • Any candidate who has to appear for DOEACC A, B or C level Exam can also use Stacks Questions Answers to gain credits in their exams.
  • Candidates appearing for Kendriya Vidyalya Sangathan Entrance Exam can also use Stacks Multiple Choice Questions Answers for the preparation of their exams.
  • Stacks Questions Answers can also be used by MCA students for the preparation of their exams.
  • You can also get Stacks mcq pdf if you purchase an e-book from site.
  • You can download Stacks MCQ pdf from this site.
  • You can get access to Stacks Multiple Choice Questions Answers  EBook.

Various Search Terms used for this section are

  • Stacks quiz questions with answers

  • Stacks exam questions answers

  • Stacks MCQ questions Answers

  • Stacks MCQ

  • Stacks in Data Structure MCQ Pdf Download

  • Stacks  MCQ Pdf

    Stacks in Data Structutre MCQ for UGC NET CS

    Stacks Multiple Choice Questions For Competitive Exams