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)
There are 60 science students tn a
Secondary School. 35 of whom study
Chemistry and 30 study Technical
Drawing, 12 out of those students atudy
Biology and chemistry but not Technical
Drawing, 10 study Chemistry but
neither biology nor Technical Drawing 11
study only Technical Drawing and
neither Biology nor Chemistry, 10 also
study Chemistry and Technical Drawing
only
a. How many mdents study all the three
subjects?
b. How many students study biology and
Technical Drawing but not Chemistry?
C. How many students study Biology only?
d How many students study biology all
together.
p: "I study for the test"
q: "I am sick"
r: "I fail the exam"
Translate the compound proposition below into words:
(¬p∨q)→r
Find the power set of each of these sets, where a and b are distinct elements. a) {a} b) {a, b} c) {∅,{∅}}
Evaluate the truth value of the following propositions using the set (1 ,3, 5, 7)
as the domain.
1. Vx: x (x2 – 4) = 0
2. Ǝx : x + 1 > 0
3. Ǝx : x (x2
– 4) = 0
Translate the following into symbolic
form and give its domain.
1. All fishes are swimmers.
2. Some fruits are sweet.
3. Every number is a real number.
4. Any mammal is not two-legged.
1. The encrypted version of a message is DSWO PYB PEX. If it was encrypted using the function f(p) = (p + 10) mod 26 (the Caesar cipher), what was the original message?
1. Use the Euclidean algorithm to find the greatest common divisor (gcd) of each pairs of integers. Show the steps of calculation.
a) (900,140)
b) (128,729)
1. Suppose a phrase-structure grammar has productions S ® 1S0, S ® 0A, A ® 0. Find derivations of :
a) 00
b) 1000
c) 110000
If p and q are two propositions, then show that ~ (p V q) Ξ ~ p ~ q