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
IgorC [24]
3 years ago
7

Don wishes to swap the values of the variables x and y in his program. He adds a line of code which sets the value of x to the v

alue of y and then a line of code which sets the value of y to the value of x. What is the effect of Don’s code?a. The values of both x and y will be set to the average of the original values of x and y.b. The values of both x and y will be set to the original value of x.c. The values of both x and y will be set to the original value of y.d. The values of the variables x and y will be swapped as intended.
Computers and Technology
1 answer:
12345 [234]3 years ago
5 0

Answer:

The correct answer is (c): The value of both x and y will be set to the original value of y.

Explanation:

Let suppose, we assign some value to variable x and to variable y i.e.

var x=10

vary y=15

Then Don adds a line of code which set the value of x to value of y i.e.

x=y

here it is mean that value of x become 15.

So after this line the value of x is 15 and y is also 15

Then he also added a line of code which set the value of y to value of x. i.e.

y=x

By adding this line of code, the value of y is 15 because x is equal to 15.

Therefore, the value of both x and y will be set to the original value of y.

Why other option are not correct

a. After swapping the value of both variable it is impossible that both variable retain original value in it.

b. this option is only true if in this first line he set the value of y to value of x and in the second line set the value of x to value of y.

d. When you swap two values, there is need of third variable for swapping, when you will swap the value only between two variable, only one variable value will be retained and intended swapping will not be performed

You might be interested in
What is DATE data type and its syntax and what is TIMESTAMP data type and its syntax in SQL language.Explain the difference betw
qaws [65]

Answer: The DATE datatype give us the particular date whereas TIMESTAMP gives us the date as well as the time as the particular moment.

Explanation:

DATE datatype gives us the date in the format yyyy-mm-dd. The timestamp format is yyyy-mm-dd hh:mm:ss. time stamp are of two types :

timestamp with time zone and timestamp without time zone.

Date is the date on that particular day whereas the timestamp is the date along with the specific time when the query is executed.

5 0
3 years ago
Write the definition of a function max that has three int parameters and returns the largest.
g100num [7]

Solution:

The definition of a function max that has three int parameters and returns the largest is given bellow:

def max(x,y,z):

if (x>z and x>y):

return (x)

elif (y>x and y>z):

return y

else:

return z

Thus this is required right answer.

4 0
3 years ago
Read 2 more answers
If you were infiltrating a network (10.16.0.0/16), and searching for vulnerabilities (while trying to remain undetected), why wo
Juliette [100K]

Answer:

Yes, if you want to be undetected.

Explanation:

It is vital to always use a command that will ensure that one's activity is undetected. This is one of the important rules of corporate organizations to keep their data and activities safe and secure. The commend provided is a useful tool for detective works especially the activities of criminals and hackers. Therefore, if the admin wants to be undetected, the command should not be used.

8 0
2 years ago
Read 2 more answers
Write a function that takes in two parallel lists: a list of times (in increasing order), and a list of distance traveled by tha
Georgia [21]

Below is the function that takes two parallel lists;

List of times in increasing order and that of distance travelled by that point in time.

I put into consideration the instructions given in the question.

ANSWER;

def find_velocity(time, distance):

velocities = []

for i in range(1, len(time)):

velocities.append((distance[i] - distance[i - 1]) / (time[i] - time[i - 1]))

return velocities

times are = [1, 3, 5, 7]

distances are = [25, 29, 35, 70]

print(find_velocity(times, distances))

7 0
3 years ago
Sarah has to add a picture from her computer file and add a caption to it. Arrange the steps in a correct sequence.
SVEN [57.7K]
Click Insert
click Picture
click From File
select the desired picture and again click insert
right-click the picture
click Insert Caption
write the caption and add it
5 0
3 years ago
Read 2 more answers
Other questions:
  • Plz answer these questions...those who give answer get the brainliest......hurry up..!!!​
    14·1 answer
  • 1. How does inertia affect a person who is not wearing a seatbelt during a collision? 
    14·2 answers
  • Why is television reactive, requiring no skills or thinking
    11·1 answer
  • What is the output of the following Python program? try: fin = open('answer.txt') fin.write('Yes') except: print('No') print('Ma
    9·1 answer
  • Using the phase plane program, plot the phase plane for the Lotka-Volterra model:
    11·1 answer
  • What are two names for the database that holds digital signatures provided by os manufacturers, such as microsoft and red hat?
    6·1 answer
  • In the Mouse Properties window, you can?
    8·1 answer
  • Which of the following are valid calls to Math.max? 1. Math.max(1,4) 2. Math.max(2.3, 5) 3. Math.max(1, 3, 5, 7) 4. Math.max(-1.
    9·1 answer
  • How is a UDP socket fully identified? What about a TCP socket? What is the difference between the full identification of both so
    9·1 answer
  • 6.16 LAB: Find largest number (EO) Write a method, findMax(), that repeatedly reads in integers until a negative integer is read
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!