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
PLATO
storchak [24]

Answer: here is the answer ☀️keep on shining☀️

Explanation:

5 0
3 years ago
Corona and app inventor can be used to develop ________.
Sidana [21]
<span>Corona and app inventor can be used to develop apps for smartphones. Corona can be used to build both games and apps from major platforms like iOS, Android, Kindle, Apple TV, Android TV, macOS, and Windows. App Inventor was originally provided by Google and is now maintained by MIT.</span>
3 0
3 years ago
Google is an example of a(n):
Andre45 [30]
Well i see your X so i would say you were correct it is a search engine.
7 0
3 years ago
Which excel feature prevents you from having to type the same thing over and over?
tamaranim1 [39]

Answer:

Explanation: Another way by which you can do it, press the Ctrl+1 key on your keyboard, Format cells dialog box will get appear. Go to Alignment tab, Click on Justify in Vertical drop down list, click on ok. This is the way by which you can prevent the text from spilling over in Microsoft Excel 2010 and 2013.

6 0
3 years ago
What is the number system that uses only the numbers 0 and 1?
Bingel [31]
It is c because its C
4 0
3 years ago
Other questions:
  • Tricia listed her assets and liabilities. Credit Card Bill Car Loan Bonds Piano Bank Account Bicycle Which are Tricia’s liabilit
    8·2 answers
  • ____ are diagrams used in mathematics and logic to help describe the truth of an entire expression based on the truth of its par
    8·1 answer
  • ¿Cómo es la onda percibida por un osciloscopio cuando hablamos de sonido? ¿Qué parámetros podemos observar en ella?
    15·1 answer
  • Generally speaking, manufacturing overhead is applied to production by means of a __________ __________ __________, which is com
    11·2 answers
  • Noticing his reduced performance at work, Dan enrolled himself for training sessions offered by the company and saw his producti
    13·1 answer
  • One foot equals 12 inches. Write a function named feet_to_inches that accepts a number of feet as an argument and returns the nu
    15·1 answer
  • before Katie turns in the paper she typed she wants a peer to review it and give her feedback Katie uses her all in one printer
    10·1 answer
  • Who here has an old (preferably 80s) Toyota Celica i just bought mine and want to know how you guys like yours because mine is f
    14·1 answer
  • Determining Correct Date Function What function text would you use to put today's date and time in a cell? 0 =TODAYO =NOWO O NOW
    13·1 answer
  • What are the methods used in research methodology?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!