0% found this document useful (0 votes)
35 views7 pages

CSC510 Feb 2022

Uploaded by

ellyshakhan99
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views7 pages

CSC510 Feb 2022

Uploaded by

ellyshakhan99
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

CONFIDENTIAL CS/FEB2022/CSC510

UNIVERSITI TEKNOLOGI MARA


FINAL EXAMINATION

COURSE : DISCRETE STRUCTURES


COURSE CODE : CSC510
EXAMINATION : FEB 2022
TIME : 3 HOURS

INSTRUCTIONS TO CANDIDATES

1. This question paper consists of SEVEN (7) questions.

2. Answer ALL questions. Start each answer on a new page.

3. No discussion among students is allowed.

4. Answer ALL questions in English.

5. Make sure your answer papers are readable. Write your answers clearly with your full name,
group and student ID.

6. Submit your answers via Google Classroom in pdf format. Please upload ONLY ONE (1) pdf
format file into Google Classroom

SELF DECLARATION
a) I know that plagiarism is wrong. Plagiarism is use another’s work and pretend that it is one’s own.
b) This assessment is my own work.
c) I have not involved, and will not allow anyone to copy my work with the intention of passing it off as
their own work.
d) I acknowledge that copying someone else’s work (or part of it) is wrong and declare that my
assessment is my own work.

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


QUESTION 1

a) The symbols P, Q and R defined the following propositions.

P: You are allowed to enter a supermarket


Q: MySejahtera profile states ‘Low Risk’
R: MySejahtera profile states ‘Casual Contact No Symptom’

Represent each of these statements below using the defined symbols and logical
connectives.

i. You are allowed to enter a supermarket only if your MySejahtera profile states
‘Low Risk’ or ‘Casual Contact No Symptom’.

ii. Neither MySejahtera profile states ‘Low Risk’ nor ‘Casual Contact No Symptom’

iii. You are allowed to enter a supermarket whenever the MySejahtera profile states
‘Low Risk’.

(6 marks)

b) Write the negation for these propositions:

i. There exist flood victims that are Covid 19 positive.

ii. Zuraini will go camping unless she does not have transportation.
(4 marks)

© Hak Cipta Universiti Teknologi MARA 2 CONFIDENTIAL


QUESTION 2

a) Write the following statement in the form of contrapositive and inverse.


“Party XYZ will win the election if the party XYZ committed to their main objective”

(4 marks)

b) Convert the following expression into Conjunctive Normal Form with the aid of a truth table.

Z = (C ∨ ¬A) ∧ (¬B ∨ C) ∧ (A ∨ B)
(6 marks)

c) Show that (A ∧ ¬B) ∨ B ≡ (A ∨ B) are logically equivalent by using series of logical


equivalence rules.
(5 marks)

QUESTION 3

a) If Leila receives her allowances on Saturday, she will go out to have dinner with her friends.
Leila does not get her allowances as usual this week, then her sister Emily will cook her
dinner. However, Emily is neither a good cook nor has the time to cook for Leila. Therefore,
Leila will go out with her friends.

i. Based on the situation above, convert the arguments into propositional logic
statements. Let:

P: Leila receives allowance on Saturday


Q: Leila will go out to have dinner with her friends
R: Emily is a good cook
S: Emily will cook for Leila
(4 marks)

ii. From your answer above, use the Rule of Inference to check the conclusion’s
validity.
(6 marks)

b) Use contradiction to prove ‘If n is odd, then 2n-7 is even’.


(5 marks)

© Hak Cipta Universiti Teknologi MARA 3 CONFIDENTIAL


QUESTION 4

a) Translate each of the following statements into logical expression using predicates,
quantifiers, and logical connectives.

Let S(x) be “x is my subjects taken this semester” and M(x) be “x is manageable.”

i. All my subjects taken this semester are manageable.


(2 marks)
ii. At least one of the subjects is manageable.
(2 marks)

b) Let S(x) be the statement “x sends volunteers to help flood victims in several states”, where
the domain for x consists of all universities in Malaysia. Express each of these
quantifications in English.

i. ∀xS(x)
(2 marks)
ii. ∃x¬S(x)
(2 marks)

QUESTION 5

a) Given 𝐴, 𝐵 and 𝐶 as subsets of 𝑍, defined by


𝐴 = {𝑥|0 < 𝑥 < 5}
𝐵 = {3,7,19,25}
𝐶 = {1,3,5,7,11,13,17,19,23,29}

i. Find 𝐴 ∪ 𝐵.
(2 marks)

ii. Find 𝐵 ∩ 𝐶.
(2 marks)

iii. Find 𝐴 ∪ (𝐵 − 𝐶).


(3 marks)

b) Given relation 𝑅 = {(𝑎, 𝑏), (𝑎, 𝑐), (𝑐, 𝑐), (𝑏, 𝑏), (𝑐, 𝑏), (𝑏, 𝑐)} on the set 𝐴 = {𝑎, 𝑏, 𝑐}. Show
whether 𝑅 is:

i. Reflexive
(2 marks)

ii. Symmetric
(2 marks)

iii. Transitive
(3 marks)
© Hak Cipta Universiti Teknologi MARA 4 CONFIDENTIAL
c) Show that 𝑓: 𝑅 → 𝑅 given by 𝑓(𝑥) = 5𝑥 3 + 1 is bijective.
(6 marks)

QUESTION 6

a) Consider the grammar G = (V, T, S, P), which is described by its non-terminal


symbols V={S, X, Y}, terminal symbols T = {1, 0}, starting symbol S and
production P = {S → XY, X → 1X, X → 0, y →1}.

i. State the type of grammar G with reason(s).


(2 marks)
ii. Draw the derivation tree for 11101.
(4 marks)

b) Design a deterministic finite-state automaton that accepts any strings over {1,0}, which
begins, and ends with 10, and any combination of numbers 1 or 0 in the middle. An
example of an accepted string is 101010, 10110010, 10111110, 10000010.
(8 marks)

c) Construct a state table for the deterministic finite-state automaton in b) above.


(4 marks)

© Hak Cipta Universiti Teknologi MARA 5 CONFIDENTIAL


QUESTION 7

a) Prove the assignment segment given below to its pre-condition and post-condition using
Hoare triple method.
{t >= 5}

void main()
{
int f,g,z;

z = 2 * t - 8;
g = 2 * z;
f = 2 * g - 5;
}

{f >= 3}

(4 marks)

b) Identify the weakest pre-condition for the following decision that can guarantee the post-
condition to be true.
{ ? }

integer m, n

if (m > n)
y = 8 / y + 1

else
y = 3 * y

{ y ≥ 9 }
(4 marks)

c)
i. Find the loop invariant for the program code below.
void main()
{
int y = 1, x = 0;

while (x < 4)
{

y = y * z;

x = x + 1;

}
}
(2 marks)
© Hak Cipta Universiti Teknologi MARA 6 CONFIDENTIAL
ii. Prove whether the loop invariant that you created in i. is valid or not using Hoare triple
method.
(2 marks)

iii. Identify the strongest post-condition if the pre-condition is given as { z ≥ 10 } using


loop invariant that you created in i.

(2 marks)

END OF QUESTION PAPER

© Hak Cipta Universiti Teknologi MARA 7 CONFIDENTIAL

You might also like