Which function call expression will evaluate to -1 being returned? shoots(2) shoots (1) shoots(0) shoots(-1) shoots(-2) None of the above

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter6: User-defined Functions
Section: Chapter Questions
Problem 31SA
icon
Related questions
Question
Which function call expression will evaluate to -1 being returned?
shoots(2)
shoots(1)
shoots (0)
shoots(-1)
shoots(-2)
O None of the above
Transcribed Image Text:Which function call expression will evaluate to -1 being returned? shoots(2) shoots(1) shoots (0) shoots(-1) shoots(-2) O None of the above
Consider the following function shoots :
def shoots(x: int) -> int:
if x <= 0:
return 0
4
elif x == 1:
return shoots(x + 2)
6
elif x == 2:
return shoots(x - 1)
80
elif x == 2:
9.
return -1
10
else:
11
return shoots(x - 2)
2 3
Transcribed Image Text:Consider the following function shoots : def shoots(x: int) -> int: if x <= 0: return 0 4 elif x == 1: return shoots(x + 2) 6 elif x == 2: return shoots(x - 1) 80 elif x == 2: 9. return -1 10 else: 11 return shoots(x - 2) 2 3
Expert Solution
steps

Step by step

Solved in 3 steps with 4 images

Blurred answer
Knowledge Booster
Data Binding
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning