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
zepelin [54]
2 years ago
11

What is the output of the following program when the method is called with 4?

Computers and Technology
1 answer:
wolverine [178]2 years ago
8 0

Answer:

C. ?????

Explanation:

Given code:

void unknown(int n)

{

if(n>0)

unkown(n-1);

System.out.print("?");  

}

Calling code: unknown(4)

This is a recursive invocation of unknown function and causes ? to be printed 5 times once each for following values of n.

  • unknown invocation with n=4
  • unknown invocation with n=3
  • unknown invocation with n=2
  • unknown invocation with n=1
  • unknown invocation with n=0

When n becomes 0, termination condition is reached and the function returns.

So the output is ?????

You might be interested in
Write a program whose inputs are three integers, and whose outputs are the largest of the three values and the smallest of the t
arlik [135]

Answer:

import java.util.*;

public class Main

{

public static void main(String[] args) {

    Scanner input = new Scanner(System.in);

    System.out.print("Enter the first number: ");

    int n1 = input.nextInt();

    System.out.print("Enter the second number: ");

    int n2 = input.nextInt();

    System.out.print("Enter the third number: ");

    int n3 = input.nextInt();

 System.out.println("largest: " + LargestNumber(n1, n2, n3));

 System.out.println("smallest: " + SmallestNumber(n1, n2, n3));

}

public static int LargestNumber(int num1, int num2, int num3){

    int largestNum = 0;

    if(num1>=num2 && num1>=num3)

        largestNum = num1;

    else if(num2>=num1 && num2>=num3)

        largestNum = num2;

    else if(num3>=num1 && num3>=num2)

        largestNum = num3;

       

    return largestNum;

}

public static int SmallestNumber(int num1, int num2, int num3){

    int smallestNum = 0;

    if(num1<=num2 && num1<=num3)

        smallestNum = num1;

    else if(num2<=num1 && num2<=num3)

        smallestNum = num2;

    else if(num3<=num1 && num3<=num2)

        smallestNum = num3;

       

    return smallestNum;

}

}

Explanation:

Create function called LargestNumber that takes three parameters, num1, num2, num3. Find the largest number using if else structure among them and return it. For example, if num1 is both greater than or equal to num2 and num3, then it is the largest one.

Create function called SmallestNumber that takes three parameters, num1, num2, num3. Find the smallest number using if else structure among them and return it. For example, if num1 is both smaller than or equal to num2 and num3, then it is the smallest one.

Inside the main, ask the user for the inputs. Call the functions and print the largest and smallest.

8 0
3 years ago
Which of the following is part of the cycle of dating violence
katen-ka-za [31]

Dating violence is a pattern of behavior where one person threatens or actually use

Physical, sexual, emotional, or verbal abuse to control his or her dating partner.

Examples of physical abuse are

Hitting, shoving, kicking

Examples of sexual abuse are

touches you when you don't want them to, forces you to watch dirty things,  

intercourse, fondling, exhibitionism, voyeurism, exploitation, prostitution & exposure to body parts.

Examples of verbal and emotional abuse

Insults, belittling, name calling, blaming, humiliation & false accusations.

Abuse is a

The deliberate infliction of harm or the threat of harm to a vulnerable person

Abusers in teen dating relationships, use behaviors of

Fear and intimidation

The only person that can choose to stop the violence is the

Abused.

Signs of an abused teen

Do poorly in school, have low self-esteem, may cry frequently, & may have trouble learning.

Abused teens even contemplate or attempt

Suicide

1 in 11 teens report being victims

Physical dating violence each year.

6 0
3 years ago
What are the advantage of an e-library​
Semmy [17]

Answer:

Makes it easier to read... summarize cite electronic versions of editions

3 0
11 months ago
What Intel socket recommends the use of a liquid cooling system?
Komok [63]
The socket which Intel recommends that one should use with a liquid cooling system is LGA 2011. LGA 2011, also known as socket R is a CPU socket manufactured by Intel. It was released into the market in November 2011 and it replaced LGA 1366 and LGA 1567 in the performance and high end desk tops and server platforms. Socket R has 2011 pins that touch contact points on the underside of the processor.
7 0
3 years ago
If I had a picture of my friend on my camera that I wished to insert into a publication, which icon would I select from the Inse
Juli2301 [7.4K]
The paper clip i think if there is one than click it and it should tell you to pick the photo or download you might have to download it
4 0
3 years ago
Other questions:
  • Activity 1: Matched pairs or independent/separate samples? For each of the prompts below, decide whether the parameter of intere
    11·1 answer
  • The true or false questions.
    5·1 answer
  • Which type of drawer has three dispensing modes: single-dose, multi-dose, and matrix?
    13·1 answer
  • For each 8-bit data frame the layer uses a generator polynomial G(x) = x4+x2+ x+1 to add redundant bits. What is the sequence of
    11·1 answer
  • In what way do networks help to protect data
    6·1 answer
  • HELP PLZZ FAST!!!!!
    10·2 answers
  • A line beginning with a # will be transmitted to the programmer’s social media feed.
    11·2 answers
  • MULTIPLE COICE! BRAINLIEST
    12·1 answer
  • C++ Write a program that initially asks a user to enter two positive integer numbers a and b. If either a or are zero or negativ
    9·2 answers
  • Functions are used to _________
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!