subject
Advanced Placement (AP), 09.04.2021 20:40 nick607

Consider the following recursive method, which is intended to display the binary equivalent of a decimal number. For example, toBinary(100) should display 1100100. public static void toBinary(int num)
{
if (num < 2)
{
System. out. print(num);
}
else
{
/* missing code */
}
}
Which of the following can replace /* missing code */ so that toBinary works as intended?

System. out. print(num % 2);
toBinary(num / 2);
A

System. out. print(num / 2);
toBinary(num % 2);
B

toBinary(num % 2);
System. out. print(num / 2);
C

toBinary(num / 2);
System. out. print(num % 2);
D

toBinary(num / 2);
System. out. print(num / 2);
E

ansver
Answers: 1

Other questions on the subject: Advanced Placement (AP)

image
Advanced Placement (AP), 24.06.2019 22:30, UltimateGoal
"all the world's a stage" is a saying that draws a parallel between two totally different concepts: reality and drama. this type of comparison, made popular by a group of seventeenth century poets, is called: metamorphosis. metacognition. metaphysical conceit. metaphor. metaphysical poets.
Answers: 1
image
Advanced Placement (AP), 25.06.2019 03:30, RosaJackson8088
Only people in ap world history can can someone give me a question and a statement to present to the class about chapter 15,16,or17
Answers: 1
image
Advanced Placement (AP), 27.06.2019 08:00, rahmao2773
Territorial insects like spiders that fight off intruders would be expected to be
Answers: 1
image
Advanced Placement (AP), 27.06.2019 11:30, medinajocelyn45
Where in the united states does roman catholicism dominate? a. southern new england b. southwest c. pacific northwest d. southeast e. a & b only
Answers: 1
You know the right answer?
Consider the following recursive method, which is intended to display the binary equivalent of a dec...

Questions in other subjects:

Konu
English, 16.06.2020 09:57
Konu
Mathematics, 16.06.2020 09:57