0% found this document useful (0 votes)
55 views

Universiti Teknologi Mara Final Examination: Confidential CS/APR 2008/ITC430/CSC510

Uploaded by

ain
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)
55 views

Universiti Teknologi Mara Final Examination: Confidential CS/APR 2008/ITC430/CSC510

Uploaded by

ain
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/APR 2008/ITC430/CSC510

UNIVERSITI TEKNOLOGI MARA


FINAL EXAMINATION

COURSE : DISCRETE STRUCTURES


COURSE CODE : ITC430/CSC510
EXAMINATION : APRIL 2008
TIME : 3 HOURS

INSTRUCTIONS TO CANDIDATES

1• This question paper contains seven (7) questions.

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

3. Do not bring any material into the examination room unless permission is given by the
invigilator.

4. Please check to make sure that this examination pack consists of:

i) the Question Paper


ii) an Answer Booklet - provided by the Faculty

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


This examination paper consists of 7 printed pages
© Hak Cipta Universiti Teknologi MARA CONFIDENTIAL
CONFIDENTIAL 2 CS/APR 2008/ITC430/CSC510

Answer ALL questions.

QUESTION 1

a) Write the logical expression P -> (-.Q A R) using only the connectives-. and A.
(4 marks)

b) Construct the truth table for the logical expression p v -,Q A -.R -> p. Determine if it is
a tautology, contradiction or contingent
(4 marks)

c) The symbols A, R and s stand for the propositions Mom is adventurous, Mom is rich, and
Mom visits many countries, respectively.

i. Write the following logical expression in English.

I. A -^ (R H> S)

II. A A R -^ S
(4 marks)

ii. Determine if the above expressions are equivalent to each other.

(4 marks)

QUESTION 2

a) With the aid of a truth table, determine whether the following argument is valid.
/ play golf or tennis. If it is not Sunday, I play golf and tennis. If it is
Saturday or Sunday then I don't play golf. Therefore I don't play golf.
Note: Use the symbols G, T, A and u to represent the propositions: I play golf, I play tennis,
It is Saturday, and It is Sunday, respectively.
(5 marks)

© Hak Cipta Universiti Teknologi MARA CONFIDENTIAL


CONFIDENTIAL 3 CS/APR 2008/ITC430/CSC510

b) Suppose we have a situation as given below.

Every student in this class is a girl. Every girl in this class passed the final
examination. Norizan is a student in this class.

Explain why we can draw the conclusion: Norizan passed the final examination.
(4 marks)

c) Write the declarative proof (using inference rules) for the following argument.

Since Porsche enjoys good prestige, Arun can be expected to buy it


provided he drives. Arun did not buy a Porsche. Therefore, Arun cannot
drive.

Note: Use the symbols P, B and D to represent the propositions: Porsche enjoys good
prestige, Arun buys a Porsche, and Arun can drive, respectively.
(5 marks)

QUESTION 3

a) Write the following logical expressions in English.

i. Vx3y ( S ( x )->P ( y ) A T(x,y) )

ii. Vy3x (-.S(x) A -.P(y) A T (x,y))

Note: T h e p r e d i c a t e s s ( x ) d e n o t e s x is enrolled in a Science degree, P ( x ) denotes x


is a programming course, and T (x, y) denotes x is taking y.
(4 marks)

b) Using a Venn diagram, test the validity of the following argument. Explain your answer.

There are no athletes who are swimmers. Some swimmers are cyclists.
Therefore, some cyclists are not athletes.
(4 marks)

c) Considerthe logical expression 3xs (x) -»VxP(x).

i. Prove that the expression is always true if the domain of discourse contains only a
single element.
(2 marks)

ii. Find a model for the expression over a domain of discourse with two elements,
{apple,orange}.
(4 marks)

© Hak Cipta Universiti Teknologi MARA CONFIDENTIAL


CONFIDENTIAL 4 CS/APR 2008/ITC430/CSC510

QUESTION 4

a) Using set builder notation, describe the set of numbers { 2 , 3 , 4 , 5 } in T W O (2) different
ways.
(2 marks)

b) Using set identities, show that

i. (A u B) n (~A u C) n (B u C) = (A u B) n (~A u c)

ii. (A - B) - C = (A - C) - (B - C)
(6 m a r k s )

c) P is a r e l a t i o n d e f i n e d o n t h e s e t { a , b , c , d } , s u c h t h a t p = { ( a , a ) , ( a , b ) ,
(a,c), (a,d), (b,a), (b,b), (b,c), (b,d), (c,b), (c,c), (d,b)}.

D e t e r m i n e w h e t h e r p is reflexive, s y m m e t r i c a n d / or t r a n s i t i v e . E x p l a i n y o u r a n s w e r .
(4 m a r k s )

d) L e t s e t s = { ( x , y ) | x e N , y e N , N < 1 0 } , w h e r e N is a n a t u r a l n u m b e r .
R e l a t i o n Q is d e f i n e d o n s s u c h t h a t Q = { ( w , x ) | x = y, w = z, ( y , z ) e Q},and
relation R is d e f i n e d o n s s u c h t h a t R = { ( x , y ) | x = y}.

Determine whether Q u R is a n e q u i v a l e n c e relation or a n o r d e r e d r e l a t i o n . E x p l a i n y o u r


answer.
(4 m a r k s )

© Hak Cipta Universiti Teknologi MARA CONFIDENTIAL


CONFIDENTIAL CS/APR 2008/ITC430/CSC510

QUESTION 5

Consider the graph below:

a) What is the maximum and the minimum degree of vertices in the graph?
(2 marks)

b) Represent the graph as an adjacency lists.


(3 marks)

c) List the course of a depth-first traversal that begins at vertex A.


Note: The vertices are in alphabetical order.
(3 marks)

d) What is the shortest path from vertex A to vertex H?


(3 marks)

e) Is the above graph strongly connected graph? State your reason.


(2 marks)

f) Identify TWO (2) disjoint components comprising of ALL the vertices of the above
graph and only SEVEN (7) of the edges in the original graph.
(3 marks)

© Hak Cipta Universiti Teknologi MARA CONFIDENTIAL


CONFIDENTIAL 6 CS/APR 2008/ITC430/CSC510

QUESTION 6

a) Compute the weakest precondition for each of the following program statements based on
their postconditions (the assertions in bold)

a. x := 2 * x {0 < x < 20}

b . i f x < 0 t h e n x := x + 2 {x > 0}
(2 marks)

b) Study the program segment given below and answerthe questions that follow.

Note: x and n are input variables.

z := 0;
i := 0;
while (i <= n)
{
if (x < 0)
z := z + i - x;
else
z := z + i + x;
i := i + 1;

i. List a few sample data that you will use to test the program segment.
(3 marks)

ii. Formally proof that the program segment is correct using suitable assertions.

I. First, verify the conditional statement after determining an appropriate


postcondition for it.
(4 marks)

II. Next, find the loop invariant before verifying the loop statement.
(4 marks)

III. Finally, by taking into consideration the two assignment statements at the
beginning, compute the weakest precondition for the program segment.
(2 marks)

© Hak Cipta Universiti Teknologi MARA CONFIDENTIAL


CONFIDENTIAL 7 CS/APR 2008/ITC430/CSC510

QUESTION 7

Study the grammar given below and answer the following questions.

G = { V , T , s , P} with
Vocabulary, v = { a , b , c, S, A , B , C } ,
Terminals, T = { a , b , c } ,
Starting symbol, S, and
Productions, P = {S -* C, C - aCAB, S -> A, BA -» AB, aA
a b , bA -» b b , bB -* b e , cB -. c c } .

a) What is the type of the above grammar? State your reason.


(2 marks)

b) The grammar is supposed to generate the language {a n b n c n | n > 0 } , but it does


not. Correct the error in the grammar. (Hint: Try constructing the derivation of
aabbec).
(3 marks)

c) Give the productions that generates the language

{a n b k c n |n > 0, k > n}
(4 marks)

END OF QUESTION PAPER

© Hak Cipta Universiti Teknologi MARA CONFIDENTIAL

You might also like