Deck 18: Recursion

ملء الشاشة (f)
exit full mode
سؤال
In recursive backtracking, if one set of recursive calls does not result in a solution to the problem, what happens?

A) The program returns to a previous decision point and makes a different decision.
B) The program backs up to the previous decision point and throws an exception.
C) The program continues, with unexpected results.
D) The program backs up to the original method call.
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
Which of the following is false?

A) Since BigInteger is not a primitive type, we can't use the arithmetic, relational and equality operators with BigIntegers.
B) BigInteger method compareTo compares the BigInteger number that calls the method to the method's BigInteger argument, and returns -1 if the BigInteger that calls the method is less than the argument, 0 if they're equal or 1 if the BigInteger that calls the method is greater than the argument.
C) The value 1 can be implicitly converted to a BigInteger.
D) BigInteger can represent integer values larger than what primitive type long can represent.
سؤال
The recursion step should:

A) check for the base case.
B) call a fresh copy of the recursive method to work on a smaller problem.
C) make two calls to the recursive method.
D) iterate until it reaches a termination condition.
سؤال
Each time a fractal's pattern is applied to it, the fractal is said to be at a new ________.

A) level.
B) depth.
C) order.
D) All of the above.
سؤال
After a fractal's pattern is applied several times, the shape of the fractal will generally become ________.

A) disjointed and less detailed.
B) stabilized and more detailed.
C) identical to the original fractal.
D) None of the above.
سؤال
A recursive method .

A) is a method that calls itself.
B) can be called directly.
C) can be called indirectly through another method.
D) All of the above.
سؤال
The operands of an operator are evaluated ________.

A) from right to left.
B) from left to right.
C) at the same time.
D) in an order that is specific to each operator.
سؤال
When a recursive method is called to solve a problem, the method actually is capable of solving only the simplest case(s), or .

A) base case(s).
B) base step(s).
C) recursive call(s).
D) recursion step(s).
سؤال
The current method executing is always the method whose activation record is ________.

A) at the bottom of the stack.
B) at the top of the stack.
C) never placed on the stack.
D) second from the top of the stack, just below the previous method call.
سؤال
Recursion is often less efficient than iteration because ________.

A) it can cause an explosion of method calls.
B) it is not as intuitive.
C) recursive methods are harder to debug.
D) recursive methods take longer to program.
سؤال
The number of calls to recursively calculate the Fibonacci value of 7 is:

A) 7
B) 13
C) 41
D) 39
سؤال
All of the following are true for both recursion and iteration except ________.

A) they have a base case.
B) they can cause infinite loops or infinite recursion.
C) they are based on a control statement.
D) both gradually approach termination.
سؤال
Fractals that yield an exact copy of the original when a portion of the original image is magnified are called fractals.

A) strictly self-similar.
B) Koch Curve.
C) similar.
D) mirror.
سؤال
Recursion often is preferable to iteration because ________.

A) it is faster.
B) it requires less memory.
C) it models the problem more logically.
D) All of the above.
سؤال
When the recursion step executes:

A) this is known as indirect recursion.
B) all of the computer's processes halt until the recursion step has completed executing.
C) the original call to the method is still active.
D) All of the above.
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/15
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 18: Recursion
1
In recursive backtracking, if one set of recursive calls does not result in a solution to the problem, what happens?

A) The program returns to a previous decision point and makes a different decision.
B) The program backs up to the previous decision point and throws an exception.
C) The program continues, with unexpected results.
D) The program backs up to the original method call.
A
2
Which of the following is false?

A) Since BigInteger is not a primitive type, we can't use the arithmetic, relational and equality operators with BigIntegers.
B) BigInteger method compareTo compares the BigInteger number that calls the method to the method's BigInteger argument, and returns -1 if the BigInteger that calls the method is less than the argument, 0 if they're equal or 1 if the BigInteger that calls the method is greater than the argument.
C) The value 1 can be implicitly converted to a BigInteger.
D) BigInteger can represent integer values larger than what primitive type long can represent.
C
3
The recursion step should:

A) check for the base case.
B) call a fresh copy of the recursive method to work on a smaller problem.
C) make two calls to the recursive method.
D) iterate until it reaches a termination condition.
B
4
Each time a fractal's pattern is applied to it, the fractal is said to be at a new ________.

A) level.
B) depth.
C) order.
D) All of the above.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 15 في هذه المجموعة.
فتح الحزمة
k this deck
5
After a fractal's pattern is applied several times, the shape of the fractal will generally become ________.

A) disjointed and less detailed.
B) stabilized and more detailed.
C) identical to the original fractal.
D) None of the above.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 15 في هذه المجموعة.
فتح الحزمة
k this deck
6
A recursive method .

A) is a method that calls itself.
B) can be called directly.
C) can be called indirectly through another method.
D) All of the above.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 15 في هذه المجموعة.
فتح الحزمة
k this deck
7
The operands of an operator are evaluated ________.

A) from right to left.
B) from left to right.
C) at the same time.
D) in an order that is specific to each operator.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 15 في هذه المجموعة.
فتح الحزمة
k this deck
8
When a recursive method is called to solve a problem, the method actually is capable of solving only the simplest case(s), or .

A) base case(s).
B) base step(s).
C) recursive call(s).
D) recursion step(s).
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 15 في هذه المجموعة.
فتح الحزمة
k this deck
9
The current method executing is always the method whose activation record is ________.

A) at the bottom of the stack.
B) at the top of the stack.
C) never placed on the stack.
D) second from the top of the stack, just below the previous method call.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 15 في هذه المجموعة.
فتح الحزمة
k this deck
10
Recursion is often less efficient than iteration because ________.

A) it can cause an explosion of method calls.
B) it is not as intuitive.
C) recursive methods are harder to debug.
D) recursive methods take longer to program.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 15 في هذه المجموعة.
فتح الحزمة
k this deck
11
The number of calls to recursively calculate the Fibonacci value of 7 is:

A) 7
B) 13
C) 41
D) 39
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 15 في هذه المجموعة.
فتح الحزمة
k this deck
12
All of the following are true for both recursion and iteration except ________.

A) they have a base case.
B) they can cause infinite loops or infinite recursion.
C) they are based on a control statement.
D) both gradually approach termination.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 15 في هذه المجموعة.
فتح الحزمة
k this deck
13
Fractals that yield an exact copy of the original when a portion of the original image is magnified are called fractals.

A) strictly self-similar.
B) Koch Curve.
C) similar.
D) mirror.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 15 في هذه المجموعة.
فتح الحزمة
k this deck
14
Recursion often is preferable to iteration because ________.

A) it is faster.
B) it requires less memory.
C) it models the problem more logically.
D) All of the above.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 15 في هذه المجموعة.
فتح الحزمة
k this deck
15
When the recursion step executes:

A) this is known as indirect recursion.
B) all of the computer's processes halt until the recursion step has completed executing.
C) the original call to the method is still active.
D) All of the above.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 15 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 15 في هذه المجموعة.