1. What is the value of x after each of these statements is encountered in a computer program, if x = 1 before the statement is reached?
a) if x + 2 = 3 then x := x + 1
b) if (x + 1 = 3) OR (2x + 2 = 3) then x := x + 1
c) if (2x + 3 = 5) AND (3x + 4 = 7) then x := x + 1
d) if (x + 1 = 2) XOR (x + 2 = 3) then x := x + 1
e) if x < 2 then x := x + 1
2. Find the bitwise OR, bitwise AND, and bitwise XOR of each of these pairs of bit strings. a) 101 1110, 010 0001
b) 1111 0000, 1010 1010
c) 00 0111 0001, 10 0100 1000
d) 11 1111 1111, 00 0000 0000
3. Evaluate each of these expressions. a) 1 1000 𝖠 (0 1011 ∨ 1 1011)
b) (0 1111 𝖠 1 0101) ∨ 0 1000
c) (0 1010 ⊕ 1 1011) ⊕ 0 1000
d) (1 1011 ∨ 0 1010) 𝖠 (1 0001 ∨ 1 1011)
Comments
Leave a comment