subject

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?

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

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

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

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

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

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 01:30
What kind of motivation is katrina showing? use the drop-down menu to complete the statement. katrina is using motivation because she is personally interested in learning more.
Answers: 2
question
Computers and Technology, 24.06.2019 07:00
Why do we mark tlc plates with pencil and not with pen
Answers: 2
question
Computers and Technology, 24.06.2019 09:40
Healthy study habits are best described as
Answers: 1
question
Computers and Technology, 24.06.2019 15:50
Andy would like to create a bulleted list. how should he do this? andy should click on the bullet icon or select the bullet option from the menu and then type the list. andy should press the shift key and the 8 key at the beginning of each line of text. andy should type the text and then click on the bullet command. andy should press return and the bullets will automatically
Answers: 2
You know the right answer?
Consider the following recursive method, which is intended to display the binary equivalent of a dec...
Questions
question
Physics, 21.04.2020 04:52
Questions on the website: 13722362