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
each term to the appropriate definition. DBMS data mining hash file index key field locking protocol relation roll back schema S
ikadub [295]

Answer:

1. DBMS

C. <em>A storage system that provides efficient access to randomly chosen items</em>

G. <em>Performs database operations requested by application software</em>

2. data mining

B. <em>The process of extracting hidden information</em>

3. hash file

A. <em>A. means of locating a particular record within a file</em>

4. index key field

F. <em>An item used to identify records uniquely</em>

5. locking protocol

E. <em>A system to guard against database errors due to performing transactions concurrently</em>

6. relation

D. <em>A structural unit (with rows and columns) in a popular database model</em>

7. roll back schema

I. <em>A "road map" of a particular database's design</em>

J. <em>To "unwind" a transaction</em>

8. SQL

H. <em>A popular language that implements relational database operations.</em>

5 0
3 years ago
"The principle of ______________ states that programs tend to access data and instructions nearby recently used data and instruc
maria [59]

Answer:

<em>Locality of reference.</em>

Explanation:

In computing, The principle of locality of reference is the probability of a processor to repeatedly access the same set of memory locations within a small time interval. This reference of locality can be spatially based (repetitive usage of data within the same location on the computer memory), or temporally based (repetitive usage of a particular data or resources within a shot time interval). The ability of some computing system to perform this action increases their predictability, and efficiency of memory hierarchy use, among other abilities.

4 0
3 years ago
What is the name of the technology that is typically implemented on switches to avoid Ethernet connectivity problems when the wr
Andrew [12]

Answer:  Medium Dependent Interface Crossover (MDIX)

Explanation:

The technology that is typically implemented on switches to avoid Ethernet connectivity problems is Medium Dependent Interface Crossover(MDIX) For switches with Auto (MDIX) the connection is configured automatically and a crossover or straight-through cable can be used to connect two switches. When this MDIX interface is connected it corrects the connectivity speed and the cabling for proper device functionality.

4 0
3 years ago
PLATO
storchak [24]

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

Explanation:

5 0
3 years ago
The IPv4 address scheme has enough IP addresses to give every blade of glass in the world its own unique IP. True False
Andrew [12]

Answer:

False

Explanation:

IPv4 address are composed of four octets (8 bit numbers), ranging from <em>0.0.0.0 to 255.255.255.255</em>

All those 32 bits, in decimal notation, can form a total of

2^{32} = 4,294,967,296 different addresses.

Being more than 4 billion addresses and ignoring that some addressesare reserved for special uses, even present human population almost doubles that number.

So it is safe to state that IPv4 addresses is <u>not </u>enough to give every blade of grass its own IP.

8 0
2 years ago
Other questions:
  • Steps needed to deposit cash on cash deposit machine
    6·1 answer
  • Select all that apply. Hyperlinks can appear as: words pictures symbols trademarks
    12·2 answers
  • What is the preferred procedure for putting customers on hold​
    13·2 answers
  • Write a program "addnumbers.c" where it takes as many arguments as the user includes as command line arguments and calculates th
    11·1 answer
  • Space cushion includes
    8·2 answers
  • 6. At age 17, what was Minhaj's definition of the American Dream?
    8·1 answer
  • BRAINLIEST You have a small company and want to keep your costs low, but it is important your employees share data. Which networ
    13·2 answers
  • Which elements of text can be changed using automatic formatting? Check all that apply.
    8·1 answer
  • write a function named get majority last name that accepts as its parameter a dictionary from strings to strings the keys of the
    11·1 answer
  • A file has TWo parts name them
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!