Question

In: Computer Science

Suppose x = 0x5A and y = 0xA5. What is the output for x | y?...

Suppose x = 0x5A and y = 0xA5.

What is the output for x | y?

What is the output for x & y?

What is x for x = ~y?

What is the output for x ^ y?

Solutions

Expert Solution

Please up vote ,comment if any query . Thanks for question . be safe .

Result :

Answer : x | y = 0xFF

| bitwise -OR operator

0x5A | 0xA5

In binary : 0x5A = 0101 1010 , 0xA5= 1010 0101

        0101 1010

OR   1010   0101

---------------------------

         1111 1111 = 0xFF

What is bit-wise OR when

0 | 0 = 0

1 | 0 =1

0 | 1 = 1

1 | 1 = 1

Answer : x & y = 0x5A & 0xA5 =0x00

& bitwise AND operator

bitwise AND

0 & 0 = 0

1 & 0 = 0

0 & 1 = 0

1 & 1 = 1

x & y = 0x5A & 0xA5

in binary :

           0101 1010

    &     1010 0101

--------------------------------------

            0000 0000 = 0x00

Answer : x = ~y   x= ~0xA5 , x=0x5A

~ NOT operator

~1   = 0

~0 = 1

NOT operator inverse the bits when bit is 0 than inverse will be 1 ,when bit is 1 inverse will be 0

   ~1010 0101   = 0101 1010 = 0x5A

Answer : x^y = 0x5A ^ 0xA5 = 0xFF

^ Ex-OR operator

when both operand bit same result will be zero else will be 1.

0 ^ 0 = 0

1 ^ 0 = 1

0 ^ 1 = 1

1 ^ 1 = 0

0x5A ^ 0xA5

              0101 1010

        ^    1010   0101

-----------------------------------------------

           1111 1111 = 0xFF

Answer = 0xFF

Please up vote ,comment if any query .


Related Solutions

Suppose P (x, y) means “ x and y are real numbers such that x +...
Suppose P (x, y) means “ x and y are real numbers such that x + 2y = 5 .” Determine whether the statement is true for ∀x∃yP(x,y) and ∃x∀yP(x,y)
Suppose that the utility function of a consumer is U(x,y) = x ¼y ¾, where x...
Suppose that the utility function of a consumer is U(x,y) = x ¼y ¾, where x and y are the quantities of the good X and good Y consumed, respectively. The consumer's income is 400. (a) What is the demanded bundle when the price of good X is 10 and the price of good Y is 10? (b) Redo part (a) when the price of good X is doubled? (c) Redo part (a) when the price of good Y is...
Suppose a country has the production function Y = 2 √?, where Y = output and...
Suppose a country has the production function Y = 2 √?, where Y = output and K = physical capital. People devote 30% of output to producing new capital goods ( = 0.30). Further assume that capital depreciates at the rate of 3 percent per period (δ = 0.03). a. Suppose that the country invested in 6 units of new capital in the current period. By how many units will output change in the next period? b. What are the...
Suppose x,y ∈ R and assume that x < y. Show that for all z ∈...
Suppose x,y ∈ R and assume that x < y. Show that for all z ∈ (x,y), there exists α ∈ (0,1) so that αx+(1−α)y = z. Now, also prove that a set X ⊆ R is convex if and only if the set X satisfies the property that for all x,y ∈ X, with x < y, for all z ∈ (x,y), z ∈ X.
Suppose X and Y have joint probability density function f(x,y) = 6(x-y) when 0<y<x<1 and f(x,y)...
Suppose X and Y have joint probability density function f(x,y) = 6(x-y) when 0<y<x<1 and f(x,y) = 0 otherwise. (a) Indicate with a sketch the sample space in the x-y plane (b) Find the marginal density of X, fX(x) (c) Show that fX(x) is properly normalized, i.e., that it integrates to 1 on the sample space of X (d) Find the marginal density of Y, fY(y) (e) Show that fY(y) is properly normalized, i.e., that it integrates to 1 on...
x[n] is the input of a system and y[n] is the output of the system. The...
x[n] is the input of a system and y[n] is the output of the system. The relationship between the input and output is the following: y[n] = x[n]u[n+1] a) Is the system memoryless? Just yes or no is sufficient. b) Is this system causal? Just yes or no is sufficient. c) Is the system linear? Just yes or no is sufficient. d) Is the system time invariant? Justify. e) Is the system BIBO stable? Justify. f) Is the system invertible?...
Suppose (X, dX) and (Y, dY ) are metric spaces. Define d : (X ×Y )×(X...
Suppose (X, dX) and (Y, dY ) are metric spaces. Define d : (X ×Y )×(X × Y ) → R by d((x, y),(a, b)) = dX(x, a) + dY (y, b). Prove d is a metric on X × Y .
(27 pts total) What follows is hypothetical Excel output for doing regression of y on x....
(27 pts total) What follows is hypothetical Excel output for doing regression of y on x. The regression equation is: ^y = 54:6429 + 0:9451x Source DF SS MS F P Regression 1 130.0396 130.0396 20.7812 0.0019 Residual Error Total 9 180.1000 (a) (3 pts) Complete the ANOVA table above by lling in the \Residual Error" row above. (b) (6 pts) What are the values of the regression standard error s and the coecient of determination r2? (c) (6 pts)...
Suppose that the joint probability density function of ˜ (X, Y) is given by:´ f X,Y...
Suppose that the joint probability density function of ˜ (X, Y) is given by:´ f X,Y (x,y) = 4x/y3 I(0.1)(x), I (1, ∞)(y). Calculate a) P(1/2 < X < 3/4, 0 < Y ≤ 1/3). b) P(Y > 5). c) P(Y > X).
PART A: Suppose X and Y are independent. Show that H(X|Y) = H(X) . (H represents...
PART A: Suppose X and Y are independent. Show that H(X|Y) = H(X) . (H represents entropy i think) PART B: Suppose X and Y are independent. Show that H(X,Y) = H(X) + H(Y) PART C: Prove that the mutual information is symmetric, i.e., I(X,Y) = I(Y,X) and xi∈X, yi∈Y
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT