Recursion in Java

Recursion in Java

9th - 12th Grade

10 Qs

quiz-placeholder

Similar activities

Bài 5: Thiết lập trang giấy và xuất bài nhạc

Bài 5: Thiết lập trang giấy và xuất bài nhạc

7th - 11th Grade

11 Qs

แบบฝึกหัดทบทวนบทเรียน โครงสร้างภาษาซี

แบบฝึกหัดทบทวนบทเรียน โครงสร้างภาษาซี

12th Grade

12 Qs

K10-BAI4-9

K10-BAI4-9

10th - 12th Grade

10 Qs

BAI 9 LOP 5

BAI 9 LOP 5

12th Grade

8 Qs

Pengenalan Aplikasi Blender

Pengenalan Aplikasi Blender

11th Grade

13 Qs

1.2.4. Types of Programming Language

1.2.4. Types of Programming Language

12th Grade

12 Qs

Test on Python Function

Test on Python Function

11th - 12th Grade

12 Qs

LENGUAJE C

LENGUAJE C

11th Grade

13 Qs

Recursion in Java

Recursion in Java

Assessment

Quiz

Computers

9th - 12th Grade

Hard

Created by

Thomas Martinez

FREE Resource

AI

Enhance your content in a minute

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

When the base case is met, which of these could be returned?

[Enclosing method: recursiveFunc(int n)]

return recursiveFunc(n + 1);

return (double) 1000;

return n * recursiveFunc(n);

return recursiveFunc(n) - 1;

2.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

The capabilities of a recursive function can typically be recreated by . . .

If / Else statements

Classes

Loops

Interfaces

3.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

For which of these operations is a recursive function practical?

Scanning user input

Finding the sum of two integers

Returning the first item of a list

Calculating the factorial of an integer

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is a recursive function?

Function that returns once

Function that creates objects

Function that calls itself

Function needing abstraction to be used

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of these is NOT an acceptable header for a recursive function?

public void recursiveFunc(Object obj) {

public int recursiveFunc(int n) {

public double recursiveFunc(double n) {

public String recursiveFunc(String str) {

6.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

Media Image

Assuming n is initialized as an integer variable with a positive value, what will be printed?

The factorial of n

The absolute value of n

The sum of all digits in n

The square root of n

7.

MULTIPLE SELECT QUESTION

2 mins • 1 pt

Media Image

The Collatz Conjecture states that, in sequence, taking any integer and, if even, halving the result/integer and, if odd, tripling and adding 1 to the result/integer continuously will eventually end up as 1.


Which of the above methods properly recreates the conjecture?

Select all answers that apply.


(Click the picture to enlarge.)

recursiveCollatz1(int n)

recursiveCollatz2(int n)

recursiveCollatz(int n)

None

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?