Deck 11: Recursion

ملء الشاشة (f)
exit full mode
سؤال
To keep track of recursion most computer systems us a structure called a queue.
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
All recursive methods must have a/an:
(a)starting case
(b)intermediate case
(c)stopping case
(d)none of the above
سؤال
When defining recursive void methods you should:
(a)Ensure there is no infinite recursion.
(b)Ensure that each stopping case performs the correct action for that case.
(c)Ensure that if all recursive calls perform their actions correctly,then the entire case performs correctly.
(d)All of the above
سؤال
The order of magnitude of the binary search algorithm is:
(a)linear
(b)exponential
(c)logarithmic
(d)quadratic
سؤال
A recursive method is one that:
(a)Returns a value
(b)Initializes a set of variables
(c)Returns no value
(d)Invokes itself
سؤال
During recursion,if the stack attempts to grow beyond its limit,a _____________ occurs.
(a)Stack underflow
(b)Stack overflow
(c)Recursive underflow
(d)Recursive overflow
سؤال
Recursion is:
(a)the ability of a program to call itself
(b)the ability of a method to call itself
(c)the ability of a method to call smaller methods
(d)the ability of a method to implement factorials
سؤال
When a recursive call is encountered,computation is temporarily suspended; all of the information needed to continue the computation is saved and the recursive call is evaluated.
سؤال
Pick the best answer
(a)Recursive methods may include a recursive call
(b)Recursive methods may not use iteration
(c)Recursive methods must include a recursive call
(d)none of the above
سؤال
A recursive solution can be preferable to an iterative solution because:
(a)recursive method calls are faster than iterative looping
(b)recursive solutions may be easier to understand than iterative ones
(c)recursion uses less memory than iteration
(d)iteration should be avoided.
سؤال
The underlying data structure used by the computer during recursion is a:
(a)queue
(b)linked list
(c)tree
(d)stack
سؤال
The stack is a ________________ data structure.
(a)first in - first out
(b)last in - last out
(c)last in - first out
(d)none of the above
سؤال
A method definition that includes a call to itself is said to be recursive.
سؤال
The portion of memory in which a recursive computation is stored is called a/an:
(a)stack frame
(b)activation record
(c)all of the above
(d)none of the above
سؤال
Infinite recursion:
(a)will happen when there is no base case
(b)will not happen when there is a base case
(c)will not happen if we use subproblems
(d)none of the above
سؤال
A base case must include a recursive call.
سؤال
What is the value returned when the integer 5 is the argument to the factorial method?
(a)15
(b)50
(c)100
(d)120
سؤال
All recursive methods have a/an ____________ equivalent method.
(a)Iterative
(b)Selective
(c)Inherited
(d)None of the above
سؤال
Regarding recursion,if a base case is never reached the result is:
(a)infinite recursion
(b)iteration
(c)termination
(d)all of the above
سؤال
When defining recursive valued methods you should:
(a)Ensure there is no infinite recursion.
(b)Ensure each stopping case returns the correct value for that case.
(c)Ensure that the final value returned by the method is the correct value.
(d)All of the above
سؤال
The binary search algorithm has worst-case running time that is logarithmic.
سؤال
Write an iterative method to compute the factorial of a number.
سؤال
A stack is a last-in/first-out memory structure.
سؤال
Explain how a sequential search works.
سؤال
Activation records are used to implement recursion.
سؤال
Write a recursive method to compute the factorial of a number.
سؤال
What is an activation record?
سؤال
Write an iterative method to compute the power of xn for non-negative n.
سؤال
Write a recursive method to compute the power of xn for non-negative n.
سؤال
How does the computer system handle a recursive method call?
سؤال
Explain how the binary search works.
سؤال
What is a base case?
سؤال
Write an iterative method to print a string backwards.
سؤال
Binary search is a divide and conquer algorithm.
سؤال
Write a recursive method to print a string backwards.
سؤال
Explain the concept of divide and conquer.
سؤال
What are the criteria you must consider when formulating a recursive solution?
سؤال
A recursively written method will usually run slower and use more storage than an equivalent iterative version.
سؤال
A recursive method must never return a value.
سؤال
The binary search algorithm is extremely slow compared to an algorithm that simply tries all array elements in order.
سؤال
What are two factors that contribute to the inefficiency of some recursive solutions?
سؤال
What are the two base cases for a recursive binary search algorithm?
سؤال
What is a stack overflow?
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/43
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 11: Recursion
1
To keep track of recursion most computer systems us a structure called a queue.
False
2
All recursive methods must have a/an:
(a)starting case
(b)intermediate case
(c)stopping case
(d)none of the above
C
3
When defining recursive void methods you should:
(a)Ensure there is no infinite recursion.
(b)Ensure that each stopping case performs the correct action for that case.
(c)Ensure that if all recursive calls perform their actions correctly,then the entire case performs correctly.
(d)All of the above
D
4
The order of magnitude of the binary search algorithm is:
(a)linear
(b)exponential
(c)logarithmic
(d)quadratic
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
5
A recursive method is one that:
(a)Returns a value
(b)Initializes a set of variables
(c)Returns no value
(d)Invokes itself
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
6
During recursion,if the stack attempts to grow beyond its limit,a _____________ occurs.
(a)Stack underflow
(b)Stack overflow
(c)Recursive underflow
(d)Recursive overflow
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
7
Recursion is:
(a)the ability of a program to call itself
(b)the ability of a method to call itself
(c)the ability of a method to call smaller methods
(d)the ability of a method to implement factorials
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
8
When a recursive call is encountered,computation is temporarily suspended; all of the information needed to continue the computation is saved and the recursive call is evaluated.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
9
Pick the best answer
(a)Recursive methods may include a recursive call
(b)Recursive methods may not use iteration
(c)Recursive methods must include a recursive call
(d)none of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
10
A recursive solution can be preferable to an iterative solution because:
(a)recursive method calls are faster than iterative looping
(b)recursive solutions may be easier to understand than iterative ones
(c)recursion uses less memory than iteration
(d)iteration should be avoided.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
11
The underlying data structure used by the computer during recursion is a:
(a)queue
(b)linked list
(c)tree
(d)stack
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
12
The stack is a ________________ data structure.
(a)first in - first out
(b)last in - last out
(c)last in - first out
(d)none of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
13
A method definition that includes a call to itself is said to be recursive.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
14
The portion of memory in which a recursive computation is stored is called a/an:
(a)stack frame
(b)activation record
(c)all of the above
(d)none of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
15
Infinite recursion:
(a)will happen when there is no base case
(b)will not happen when there is a base case
(c)will not happen if we use subproblems
(d)none of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
16
A base case must include a recursive call.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
17
What is the value returned when the integer 5 is the argument to the factorial method?
(a)15
(b)50
(c)100
(d)120
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
18
All recursive methods have a/an ____________ equivalent method.
(a)Iterative
(b)Selective
(c)Inherited
(d)None of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
19
Regarding recursion,if a base case is never reached the result is:
(a)infinite recursion
(b)iteration
(c)termination
(d)all of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
20
When defining recursive valued methods you should:
(a)Ensure there is no infinite recursion.
(b)Ensure each stopping case returns the correct value for that case.
(c)Ensure that the final value returned by the method is the correct value.
(d)All of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
21
The binary search algorithm has worst-case running time that is logarithmic.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
22
Write an iterative method to compute the factorial of a number.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
23
A stack is a last-in/first-out memory structure.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
24
Explain how a sequential search works.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
25
Activation records are used to implement recursion.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
26
Write a recursive method to compute the factorial of a number.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
27
What is an activation record?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
28
Write an iterative method to compute the power of xn for non-negative n.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
29
Write a recursive method to compute the power of xn for non-negative n.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
30
How does the computer system handle a recursive method call?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
31
Explain how the binary search works.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
32
What is a base case?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
33
Write an iterative method to print a string backwards.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
34
Binary search is a divide and conquer algorithm.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
35
Write a recursive method to print a string backwards.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
36
Explain the concept of divide and conquer.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
37
What are the criteria you must consider when formulating a recursive solution?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
38
A recursively written method will usually run slower and use more storage than an equivalent iterative version.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
39
A recursive method must never return a value.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
40
The binary search algorithm is extremely slow compared to an algorithm that simply tries all array elements in order.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
41
What are two factors that contribute to the inefficiency of some recursive solutions?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
42
What are the two base cases for a recursive binary search algorithm?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
43
What is a stack overflow?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.