100% tevredenheidsgarantie Direct beschikbaar na je betaling Lees online óf als PDF Geen vaste maandelijkse kosten 4.2 TrustPilot
logo-home
Tentamen (uitwerkingen)

DSA Recursion Questions with Solved Answers

Beoordeling
-
Verkocht
-
Pagina's
2
Cijfer
A+
Geüpload op
29-08-2024
Geschreven in
2024/2025

Exam of 2 pages for the course DSA at DSA (DSA Recursion)

Instelling
DSA
Vak
DSA








Oeps! We kunnen je document nu niet laden. Probeer het nog eens of neem contact op met support.

Geschreven voor

Instelling
DSA
Vak
DSA

Documentinformatie

Geüpload op
29 augustus 2024
Aantal pagina's
2
Geschreven in
2024/2025
Type
Tentamen (uitwerkingen)
Bevat
Vragen en antwoorden

Onderwerpen

Voorbeeld van de inhoud

DSA Recursion

1. If the user enters 10 in the triangle.java program (Listing 6.1), what is the maximum
number of "copies" of the triangle() method (actually just copies of its argument) that
exist at any one time? - answer10

2. Where are the copies of the argument, mentioned in question 1, stored?
a. in a variable in the triangle() method
b. in a field of the TriangleApp class
c. in a variable of the getString() method
d. on a stack - answerD

3. Assume the user enters 10 as in question 1. What is the value of n when the
triangle() method first returns a value other than 1? - answer2

4. Assume the same situation as in question 1. What is the value of n when the
triangle() method is about to return to main()? - answer10

5. True or false: In the triangle() method, the return values are stored on the stack. -
answerFalse

6. In the anagram.java program (Listing 6.2), at a certain depth of recursion, a version of
the doAnagram() method is working with the string "led". When this method calls a new
version of itself, what letters will the new version be working with? - answer"ed"

7. We've seen that recursion can take the place of a loop, as in the loop-oriented
orderedArray.java program (Listing 2.4) and the recursive binarySearch.java program
(Listing 6.3). Which of the following is not true?
a. Both programs divide the range repeatedly in half.
b. If the key is not found, the loop version returns because the range bounds cross, but
the recursive version occurs because it reaches the bottom recursion level.
c. If the key is found, the loop version returns from the - answerB

8. In the recFind() method in the binarySearch.java program (Listing 6.3), what takes
the place of the loop in the non-recursive version?
a. the recFind() method
b. arguments to recFind()
c. recursive calls to recFind()
d. the call from main() to recFind() - answerC

9. The binarySearch.java program is an example of the _________ approach to solving
a problem. - answerdivide-and conquer

Maak kennis met de verkoper

Seller avatar
De reputatie van een verkoper is gebaseerd op het aantal documenten dat iemand tegen betaling verkocht heeft en de beoordelingen die voor die items ontvangen zijn. Er zijn drie niveau’s te onderscheiden: brons, zilver en goud. Hoe beter de reputatie, hoe meer de kwaliteit van zijn of haar werk te vertrouwen is.
Dreamer252 NBursing
Bekijk profiel
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
477
Lid sinds
2 jaar
Aantal volgers
293
Documenten
21305
Laatst verkocht
1 week geleden

4.0

115 beoordelingen

5
60
4
22
3
18
2
2
1
13

Recent door jou bekeken

Waarom studenten kiezen voor Stuvia

Gemaakt door medestudenten, geverifieerd door reviews

Kwaliteit die je kunt vertrouwen: geschreven door studenten die slaagden en beoordeeld door anderen die dit document gebruikten.

Niet tevreden? Kies een ander document

Geen zorgen! Je kunt voor hetzelfde geld direct een ander document kiezen dat beter past bij wat je zoekt.

Betaal zoals je wilt, start meteen met leren

Geen abonnement, geen verplichtingen. Betaal zoals je gewend bent via Bancontact, iDeal of creditcard en download je PDF-document meteen.

Student with book image

“Gekocht, gedownload en geslaagd. Zo eenvoudig kan het zijn.”

Alisha Student

Veelgestelde vragen