You are on page 1of 5

CONFIDENTIAL

CS/JUN 2012/CSC510/ITC430

UNIVERSITI TEKNOLOGI MARA FINAL EXAMINATION

COURSE COURSE CODE EXAMINATION TIME

DISCRETE STRUCTURES CSC510/ITC430 JUNE 2012 3 HOURS

INSTRUCTIONS TO CANDIDATES 1. 2. 3. 4. This question paper consists of seven (7) questions. 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) ii) the Question Paper an Answer Booklet - provided by the Faculty

DO NOT TURN THIS PAGE UNTIL YOU ARE TOLD TO DO SO


This examination paper consists of 5 printed pages
Hak Cipta Universiti Teknologi MARA CONFIDENTIAL

CONFIDENTIAL QUESTION 1

CS/JUN 2012/CSC510/ITC430

a) Translate the following statement into propositional logic: "If you have diabetes, you will get well if and only if you eat your dinner early" Use the following propositional variables: w you get well E you eat your dinner early D you have diabetes (2 marks) b) Consider the following expression: (PoQ)V(--QVR) Determine whether the proposition is a tautology, contradiction or contigent. (5 marks) ii) Construct in disjunctive normal form (DNF). (2 marks) iii) Construct in conjunctive normal form (CNF). (2 marks) c) Simplify the following proposition using appropriate laws: ((-P V Q) A -,P) V ((-P A Q ) V -,Q) (6 marks) QUESTION 2 a) Translate the following into predicate logic: i) If the lecturer is absent, then some students do not keep quiet,

i)

ii) All the students keep quiet and the lecturer is present, iii) Some students do not keep quiet or the lecturer is absent. (6 marks) b) Express the negations of the statements in (a). (6 marks) c) Explain your answer if: i) P-Q is false, can you determine the truth value of (-. ( PAQ) ) ->Q) ?

ii) P-Q is true, can you determine the truth value of (PAQ) - - I Q ? (4 marks)
Hak Cipta Universiti Teknologi MARA CONFIDENTIAL

CONFIDENTIAL

CS/JUN 2012/CSC510/ITC430

QUESTION 3 a) For each of the following relations on the set { x | x e z and 1 < x < 12 } list the ordered pairs belonging to the relations below: i) K = { ( x , y ) I x y = 9}

ii) T = { ( x , y ) I 2x = 3 y } iii) the transitive closure of K iv) the transitive closure of T (8 marks) b) Let R be the relation on {1, 2, 3, 4} given by uRv if and only if u+2v is odd. Represent R in each of the following ways: i) as a set of ordered pairs

ii) in graphical form iii) in matrix form (6 marks) QUESTION 4 a) Prove that if n is a positive integer, then n is even if and only if 5n+8 is odd. (3 marks) b) For each of the arguments below, determine whether the argument is correct or incorrect and explain why. i) Every computer science major takes discrete mathematics. Amirah is taking discrete mathematic. Therefore, Amirah is a computer science major.

ii) Everyone who eats vegetables every day is healthy. Nawi is not healthy. Therefore, Nawi does not eat vegetables every day. (6 marks) c) Use the rules of inference to deduce the conclusion from the premises below: p <^ J P - T K V -,T -,K (6 marks)
Hak Cipta Universiti Teknologi MARA

CONFIDENTIAL

CONFIDENTIAL

CS/JUN 2012/CSC510/ITC430

QUESTION 5 a) Study the grammar below and answer the following questions:

G = {v, T , s ,

pjwith

Vocabulary, V = {a, b, s}, Terminal, T = {a, b}, Starting symbol, s , and

Production, P = { s -> a a s , s - a, s -> b}


i) What is the type of the above grammar? State your reason (2 marks) ii) What language L(G) is generated by G? (3 marks) b) Develop a grammar that generate the language { x V z , m > 0 , n > 1} (6 marks)

QUESTION 6 Given the following state table: f input:

g
input:

0
So
Si Si

1 s2
So
S3 Si

s2
Si S3

s2
S3

0 1 0 1 0

1 1 0 1 1

a) Draw the state diagram for the finite-state automate (FSA) with output. (4 marks) b) Determine the output if the inputs: i) 1111

ii) 10111 iii) 000 iv) 11000 (4 marks) c) Draw a state diagram to construct a deterministic finite-state automaton that recognizes the set of all bit strings that contain the string 101. (5 marks)
Hak Cipta Universiti Teknologi MARA CONFIDENTIAL

CONFIDENTIAL

CS/JUN 2012/CSC510/ITC430

QUESTION 7 a) Compute the weakest precondition for the following program statements based on the given post condition. The assertions are printed in bold. i)
M)

x : = 3 * z ;

y := x + y ;

{ 7 > 7 }

Si := si * 2; s2 : = s2 + 7 ; i : = i +1 ; { s l = i 2 ; s2 = 5 * ( i - l )

(6 marks) b) Given the program segment below : sum := d; n : = k; while k > 0 begin sum : = sum + p ; k := k - 1; end show that sum = d + kp is a loop invariant. (5 marks)

c) Verify if the above algorithm of program segment is correct based on preconditions {d=5, k=4, p=3} and postcondition {sum > 10}. (3 marks)

END OF QUESTION PAPER

Hak Cipta Universiti Teknologi MARA

CONFIDENTIAL

You might also like