CSC510 Dec 2019
CSC510 Dec 2019
TIME 3 HOURS
INSTRUCTIONS TO CANDIDATES
2. Answer ALL questions in the Answer Booklet. Start each answer on a new page.
Do not bring any material into the examination room unless permission is given by the
invigilator.
Please check to make sure that this examination pack consists of:
QUESTION 1
Represent each of the statements below using the defined symbols and logical connectives,
c) Alif is a software tester if and only Ani is a system analyst and Arif is a web designer.
(2 marks)
QUESTION 2
"If you drive fast, then I will arrive to the airport early", "If you do not drive fast, then I will
drive the car", and "If I drive the car, then I will drive fast", lead to conclusion "If I do not
arrive to the airport early, then I will drive fast"
a) Formulate the above argument into premises using the propositional variables defined
below.
QUESTION 3
a) With the aid of a truth table, convert the expression (P - Q) (Q a -iR) into
Disjunctive Normal Form (DNF).
(6 marks)
b) Show that (-.q v p) and (-.p -•q)) are logically equivalent by using series of
logical equivalence rules.
(4 marks)
d) Aset of premises and conclusions are given below. Using rules of inference to check the
validity of the argument. Apply direct proof method with reasoning for each step in your
deduction.
Premise 1 -K|->r
Premise 2
Premise 3 -• (s V r)
Conclusion: p
(6 marks)
QUESTION 4
a) For each of the following relations on the set {x G Z and 2 < x < 10} list the
ordered pairs belonging to the relations below:
i. X = {( m , n ) I ran = 8 }
ii. Y = {( m , n ) I 2m = 3n }
(4 marks)
b) ArelationP = {((5, 5), (5, 6), (5, 7), (6, 5), (6, 6), (7, 5), (7,
7) is defined on the set q = {5, 6, 7}. Determine whether the relation p is an
equivalence relation. Explain your answer.
(4 marks)
CONFIDENTIAL
© Hak Cipta Universiti Teknologi MARA
CONFIDENTIAL CS/DEC 2019/CSC510
QUESTION 5
a) Express the statement "Some 2nd grade student in school learn basic computer" using
suitable predicate symbols for each of the following universe of discourse.
b) Translate each of the following state into predicate logic. The variable x represent
programmer, y represent mobile application and d (x, y) means "x is developing a y".
c) Given statement 3x 3y (x2 = y/2) with domain of discourse positive integer number.
QUESTION 6
a) P(A)
(2 marks)
b) A U B
(2 marks)
C) A - B
(2 marks)
d) (A U B) - (An B)
(2 marks)
QUESTION 7
c) List out all words generated by g. You can simplify growing word if it is exist in G.
(2 marks)
QUESTION 8
a) Design a deterministic finite-state automaton that accepts any strings over {A, B}, which
begin with a and end with ab. Examples of accepted strings are aab, aaab, abab,
aaaaab, abbbbab and abababab.
(6 marks)
QUESTION 9
a) Proof the correctness of the program segment given below based on pre-condition and
post-condition as printed in bold.
int x, y;
{ x > 4 A y ^ 10}
x = x * 2;
y = y - x;
y = y + 10;
{x > 10 A y > 10}
(5 marks)
b) Identify the weakest pre-condition for the following program segment given below that
can guarantee the post-condition to be true.
integer m, n;
if (m >= n)
m := n * 16;
else
m := n * n;
{m > 16}
(5 marks)
QUESTION 10
a) Show the p = qr+2 is an invariant in the loop segment given below. The variable in the
program are defined as type integer.
p := 1; q := 2; r := 0;
while ( r != n ){
r := r + 2;
p := p * q * q;
}
(5 marks)
b) Identify the strongest post-condition for the program shown in a) if the pre-condition is
given as {n > 2}. Explain your answer.
(5 marks)