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
What cell address indicates the intersection of the first row and the first column in a worksheet?
Roman55 [17]
The answer is A1. 

The columns are arranged alphabetically, and the rows are ordered numerically. The cell address states the column, a letter, followed by the row, a number. The first cell address, the top-left cell of the sheet, is A1
7 0
3 years ago
Read 2 more answers
From a neural network with 11 input variables, one hidden layer with three hidden units, and one output variable, how many param
e-lub [12.9K]

Answer:

40

Explanation:

Given that:

A neural network with 11 input variables possess;

one hidden layer with three hidden units; &

one output variable

For every input, a variable must go to every node.

Thus, we can calculate the weights of weight with respect to connections to input and hidden layer by using the formula:

= ( inputs + bias) × numbers of nodes

= (11 + 1 ) × 3

= 12 × 3

= 36 weights

Also, For one hidden layer (with 3 nodes) and one output

The entry result for every hidden node will go directly to the output

These results will have weights associated with them before computed in the output node.

Thus; using the formula

= (numbers of nodes + bais) output, we get;

= ( 3+ 1 ) × 1

= 4 weights

weights with respect to input and hidden layer total = 36

weights with respect to hidden and output layer total = 4

Finally, the sum of both weights is = 36 + 4

= 40

6 0
2 years ago
True or False. A geosynchronous satellite changes its area in the sky each day.
nataly862011 [7]

Answer: False

Explanation: they remain in the same area

7 0
2 years ago
Read 2 more answers
When a structure must be passed to a function, we can use pointers to constant data to get the performance of a call by ________
andriy [413]

Answer:

Reference value.

Explanation:

8 0
2 years ago
Translating an algorithm into the syntax of Java is the design phase of software development.
Digiron [165]

Answer:

I think it's false

Explanation:

I don't think so. What makes me hesitate is that you may have been told that in your text or in the classroom.

Here are the steps as I understand them.

  1. Understand the problem you are trying to solve.
  2. Design a solution.
  3. Draw a flow chart.
  4. Write pseudo-code.
  5. Write code.
  6. Test and debug.

I think you've done the designing long before you start writing code or even pseudo-code.

4 0
2 years ago
Other questions:
  • 3) Write a program named Full_XmasTree using a nested for loop that will generate the exact output. This program MUST use (ONLY)
    6·1 answer
  • The answer for this question?
    5·1 answer
  • Do you think social media should affect presidential elections
    6·2 answers
  • What are the names of the two main characters in pirates of silicon valley
    5·1 answer
  • Charles would like to move his internet browser window so that he can see his desktop.He should
    5·1 answer
  • U
    11·1 answer
  • Question 2 of 3
    7·2 answers
  • 2. Used to drive in or remove screws that fasten electrical wires or other electrical accessories. A. Pliers C. Screwdrivers B.
    15·1 answer
  • How to identify mistakes in a html code??​
    14·1 answer
  • When did time begin?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!