Deck 14: Recursion

ملء الشاشة (f)
exit full mode
سؤال
The quicksort algorithm works on the basis of

A)two pivots and a sublist.
B)three sublists.
C)three pivots.
D)two sublists and a pivot.
E)None of the above
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
When a function A calls a function B, which in turn calls A, we have

A)indirect recursion.
B)perfect recursion.
C)function call cycling.
D)direct recursion.
E)None of the above
سؤال
The function <strong>The function  </strong> A)does not correctly handle its base case. B)works for all non- negative values of k, but not for negative numbers. C)returns the value 1 if it is passed a value of 0 for the parameter k. D)computes the factorial on an integer k passed to it as parameter. E)None of the above <div style=padding-top: 35px>

A)does not correctly handle its base case.
B)works for all non- negative values of k, but not for negative numbers.
C)returns the value 1 if it is passed a value of 0 for the parameter k.
D)computes the factorial on an integer k passed to it as parameter.
E)None of the above
سؤال
A recursive function should be designed to stop making recursive calls when it reaches its

A)return statement.
B)base case.
C)last parameter.
D)closing curly brace.
E)None of the above
سؤال
Indirect recursion means that a function calls itself several times.
سؤال
When a recursive function directly calls itself, this is known as direct recursion.
سؤال
Suppose that a recursive function with integer parameter n has a base case of 0, and for each non- base case, the function makes a recursive call with argument n+1. If the function is initially called with an actual argument of n = 3, the function call will

A)cause an infinite chain of recursive calls.
B)return after a chain of 3 recursive calls.
C)return after a chain of 2 recursive calls.
D)return after a chain of 4 recursive calls.
E)None of the above
سؤال
Recursive algorithms tend to be less efficient than iterative algorithms.
سؤال
The quicksort algorithm can be used to

A)quickly sort and search arrays.
B)sort lists stored in arrays.
C)perform binary search on arrays.
D)All of the above
E)None of the above
سؤال
Recursion can be used to

A)find the greatest common divisor of two integers (GCD).
B)compute factorials.
C)program things that cannot be programmed without recursion.
D)All of the above
E)Both A and B, but not C
سؤال
The speed and amount of memory available to modern computers diminishes the performance impact of the overhead of recursion so much that for many applications, this overhead is not noticeable.
سؤال
A recursive function that does not correctly handle its base case may

A)return FALSE and stop.
B)return 0 and stop.
C)cause an infinite chain of recursive calls.
D)reach the NULL terminator and stop.
E)None of the above
سؤال
The programmer must ensure that a recursive function does not become

A)a static function.
B)a dynamic function.
C)trapped in an infinite chain of recursive calls.
D)a prototyped function.
E)None of the above
سؤال
A recursive function cannot call a function other than itself.
سؤال
Any algorithm that can be coded with recursion can also be coded using a loop.
سؤال
A _ function is one that calls itself.

A)dynamic
B)static
C)data validation
D)recursive
E)None of the above
سؤال
The of recursion is the number of times a recursive function calls itself.

A)breadth
B)type
C)depth
D)level
E)None of the above
سؤال
The QuickSort algorithm was developed in 1960 by

A)Tony Gaddis.
B)C.A.R. Hoare.
C)Judy Walters.
D)Bjarne Stroustrup.
E)None of the above
سؤال
The algorithm uses recursion to sort an array.

A)binary sort
B)red/black sort
C)shell sort
D)quicksort
E)None of the above
سؤال
The base case of a recursive function
A)is 0.

A)is 1 / (depth * 3.1415).
B)is 1.
C)is depth / 2.
D)depends on the problem being solved.
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/20
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 14: Recursion
1
The quicksort algorithm works on the basis of

A)two pivots and a sublist.
B)three sublists.
C)three pivots.
D)two sublists and a pivot.
E)None of the above
D
2
When a function A calls a function B, which in turn calls A, we have

A)indirect recursion.
B)perfect recursion.
C)function call cycling.
D)direct recursion.
E)None of the above
A
3
The function <strong>The function  </strong> A)does not correctly handle its base case. B)works for all non- negative values of k, but not for negative numbers. C)returns the value 1 if it is passed a value of 0 for the parameter k. D)computes the factorial on an integer k passed to it as parameter. E)None of the above

A)does not correctly handle its base case.
B)works for all non- negative values of k, but not for negative numbers.
C)returns the value 1 if it is passed a value of 0 for the parameter k.
D)computes the factorial on an integer k passed to it as parameter.
E)None of the above
A
4
A recursive function should be designed to stop making recursive calls when it reaches its

A)return statement.
B)base case.
C)last parameter.
D)closing curly brace.
E)None of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 20 في هذه المجموعة.
فتح الحزمة
k this deck
5
Indirect recursion means that a function calls itself several times.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 20 في هذه المجموعة.
فتح الحزمة
k this deck
6
When a recursive function directly calls itself, this is known as direct recursion.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 20 في هذه المجموعة.
فتح الحزمة
k this deck
7
Suppose that a recursive function with integer parameter n has a base case of 0, and for each non- base case, the function makes a recursive call with argument n+1. If the function is initially called with an actual argument of n = 3, the function call will

A)cause an infinite chain of recursive calls.
B)return after a chain of 3 recursive calls.
C)return after a chain of 2 recursive calls.
D)return after a chain of 4 recursive calls.
E)None of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 20 في هذه المجموعة.
فتح الحزمة
k this deck
8
Recursive algorithms tend to be less efficient than iterative algorithms.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 20 في هذه المجموعة.
فتح الحزمة
k this deck
9
The quicksort algorithm can be used to

A)quickly sort and search arrays.
B)sort lists stored in arrays.
C)perform binary search on arrays.
D)All of the above
E)None of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 20 في هذه المجموعة.
فتح الحزمة
k this deck
10
Recursion can be used to

A)find the greatest common divisor of two integers (GCD).
B)compute factorials.
C)program things that cannot be programmed without recursion.
D)All of the above
E)Both A and B, but not C
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 20 في هذه المجموعة.
فتح الحزمة
k this deck
11
The speed and amount of memory available to modern computers diminishes the performance impact of the overhead of recursion so much that for many applications, this overhead is not noticeable.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 20 في هذه المجموعة.
فتح الحزمة
k this deck
12
A recursive function that does not correctly handle its base case may

A)return FALSE and stop.
B)return 0 and stop.
C)cause an infinite chain of recursive calls.
D)reach the NULL terminator and stop.
E)None of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 20 في هذه المجموعة.
فتح الحزمة
k this deck
13
The programmer must ensure that a recursive function does not become

A)a static function.
B)a dynamic function.
C)trapped in an infinite chain of recursive calls.
D)a prototyped function.
E)None of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 20 في هذه المجموعة.
فتح الحزمة
k this deck
14
A recursive function cannot call a function other than itself.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 20 في هذه المجموعة.
فتح الحزمة
k this deck
15
Any algorithm that can be coded with recursion can also be coded using a loop.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 20 في هذه المجموعة.
فتح الحزمة
k this deck
16
A _ function is one that calls itself.

A)dynamic
B)static
C)data validation
D)recursive
E)None of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 20 في هذه المجموعة.
فتح الحزمة
k this deck
17
The of recursion is the number of times a recursive function calls itself.

A)breadth
B)type
C)depth
D)level
E)None of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 20 في هذه المجموعة.
فتح الحزمة
k this deck
18
The QuickSort algorithm was developed in 1960 by

A)Tony Gaddis.
B)C.A.R. Hoare.
C)Judy Walters.
D)Bjarne Stroustrup.
E)None of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 20 في هذه المجموعة.
فتح الحزمة
k this deck
19
The algorithm uses recursion to sort an array.

A)binary sort
B)red/black sort
C)shell sort
D)quicksort
E)None of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 20 في هذه المجموعة.
فتح الحزمة
k this deck
20
The base case of a recursive function
A)is 0.

A)is 1 / (depth * 3.1415).
B)is 1.
C)is depth / 2.
D)depends on the problem being solved.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 20 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 20 في هذه المجموعة.