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]
4 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]4 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
Most printers are plug and play compatible and must be manually configured when they are plugged into the system.
nikdorinn [45]

Answer:

False

Explanation:

Plug and play devices are computer peripheral devices that can be used immediately, with little or no necessary configuration when plugged or connected to the computer system.

Printers are mostly electronic devices used as an output of a hard copy of a computer system application document. They are not part of the computer system (peripheral devices). They come with installation disk which a computer must install, in order to be able to use the printer.

Yes they are peripheral devices, but they are not plug and play devices since its software must be installed on the computer, to use it

8 0
4 years ago
Read 2 more answers
What is the purpose of the SMTP command "HELO"
sergij07 [2.7K]
If a client initiates the SMTP communication using an EHLO (Extended Hello) command instead of the HELO command some additional SMTP commands are often available. They are often referred to as Extended SMTP (ESMTP) commands or SMTP service extensions. Every server can have its own set of extended SMTP commands.
4 0
4 years ago
% Do not modify CalculateSum function maxSum = CalculateSum(userNum1, userNum2, userNum3) maxSum = MaxValue(userNum1, userNum2)
sergeinik [125]

Answer:

The function in Python is as follows:

def MaxValue(userNum1, userNum2):

   if userNum2>userNum1:

       return userNum2

   else:

       return userNum1

Explanation:

This defines the function

def MaxValue(userNum1, userNum2):

This returns userNum2 if userNum2 is greater than userNum1

<em>    if userNum2>userNum1:</em>

<em>        return userNum2</em>

If otherwise, this returns userNum1

<em>    else:</em>

<em>        return userNum1</em>

<em />

6 0
3 years ago
Adding Objects in Outlook
skelet666 [1.2K]

Answer:

I know its kinda late, but the answer is (B. Insert) on edg 2021.

Explanation:

5 0
3 years ago
Give an example of an embedded systems application.
Gala2k [10]

Answer:

A clock in the mobile phone

Explanation:

a clock is a computer in a mobile phone which is a computer,hence it's a computer in a computer

7 0
3 years ago
Other questions:
  • Write a second convertToInches() with two double parameters, numFeet and numInches, that returns the total number of inches. Ex:
    10·1 answer
  • To keep your emails concise and to the point
    13·1 answer
  • When he takes a picture, Simon freezes an action without blurring it, to show movement. Which type of photographer is he?
    9·2 answers
  • Which bitwise operation has the same effect as multiplying a by 16?
    6·2 answers
  • Which of the following is a career that's indirectly linked to careers in web technologies?
    10·1 answer
  • What are some common uses of Excel?
    10·1 answer
  • Help plz!! I will mark brainliest
    15·2 answers
  • what is a program or collection of programs that enable a person to manipulate a visual images on a computer​
    14·1 answer
  • How can I use HTML to express a personal value
    13·1 answer
  • Imagine that you are creating a website for a client. How will you interact with the client, gather requirements, and update the
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!