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
Naily [24]
3 years ago
7

The following problem illustrates the way memory aliasing can cause unexpected program behavior. Consider the following function

to swap two values
void swap(int xp, int yp)
If this procedure is called with xp equal to yp (i.e. both xp and yp point to the same integer) what effect will it have compared to the situation where xp and yp point to different integers?
a. The value will ahways be the original value in the integer pointed to by xp.
b. It is not possible for xp and yp to have the same value
c. The value will always be zero.
d. The value will always be the original value in the integer pointed to by yp.
e. It will be the same - doesn't matter
Computers and Technology
1 answer:
laila [671]3 years ago
5 0

Answer:

A

Explanation:

The value will be the original stored in the int variables. This is because the method swap(int xp, int yp) accepts xp and yp parameters by value (They are passed by value and not by reference). Consider the implementation below:

public class Agbas {

   public static void main(String[] args) {

   int xp = 2;

   int yp = xp;

   swap(xp,yp); //will swap and print the same values

       System.out.println(xp+", "+yp); // prints the original in values 2,2

 int xp = 2;

   int yp = 5;

   swap(xp,yp); // will swap and print 5,2

       System.out.println(xp+", "+yp); // prints the original in values 2,5

   }

   public static void swap(int xp, int yp){

       int temp = xp;

       xp = yp;

       yp = temp;

       System.out.println(xp+", "+yp);

   }

}

You might be interested in
After adding an image to her flyer, Danica played around to see which layout would look the best. At one point, her text was on
Norma-Jean [14]

Answer:

Position Feature

Wrap text feature

Picture tools

Explanation:

3 0
3 years ago
Read 2 more answers
Que compone una maquina Rube Goldberg (operadores mecánicos- maquinas simples – mecanismos)
Veseljchak [2.6K]

Answer:

dominoes, fans, PVC pipe, magnets, duct tape, marbles, cups or bowls, miniature toy cars, paper towel tubes, string.

------------------------------------------------------------------------------------------------------------

dominó, abanicos, tubos de PVC, imanes, cinta adhesiva, canicas, tazas o cuencos, carros de juguete en miniatura, tubos de toallas de papel, cuerdas.

Explanation:

3 0
2 years ago
Who do we make games for?(single term)
Ket [755]

Answer:

Gamers

Explanation:

5 0
3 years ago
Read 2 more answers
When a project is saved, the new file name appears on the ____ tab?
BartSMP [9]
It appears on Document window tab
7 0
3 years ago
Where is the spelling checker found in Excel?
laiz [17]
Simply press F7 or go to the tab 'Review' and --> left click 'spelling'. Located in the top panel.

This will enable the spell checking phase. 
7 0
3 years ago
Read 2 more answers
Other questions:
  • Explain the relationship between society and the technologies of using Earth's resources?
    14·1 answer
  • How many packets does your computer send/receive in a single mouse click when you visit a website?
    6·1 answer
  • Which is most harmful computer virus define​
    15·1 answer
  • Which website allows you to host your podcast for at a cost that includes your domain name?
    9·2 answers
  • A communication medium which allows receivers to observe multiple cues, such as body language and tone of voice, and allows send
    15·1 answer
  • The benefits for a cad proram is: (points : 2) 1 accuracy 2 repeatability 3 simplicity 4 all of the above
    9·1 answer
  • Draw the hierarchy chart and then plan the logic for a program that calculates a person’s body mass index (BMI).
    11·1 answer
  • Where is permanent data in the computer stored whenever gym starts his laptop He sees some commands in numbers appearing on the
    12·1 answer
  • True or false? To help improve SEO, your URL should match the title of your blog post, word for word.
    12·1 answer
  • Who is the best valorant character
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!