CONFIDENTIAL CS/DEC 2019/CSC510
UNIVERSITI TEKNOLOGI MARA
FINAL EXAMINATION
COURSE DISCRETE STRUCTURES
COURSE CODE CSC510
EXAMINATION DECEMBER 2019
TIME 3 HOURS
INSTRUCTIONS TO CANDIDATES
1. This question paper consists of ten (10) questions.
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:
i) the Question Paper
ii) an Answer Booklet - provided by the Faculty
Answer ALL questions in English.
DO NOT TURN THIS PAGE UNTIL YOU ARE TOLD TO DO SO
This examination paper consists of 6 printed pages
© Hak Cipta Universiti Teknologi MARA CONFIDENTIAL
CONFIDENTIAL CS/DEC 2019/CSC510
QUESTION 1
The symbols P, R and S define the following propositions.
P: Alif is a software tester.
R: Ani is a system analyst.
S: Arif is a web designer.
Represent each of the statements below using the defined symbols and logical connectives,
a) Ani is not a system analyst.
(2 marks)
b) Alif is a software tester or Arif is not a web designer.
(2 marks)
c) Alif is a software tester if and only Ani is a system analyst and Arif is a web designer.
(2 marks)
QUESTION 2
An argument is given as follows:
"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.
P: "You drive fast"
Q: "I will arrive to the airport early"
R: "I will drive the car"
S: "I will drive fast"
(4 marks)
b) Show that the formulated premises in a) lead to the conclusion.
(4 marks)
© Hak Cipta Universiti Teknologi MARA CONFIDENTIAL
CS/DEC 2019/CSC510
CONFIDENTIAL
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)
c) Use contradiction to prove that if n is an even integer then 3n +7 is odd.
(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)
c) Functions his defined by h(x) = 3 x2 - 7 x - 5. Findh(x - 2).
(2 marks)
d) Functions f is defined by f(x) =-2x2+6x- 3. Find f (-2)
(2 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.
i. All 2nd grade student in school
ii. All student in school
iii. All student
(3 marks)
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".
i. No mobile application is being developed by all programmers,
ii. Every programmer is developing at least one mobile application.
(3 marks)
c) Given statement 3x 3y (x2 = y/2) with domain of discourse positive integer number.
i. Determine whether the statement is true or false with justification,
ii. Explain in words, the meaning of statement.
(4 marks)
QUESTION 6
Set A and B are defined as follows:
A = {x | x £ Z+ and (3 < x < 12 and x mod 3 1) }
B = {x | x G Z+ and (1 < x < 5) }
Find the elements for the following:
a) P(A)
(2 marks)
b) A U B
(2 marks)
C) A - B
(2 marks)
d) (A U B) - (An B)
(2 marks)
© Hak Cipta Universiti Teknologi MARA CONFIDENTIAL
CONFIDENTIAL 5 CS/DEC 2019/CSC510
QUESTION 7
Consider the grammar g = (V, t, s, p) , which is described by its non-terminal symbols
v={S, x, Y}, terminal symbols t = {l, 0}, starting symbol s and production
P = {S -> XY, X -> IX, X -» 0, y -> 1}.
a) State the type of grammar g.
(2 marks)
b) Drawthe derivation tree for 11101.
(2 marks)
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)
b) From a), construct a state table.
(4 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)
©Hak Cipta Universiti Teknologi MARA CONFIDENTIAL
CONFIDENTIAL 6 CS/DEC 2019/CSC510
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)
END OF QUESTION PAPER
© Hak Cipta Universiti Teknologi MARA CONFIDENTIAL