Exam 13: Recursion
Exam 1: Introduction to Programming and the Java Language47 Questions
Exam 2: Programming Building Blocks- Java Basics57 Questions
Exam 3: Object-Oriented Programming, Part 1: Using Classes62 Questions
Exam 4: Introduction to Graphical Applications57 Questions
Exam 5: Flow of Control, Part 1: Selection68 Questions
Exam 6: Flow of Control, Part 2: Looping67 Questions
Exam 7: Object-Oriented Programming, Part 2: User-Defined Classes78 Questions
Exam 8: Single-Dimensional Arrays63 Questions
Exam 9: Multidimensional Arrays and the Arraylist Class62 Questions
Exam 10: Object-Oriented Programming, Part 3: Inheritance, Polymorphism, and Interfaces61 Questions
Exam 11: Exceptions, and Input Output Operations77 Questions
Exam 12: Graphical User Interfaces Using Java FX89 Questions
Exam 13: Recursion59 Questions
Exam 14: An Introduction to Data Structures69 Questions
Exam 15: Running Time Analysis56 Questions
Exam 16: RGB Colors, Decimal Conversion, Java Naming, and Random Number Generation110 Questions
Select questions type
Would you recommend using recursion or iteration in setting up a program for moving pallets of cargo off a ship? Justify your answer.
(Essay)
4.9/5
(32)
Why would you probably not want to write a program to find the even numbers from 1 to 20?
(Essay)
4.7/5
(38)
In the body of a __________ method, there is a call to the method itself.
(Multiple Choice)
4.9/5
(43)
The formula that reduces the size of the problem is called the general case.
(True/False)
4.7/5
(39)
A Euclidian algorithm finds the gcd of two positive integers a and b. If the two parameters of the method are dividend and divisor, identify when you will have reached the base case.
(Essay)
4.8/5
(34)
The idea of recursion is to __________ the size of the problem at each step so that we eventually reach an easy-to-solve problem.
(Short Answer)
4.7/5
(40)
You are using a binary search algorithm to search a sorted array for a given value. Organize the steps in defining bases cases and the general case by listing the order in which they should occur.
1) Assuming that the array is not empty, formulate the general case to search both higher and lower for the value, making a recursive call to our search method.
2) Define the base case such that if the value of the middle element is the value we seek, it will return its index.
3) Return -1 when the array is empty (i.e., a base case is reached).
4) Continue searching; the part of the array being searched will shrink until it is empty.
(Short Answer)
4.8/5
(40)
What will happen if you code for only one base case when there are two or more base cases?
(Multiple Choice)
4.9/5
(34)
In this chapter, source files are provided to complete programming activities. Theorize why these files are provided.
(Essay)
4.7/5
(46)
Provide the missing code in line 19 of this code segment.
15 if ( dividend % divisor == 0 ) // base case
16 {
17 System.out.println( "\nbase case reached, returning "
18 + divisor + "\n" );
19 // Insert missing code here
20 }
21 else // general case
(Short Answer)
4.8/5
(31)
The easy-to-solve problem resulting from recursion is called the __________ case.
(Short Answer)
4.8/5
(42)
Identify what must be changed to make this a true statement: To search a sorted array for a given value, you must define a base case to reduce the size of the problem and general cases to implement the base case.
(Essay)
5.0/5
(42)
Showing 41 - 59 of 59
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)