Advanced Placement (AP)
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

answer
Answers: 1

Other questions on the subject: Advanced Placement (AP)

image
Advanced Placement (AP), 25.06.2019 06:30, QueenNerdy889
You are only allowed to use tutors that your school recommends. t / f
Answers: 2
image
Advanced Placement (AP), 25.06.2019 18:00, edgartorres5123
Which best explains why the number of states in the world increased significantly between 1985 and 1995? the map of southeast asia was redrawn, and new countries were formed. new states were formed when the soviet union collapsed. many african states received independence from their colonizers. communist countries seeking to spread their influence created new satellite states. civil wars in central america fueled the creation of new states.
Answers: 1
image
Advanced Placement (AP), 26.06.2019 00:40, HOTaco2181
Lori attended a lecture about the sun, and the presenter had placed this image on the wall. which layer of the sun could this image be referring to?
Answers: 1
image
Advanced Placement (AP), 26.06.2019 16:30, Theresab2021
What is a biogrochemical flow chart
Answers: 1
Do you know the correct answer?
Consider the following recursive method, which is intended to display the binary equivalent of a dec...

Questions in other subjects:

Konu
Mathematics, 12.02.2020 18:57