1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
AleksAgata [21]
3 years ago
7

Analyze the following recursive method and indicate which of the following will be true.

Computers and Technology
1 answer:
notsponge [240]3 years ago
7 0

Answer:

a) The method runs infinitely and causes a StackOverflowError.

// Return the factorial for a specified index

public static long factorial(int n)

{

if (n == 0)

return 1;

else

return n * factorial(n - 1);

}

b) Invoking factorial(2) returns 2.

// Return the factorial (2)

public static long factorial(int 2)

{

if (n == 2)

return 2;

else

return 2 * factorial(3 - 1);

}

c) Invoking factorial(1) returns 1.

// Return the factorial(1)

public static long factorial(int 1)

{

if (n == 1)

return 1;

else

return 1 * factorial(1 - 1);

}

d) Invoking factorial(0) returns 0.

// Return the factorial(0)

public static long factorial(int 0)

{

if (n == 0)

return 0;

else

return 0 * factorial(0 - 1);

}

Explanation:

You might be interested in
What is the main difference between inserting header/footer in excel and word?​
Zepler [3.9K]

Answer:

Header is at the top of the page and used for epicas and titles, while footers at the bottom are used for footnotes or page number

7 0
3 years ago
Sherri has recently been injured. She is having a problem using her left hand and would like to use a stylus to move her mouse a
Alona [7]

Answer:

d) Digitizer

Explanation:

In computing a digitizer refers to a piece of hardware that converts analogue input to digits. Analog signals refers to signals that are in a continuous range such as light, sound and records. A digitizer therefore basically gets signals from (touch, sound, light etc.) and transforms and transports it to the CPU. On a tablet or laptop, the signals will received from the finger of a stylus (digital pen).

6 0
3 years ago
True or False? To use a C++ library function, you must use an #include directive to include the appropriate header file.
lakkis [162]

Answer:

True

Explanation:

While programming in most programming languages, one will have need to use functions and variables defined in other class libraries. in C++, these functions and variables' definitions are contained in Header files, which can be imported and used into any C++ program by using the pre-processor #include statement. This statement is the equivalent of import in java and copy in other languages. Popular header files are the Maths class (Allows use of maths functions like power, square roots exponentiation etc), the input/output (allows usage of cout print statement and cin input statement)

7 0
3 years ago
Consider a file system that uses inodes to represent files. Disk blocks are 8KB in size, and a pointer to a disk block requires
insens350 [35]

Answer:

64 terabytes

Explanation:

Given data:

Size of the disk block = 8 KB

Size required by the pointer to a disk block = 4 bytes

Now,

Size required by 12 direct disk blocks = 12 × 8

Size required by single disk block = 2048 × 8 KB

Size required by double disk block = 2048 × 2048 × 8 KB

size  required by triple disk block = 2048 × 2048 × 2048 × 8 KB

Now,

the maximum size of the file that can be stored in the this file system = 12 × 8  + 2048 × 8 KB  +  2048 × 2048 × 8 KB + 2048 × 2048 × 2048 × 8 KB  = 64 terabytes

5 0
4 years ago
Is there SUM in Small basic? ​
babunello [35]

Answer:

no

Explanation:

3 0
3 years ago
Other questions:
  • Which of the following JavaScript methods is used to define an object collection based on a CSS (Cascading Style Sheets) selecto
    15·1 answer
  • The OneDrive for Business application opens every time you start your program. You want to stop the program from automatically s
    15·1 answer
  • Which level of education do most peoplebecoming a broadcast analyst obtain?
    13·2 answers
  • What are some areas to fill out in the New Formatting Rule dialog box? Check all that apply.
    13·2 answers
  • What will be the result of running the following code fragment? int year = 0; double rate = 5; double principal = 10000; double
    14·1 answer
  • 2. When a process is "listed" in a queue, what information is actually stored in the list in memory?
    14·1 answer
  • What number system is the basis for all of the powerful computers and electronic devices in the world?
    7·1 answer
  • How does 5G technology enhance the Internet of Things (IoT)?
    9·1 answer
  • Objective a right turn true or false?
    7·1 answer
  • Joining a computer to active directory involves joining the computer to a workgroup. True or false.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!