CSIT Quiz 8 Exam Questions with Correct Answers
CSIT Quiz 8 Exam Questions with Correct Answers What is recursion? - Answer-a well-known programming technique where a method calls itself How can repetition be implemented with recursion? - Answer-by calling, from within itself, the method containing an instruction wished to be repeated When writing methods where repetition is implemented through recursion, what control structure would most likely be used? - Answer-If Any method which implements repetition through recursion is most concerned with ____________. - Answer-a tested condition which signals the recursion to end What is the smallest problem solved by recursion most commonly known as? - Answerbase case What phrase describes the action of the method calls after the base case has been reached in the recursion process? - Answer-"the solution of the base case is passed up the line" The collective goal of recursion typically is to ___________. - Answer-solve an entire problem A penguin is 3 meters away from a kangaroo. The following method, foo, is written. When the world starts, " first method" is called, which is empty. How far does the penguin move when the world is run? - Answer-0 meters - the penguin does not move A penguin is 3 meters away from a kangaroo. The following methods are written. How far does the penguin travel? - Answer-2 meters A penguin is 3 meters away from a kangaroo. The following methods are written. How far away from each other are the penguin and the kangaroo after the following code is run? - Answer-1 meter A penguin is 3 meters away from a kangaroo. The following methods are written. How many times will the "foo" method be called when the following code is run? - Answer-2 times A penguin is 3 meters away from a kangaroo. The following methods are written. How many methods are called as a result of the event "when the world starts"? - Answer-7 methods A penguin is 3 meters away from a kangaroo. The following methods are written. How many times is the "turn to face" method called when the following program is run? - Answer-2 times In the following code, what control structure contains the recursive call? - Answer-If/Else A penguin is 4 meters away from a kangaroo. The following methods are written. How far does the penguin walk when the following code is run? - Answer-the code is an infinite loop A penguin is 2 meters away from a kangaroo. The following methods are written. How far does the penguin walk when the following code is run? - Answer-the code is an infinite loop A penguin and kangaroo are standing in the same
Información del documento
- Subido en
- 12 de abril de 2024
- Número de páginas
- 5
- Escrito en
- 2023/2024
- Tipo
- Examen
- Contiene
- Preguntas y respuestas