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
Kruka [31]
3 years ago
14

Consider the code block below. What is the value of amount when this method is called twice, the first time using cookieJar(7) a

nd then using cookieJar(22)?
public static int cookieJar(int addCookies) {

int amount = 0;
amount += addCookies;
return amount;

}
A. 7
B. 15
C. 22
D. 29
E. An error occurs

Computers and Technology
1 answer:
RUDIKE [14]3 years ago
3 0

Answer:

C. 22

Explanation:

Given that the argument is being passed by value, there is no memory to consider.  So cookieJar(7) returns 7 and cookieJar(22) returns 22.

If the argument parameter was passed by reference or pointer, then perhaps the value from cookieJar(7) would be considered with cookieJar(22).

Note, this code block really isn't doing anything other than returning the value passed into it.  The "amount" variable is immediately set to 0, and then the value passed in is added to amount (which is 0), and returns.  The following code could replace this function:

public static int cookieJar(int addCookies){

return addCookies;

}

The above code will return an equivalent output to the given code.

Notice, the function is not dependent on any previous call, so the value for each is unique to the call itself, i.e., cookieJar(22) returns 22 and cookieJar(7) returns 7.

So, C. 22 would be correct.

You might be interested in
Which software development team memeber is responsible for the timeline and budget
Sliva [168]

Answer:

The Project Manager

Explanation:

This person's job is to manage the project budget and map out how much time would be spent on each phase. Also his/her job is to ensure that all deliverables and on time.

7 0
3 years ago
A network with 10 bits remaining for the host portion will have how many usable host addresses?
makvit [3.9K]

Answer:

2^10 = 1024 addresses

Explanation:

Each bit can be either 1 or 0, and this holds true for all 10 bits. So for every bit, we choose either a 0 or a 1 (2 choices), and then do so for the remaining bits. So we have 2 * 2 * 2 * ... * 2 (10 2's) choices for all 10 bits

8 0
3 years ago
Choose all of the items that represent functions of the operating system kernel.
babunello [35]

Answer: its all of them

Explanation: I took Assignment over this

6 0
3 years ago
Read 2 more answers
What is spam? electronic junk mail e-mail abuse e-mail subscriptions the e-mail server the opt out feature unethical use of e-ma
expeople1 [14]

Answer:

electronic junk mail.

Explanation:

7 0
3 years ago
Which of the following is not a responsibility of an operating system?
FromTheMoon [43]
The answer would be “automatically upgrade the computer’s RAM”. RAM is a computer part that would need to be bought and placed in the computer by the user.
5 0
3 years ago
Read 2 more answers
Other questions:
  • Are there any tips or helpful advice for people who want to learn Photoshop?
    10·1 answer
  • Write an overloaded constructor for the Table class that will take a single argument for the color of the table Write a set meth
    13·1 answer
  • Assume that aList is a valid ArrayList containing the following:
    8·1 answer
  • After a suspected identity fraud case has been resolved, you should: AContinue to monitor your credit reports and accounts. BKee
    12·2 answers
  • The smallest network
    13·1 answer
  • A bicycle sharing company is developing a multi-tier architecture to track the location of its bicycles during peak operating ho
    11·1 answer
  • What are common names for some primary discrete components used on circuit boards?
    13·1 answer
  • What is the output of the below Java program?
    11·1 answer
  • The component of an information system consisting of raw facts is the definition for which of the following?
    14·2 answers
  • ____ is an example of a set of prewritten classes that allows you to access data stored in a database.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!