Services
Discover
Homeschooling
Ask a Question
Log in
Sign up
Filters
Done
Question type:
Essay
Multiple Choice
Short Answer
True False
Matching
Topic
Computing
Study Set
Big Java Late Objects
Quiz 5: Methods
Path 4
Access For Free
Share
All types
Filters
Study Flashcards
Practice Exam
Learn
Question 81
Multiple Choice
What is the output of the following code snippet? Public static int someMethod(int x) { Int result = 0; If (x > 10) { Result = x; } Else { Result = someMethod(4 * x) ; } Return result; } Public static void main(String[] args) { System.out.println("someMethod(2) = " + someMethod(2) ) ; }
Question 82
Multiple Choice
Which of the following code snippets returns the factorial of a given number? (Hint: Factorial of 5 = 5! = 1 * 2 * 3 * 4 * 5 = 120)
Question 83
Multiple Choice
What is the output of the following code snippet? Public static int blackBox(int a) { Int val; If (a <= 0) { Val = 1; } Else { Val = a + blackBox(a - 2) ; } Return val; } Public static void main(String[] args) { System.out.println(blackBox(4) ) ; }
Question 84
Multiple Choice
Given the method below, what is the output of the method call is div(10) ? Public static void div(int n) { If (n > 2) { Div(n % 3) ; } System.out.print(n / 3 + " ") ; }
Question 85
Multiple Choice
What is the output of the following code snippet? Public static int fun(int x) { Int returnValue = 0; If (x > 5) { ReturnValue = x; } Else { ReturnValue = fun(2 * x) ; } Return returnValue; } Public static void main(String[] args) { System.out.println("fun(2) = " + fun(2) ) ; }
Question 86
Multiple Choice
What is the output of the following code snippet? Public static int assignPriority(int priority) { Return priority + 2; } Public static void main(String[] args) { Int priority = assignPriority(3) ; System.out.println("Priority: " + priority) ; }