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
tangare [24]
4 years ago
8

Below is a recursive implementation of the factorial function. For what value of n will this function not produce the desired re

sult? What will the function do in that case? public static int factorial(int n) { if (n == 0) return 1; else return n * factorial(n-1); }
Computers and Technology
1 answer:
kompoz [17]4 years ago
3 0

Answer:

Check the explanation

Explanation:

Here the data type we are making use of is int. Now when this function is being called for finding factorial of 13 or numbers that are greater than 13 then the function is expected to shows error and the desired result will not be produced.

Reason for this problem is-- range of int dat type is -2,147,483,648 to 2,147,483,647 . Now factorial of 12 is 47,90,01,600 which is less than 2,147,483,647 . But factorial of 13 is 6,22,70,20,800‬ which is greater than 2,147,483,647 which means int data type can not hold such large variable. That’s why it will not give desired result for value of n greater than 12.

Now you might just want to ask that what will function do in that case – the afct ins that different languages do different things in case of overflows. Some languages just say that data type can not handle . take for instance, when it comes to java warning about overflow is not there. And during overflow there it will show negative numbers.

You might be interested in
Type the correct answer in the box. Spell all words correctly.
Sonja [21]

An AI algorithm helps you trust the solutions that are being provided by Al systems.

<h3>What is AI?</h3>

AI is an acronym for Artificial Intelligence which is also known as Machine learning (ML) and it can be defined as a subfield in computer science that's focused on the use of advanced computer algorithms and technology to develop a smart computer-controlled robot with the abilities to proffer solutions to complex problems.

In Computer technology, an Artificial Intelligence (AI) algorithm helps you trust the solutions that are being provided by Al systems.

Read more on Artificial Intelligence here: brainly.com/question/25523571

#SPJ1

7 0
3 years ago
List at least four items that security policy should include
forsale [732]

Answer:

Purpose.

Audience.

Information security objectives.

Authority and access control policy.

Data classification.

Data support and operations.

Security awareness and behavior.

Encryption policy.

4 0
2 years ago
The domain is the part of an internet address that refers to a group of computers on a network. true or false.
DENIUS [597]
The answer to this is true
3 0
3 years ago
This variable controls the number of times that the loop iterates. A. Counter variable B. Loop control variable C. Running total
Norma-Jean [14]

Answer:

B) Loop control Variable

Explanation:

When programming, A loop control variable is used to control the number of iterations for a program loop. By convention programmers love to call this variable counter, i, j, n etc. The control variable when defined will determine the number of times a loop will execute. See the example bellow in C++ where we use a for loop to print the word "Hello" 5 times

<em>#include <iostream></em>

<em>using namespace std;</em>

<em>int main()</em>

<em>{</em>

<em>  for(int counter = 0; counter<5; counter++){</em>

<em>    cout<<"Hello"<<endl;</em>

<em>  }</em>

<em>    return 0;</em>

<em>}</em>

In this code snippet, the control variable is called counter and the condition is that counter will run from 0 to 4. So we get the world Hello printed five times

8 0
3 years ago
What is A/B Testing
Gnom [1K]
A/b testing is comparing two versions of a web page to see which one performs better
8 0
3 years ago
Read 2 more answers
Other questions:
  • When should you update your Transaction Register? Every time you make a transaction Daily Weekly Monthly
    6·1 answer
  • Which guideline should you use when downloading software from the internet?
    12·2 answers
  • What color is the highway sign that indicates restaurant?
    12·1 answer
  • What are three common operating systems
    7·2 answers
  • suspect that several users are attempting to install unauthorized software. Upon researching, you discover that the attempts wer
    12·1 answer
  • Trade Periodicals are usually highly scholarly resources<br> True<br><br> False
    5·1 answer
  • Someone please help ASAP will brainlist
    9·2 answers
  • Need help with Python coding from Zybooks...
    9·1 answer
  • Why doesn't the ad load ?
    9·2 answers
  • The most common technique for using an appropriate synchronization mechanism to serialize the accesses to prevent errors is to a
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!