14 AP Computer Science Principles


3. Consider the following code segment.

first 100

second 200

temp first

second + temp

first second

What are the values of first and second as a result of executing the code segment?

(A) first = 100, second

= 100

(B) first = 100, second = 200

(C) first = 200, second

=

100

(D) first = 200, second =

200

Respuesta :

The values of first and second as a result of executing the code segment are (c) first = 200 and second = 100

How to determine the value of the variables?

From the code segments, we have the following assignment operations

first = 100 and second = 200

The variable first is assigned to variable temp.

So, we have:

temp = first = 100

The variable temp is assigned to variable second

So, we have:

second = temp =  100

Lastly, the variable second is assigned to variable first

first = 200

Hence, the values of first and second as a result of executing the code segment are (c) first = 200 and second = 100

Read more about code segments at:

https://brainly.com/question/14284157

#SPJ1