Question

In: Computer Science

x, y, z, w, u and t are integer variables, what will their value be after...

x, y, z, w, u and t are integer variables, what will their value be after the execution of the statements below. Give the final value of each variable

x = 7;

y = x + 1;

z = x % (y – 2) + 4;

y = (y + z ) % (x + 4) ;

w = (x * y) / (z – 3);

x = x + x;

u = w - 3;

t = z + (x + y + 2) % w;

Solutions

Expert Solution

1) x=7

2) y= x+1

y=7+1

y=8

3) z = x % (y – 2) + 4;

z = 7%(8-2)+4; (here () is higher precedence so first calculate the values whith in braces.)

z = 7%6+4; (Here % is higher precedence so first first we do modulo operation)

z= 1+4

z=5

4) y = (y + z ) % (x + 4) ;

y = (8 + 5) % (7 +4); (Here () is higher precedence so first calculate the values whith in braces. precedence is left to right)

y = 13%11

y = 2 (Now the value of y is updated to 2 from 8)

5)  w = (x * y) / (z – 3);

w = ( 7*2)/(5-3);

w = 14 / 2

w =7

6) x = x + x;

x= 7 + 7

x = 14 (Now the value of x is updated to 14 from 7)

7)  u = w - 3

u = 7-3

u = 4

8) t = z + (x + y + 2) % w

t = 5 + ( 14 + 2+ 2) % 7 (Here () have higher precedence than % and +)

t = 5 +18 %7 (Here % have higher precedence than +,so first we do % operation)

t = 5+4

t =9

The value of x is : 14

The value of y is : 2

The value of w is : 7

The value of z is : 5

The values of u is : 4

The value of t is : 9

PLEASE UPVOTE


Related Solutions

1. Let U = {r, s, t, u, v, w, x, y, z}, D = {s,...
1. Let U = {r, s, t, u, v, w, x, y, z}, D = {s, t, u, v, w}, E = {v, w, x}, and F = {t, u}. Use roster notation to list the elements of D ∩ E. a. {v, w} b. {r, s, t, u, v, w, x, y, z} c. {s, t, u} d. {s, t, u, v, w, x, y, z} 2. Let U = {r, s, t, u, v, w, x, y, z},...
Please explain this prolog code line by line. union([X|Y],Z,W) :- member(X,Z), union(Y,Z,W). union([X|Y],Z,[X|W]) :- \+ member(X,Z),...
Please explain this prolog code line by line. union([X|Y],Z,W) :- member(X,Z), union(Y,Z,W). union([X|Y],Z,[X|W]) :- \+ member(X,Z), union(Y,Z,W). union([],Z,Z).
Assume that the variables w, x, y, and z are stored in memory locations 16, 32,...
Assume that the variables w, x, y, and z are stored in memory locations 16, 32, 48, and 128 respectively. Translate the following algorithmic operations into MIPS language equivalents: [Assume $s1 is the base register, and $s1 contains the address of memory location 0]                                                                                                             if ((x – y) ³ w) then       set x to y else: set x to z endif
Consider the linear transformation T: R^4 to R^3 defined by T(x, y, z, w) = (x...
Consider the linear transformation T: R^4 to R^3 defined by T(x, y, z, w) = (x +2y +z, 2x +2y +3z +w, x +4y +2w) a) Find the dimension and basis for Im T (the image of T) b) Find the dimension and basis for Ker ( the Kernel of T) c) Does the vector v= (2,3,5) belong to Im T? Justify the answer. d) Does the vector v= (12,-3,-6,0) belong to Ker? Justify the answer.
The following logic function is given as a sum of minterms F(W,X,Y,Z) = ∑W,X,Y,Z(7,8,10,11,13) + D(5,...
The following logic function is given as a sum of minterms F(W,X,Y,Z) = ∑W,X,Y,Z(7,8,10,11,13) + D(5, 9, 15). (25 points) a) Draw the K-Map and find the minimal sum-of-products expression for this function. b) Draw the circuit implementing this expression c) Give all input pair or pairs where transition between them would create a timing hazard d) Draw the timing diagram showing the glitch corresponding to the pair or one of the pairs. Assume ALL gate delays are equal e)...
The joint density function for random variables X, Y, and Z is f(x, y, z)= Cxyz  if...
The joint density function for random variables X, Y, and Z is f(x, y, z)= Cxyz  if 0 ≤ x ≤ 1, 0 ≤ y ≤ 2, 0 ≤ z ≤ 2, and f(x, y, z) = 0 otherwise. (a) Find the value of the constant C. (b) Find P(X ≤ 1, Y ≤ 1, Z ≤ 1). (c) Find P(X + Y + Z ≤ 1).
utility function u(x,y;t )= (x-t)ay1-a x>=t, t>0, 0<a<1 u(x,y;t )=0 when x<t does income consumption curve...
utility function u(x,y;t )= (x-t)ay1-a x>=t, t>0, 0<a<1 u(x,y;t )=0 when x<t does income consumption curve is y=[(1-a)(x-t)px]/apy ?(my result, i used lagrange, not sure about it) how to draw the income consumption curve?
The temperature at a point (x, y, z) is given by T(x, y, z) = 100e−x2...
The temperature at a point (x, y, z) is given by T(x, y, z) = 100e−x2 − 3y2 − 7z2 where T is measured in °C and x, y, z in meters. (a) Find the rate of change of temperature at the point P(2, −1, 2) in the direction towards the point (4, −4, 4). answer in °C/m (b) In which direction does the temperature increase fastest at P? (c) Find the maximum rate of increase at P.
The temperature at a point (x, y, z) is given by T(x, y, z) = 300e−x2...
The temperature at a point (x, y, z) is given by T(x, y, z) = 300e−x2 − 3y2 − 9z2 where T is measured in °C and x, y, z in meters. (a) Find the rate of change of temperature at the point P(4, −1, 3) in the direction towards the point (6, −2, 6) (b) In which direction does the temperature increase fastest at P? (c) Find the maximum rate of increase at P.
The temperature at a point (x,y,z) is given by T(x,y,z)=200e^(-x^2-y^2/4-z^2/9) , where T is measured in...
The temperature at a point (x,y,z) is given by T(x,y,z)=200e^(-x^2-y^2/4-z^2/9) , where T is measured in degrees Celsius and x,y, and z in meters. just try to keep track of what needs to be a unit vector. a) Find the rate of change of the temperature at the point (1, 1, -1) in the direction toward the point (-5, -4, -3). b) In which direction (unit vector) does the temperature increase the fastest at (1, 1, -1)? c) What is...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT