CSC102 FINAL EXAM REAL EXAM QUESTIONS AND CORRECT ANSWERS (VERIFIED ANSWERS) A GRADE
2 views 0 purchase
Course
CSC102
Institution
CSC102
CSC102 FINAL EXAM REAL EXAM QUESTIONS AND CORRECT ANSWERS (VERIFIED ANSWERS) A GRADE
How does computer memory react to infinite recursion? - Answer The function runs until it's out of memory and then terminates abnormally
What steps must you take to design a recursive function? - Answer 1. De...
CSC102 FINAL EXAM REAL EXAM
QUESTIONS AND CORRECT
ANSWERS (VERIFIED ANSWERS)
A GRADE
How does computer memory react to infinite recursion? - Answer ✔ The function runs
until it's out of memory and then terminates abnormally
What steps must you take to design a recursive function? - Answer ✔ 1. Determine
limiting conditions
2. Understand problem requirements
3. Identify base cases
4. Identify general cases
(DUII)
What does an iterative control structure do? - Answer ✔ Uses a loop to repeat a set of
statements
What are the two ways to solve a particular problem? - Answer ✔ Iteration and
recursion
What happens after completing a recursive call? - Answer ✔ Control goes back to the
calling environment and execution begins from the point immediately following the
recursive call
What is direct recursion? - Answer ✔ a function that calls itself
What is indirect recursion? - Answer ✔ a recursive function that calls another function
What is a tail recursive function? - Answer ✔ the last statement is the recursive call
What is infinite recursion? - Answer ✔ Where every recursive call results in another
recursive call
When a function is called, memory space is allocated for its ________ and ________. -
Answer ✔ formal parameters; automatic local variables
, When a function terminates, memory space is __________. - Answer ✔ deallocated
Every ________ call has its own set of parameters and ___________ local variables. -
Answer ✔ recursive; automatic
Overhead associated with the execution of a recursive function is in terms of
______________ and _______________. - Answer ✔ memory space; computer time
A recursive function executes more slowly than its iterative counterpart. - Answer ✔
True
Overhead of a recursion function is very noticeable. - Answer ✔ False; Computers are
fast, so it's not noticeable.
Iterative solutions are sometimes more obvious and easy to understand. - Answer ✔
True
You can use a recursive algorithm to find the largest element in an array. - Answer ✔
True
In the Tower of Hanoi recursive program, if needle 1 contains three disks, then the
number of moves required to move all three disks from needle 1 to needle 3 is 8. -
Answer ✔ False
Which of the following solutions is easier to construct for the Tower of Hanoi problem? -
Answer ✔ Recursive
Which of the following solution methods would be the best choice for a mission control
system? - Answer ✔ Iterative
Which of the following function headings can be used for a recursive definition of a
function to calculate the nth Fibonacci number? - Answer ✔ int rFibNum(int a, int b, int
n)
Which of the following rules should you follow to solve the Tower of Hanoi problem? -
Answer ✔ A smaller disk can be placed on top of a larger disk.
What is a list? - Answer ✔ A collection of values of the same type
What is an array? - Answer ✔ A convenient place to store a list
What are some basic list operations? - Answer ✔ 1. Search
2. Sort
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller Scholarsstudyguide. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $13.39. You're not tied to anything after your purchase.