subject

Consider the following recursive method, which is intended todisplay 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 thattoBinary 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, 21.06.2019 17:10
3. consider the following class definitions: class smart class supersmart: public smart { { public: public: void print() const; void print() const; void set(int, int); void set(int, int, int); int sum(); int manipulate(); smart(); supersmart(); smart(int, int); supersmart(int, int, int); private: private: int x; int z; int y; int secret(); }; }; . which private members, if any, of smart are public members of supersmart? a. which members, functions, and/or data of the class smart are directly accessible in class supersmart?
Answers: 2
question
Computers and Technology, 22.06.2019 07:30
In the film "epic 2015," epic is the name for:
Answers: 3
question
Computers and Technology, 22.06.2019 22:50
Assume the existence of a bankaccount class. define a derived class, savingsaccount that contains two instance variables: the first a double, named interestrate, and the second an integer named interesttype. the value of the interesttype variable can be 1 for simple interest and 2 for compound interest. there is also a constructor that accepts two parameters: a double that is used to initialize the interestrate variable, and a string that you may assume will contain either "simple", or "compound", and which should be used to initialize the interesttype variable appropriately. there should also be a pair of functions getinterestrate and getinteresttype that return the values of the corresponding data members (as double and int respectively).
Answers: 2
question
Computers and Technology, 22.06.2019 23:30
Which of the following is not a symptom of chronic fatigue syndrome
Answers: 2
You know the right answer?
Consider the following recursive method, which is intended todisplay the binary equivalent of a deci...
Questions
question
Chemistry, 16.09.2020 02:01
question
Social Studies, 16.09.2020 02:01
question
English, 16.09.2020 02:01
question
Mathematics, 16.09.2020 02:01
question
Mathematics, 16.09.2020 02:01
question
Social Studies, 16.09.2020 02:01
question
Mathematics, 16.09.2020 02:01
question
Mathematics, 16.09.2020 02:01
question
History, 16.09.2020 02:01
question
Mathematics, 16.09.2020 02:01
question
Mathematics, 16.09.2020 02:01
question
Mathematics, 16.09.2020 02:01
question
Mathematics, 16.09.2020 02:01
question
Mathematics, 16.09.2020 02:01
question
Mathematics, 16.09.2020 02:01
question
Mathematics, 16.09.2020 02:01
question
Mathematics, 16.09.2020 02:01
question
Social Studies, 16.09.2020 02:01
question
Mathematics, 16.09.2020 02:01
question
Mathematics, 16.09.2020 02:01
Questions on the website: 13722361