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
Does anybody play nitro type
vlabodo [156]

Answer: Nah

Explanation: it kinda sucks and is a waste of time, play better games lol

3 0
3 years ago
Read 2 more answers
Which computer can perform the single dedicated task? a. Which commuter can perform the function of both analog and digital devi
vredina [299]
<h3>a= hybrid computer can perform the function of both analog and digital computer</h3>
8 0
3 years ago
The communications standard used to transfer pages on the Web is called _____.
andrezito [222]
Hypertext Transfer Protocol (HTTP)
5 0
3 years ago
The ______________________ denotes the application software and technology that concerns a wide range of topics from the data ma
zhuklara [117]

Answer:

System/application Domain.

Explanation:

System/application domain represents the technology and  software that is tasked to do diverse subjects from the data management to the systems that processes data or information.

Particular application domain has it's own specific virtual address in which the resources for the application domain are present that uses the address space.

8 0
3 years ago
8. If you, or someone you know is a victim of cyber-bullying what should you do? not say a word ,write mean things back ,report
bearhunter [10]

Answer:

report it

Explanation:

4 0
2 years ago
Read 2 more answers
Other questions:
  • Clip art, by default, is formatted as a(n) ____, which cannot be moved to a precise location on a page.
    14·1 answer
  • The lcm of two numbers can be equal to the smallest number in the set. true false
    15·2 answers
  • Your essay is due tomorrow and you don't have time to write it. You decide to buy an essay online. You've paid for it, so it can
    12·1 answer
  • Someone who participates online for social reasons usually has a:
    9·1 answer
  • What are the benefits of building blocks?
    8·2 answers
  • How do you change the order of the slides in your presentation in the slide pane 
    15·2 answers
  • A test's directions often clarify any questions a student might have about answering a response question.
    5·2 answers
  • . What is a computer network? *
    9·1 answer
  • There's a rising issue with bots sending links starting with 'bit'. These links are dangerous and harmful for any computer or de
    6·2 answers
  • if you want to clear a single file, what move instruction would you use? group of answer choices none of the choices file to wor
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!