Solved

Consider the Method Below, Which Prints the Digits of an Arbitrary

Question 38

Multiple Choice

Consider the method below, which prints the digits of an arbitrary integer in reverse order, one digit per line. The method should print the last digit first. Then, it should recursively print the integer obtained by removing the last digit. Select the statements that should be used to complete the method. public static void printReverse(int value)
{
If (value > 0)
{
_____________________ // print last digit
_____________________ // recursive call to print value without last digit
}
}


A) System.out.println(value / 10) ;
PrintReverse(value / 10) ;
B) System.out.println(value % 10) ;
PrintReverse(value / 10) ;
C) System.out.println(value / 10) ;
PrintReverse(value % 10) ;
D) System.out.println(value % 10) ;
PrintReverse(value % 10) ;

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions

Unlock this Answer For Free Now!

View this answer and more for free by performing one of the following actions

qr-code

Scan the QR code to install the App and get 2 free unlocks

upload documents

Unlock quizzes for free by uploading documents