Escolar Documentos
Profissional Documentos
Cultura Documentos
CS/JAN 2012/CSC510/ITC430
INSTRUCTIONS TO CANDIDATES 1. 2. 3. This question paper consists of eight (8) 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
CS/JAN 2012/CSC510/ITC430
p : You drive over 90 kilometers per hour. q : You get a summon for speeding. Write these propositions using p and q and logical connectives. i) ii) iii) You get a summon for speeding, but you do not drive over 90 kilometers per hour, Whenever you get a summon for speeding, you are driving over 90 kilometers per hour, If you do not drive over 90 kilometers per hour, then you will not get a summon for speeding. (6 marks)
b)
Write the negation of the following statements: i) ii) You can access the website only if you pay a subscription fee. Jamal knows Java and C++. (4 marks)
c)
)) -
QUESTION 2 a) Write the negation of the following quantified statements. Move -i as far inside the predicate as possible.
i)
ii)
3x [Q(x) v (-P(x))]
BxVyVz [(F(x,y) A G(X,Z)) - H(y,z)] (6 marks)
b)
Express each of these quantifications in English. i) ii) 3x(S(x) A -.M(x)), where domain x consists of all people; S(x): x is a student in your school and M(x): x can speak Bahasa Malaysia. Vx G Z Vy e Z (x + y Z) { Z is the set of integers } (4 marks)
CONFIDENTIAL
CONFIDENTIAL c)
CS/JAN 2012/CSC510/ITC430
Express each of these statements using quantifiers and predicates with more than one variable. i) A man qualifies for the marathon if his best previous time is less than 3 hours and a woman qualifies for the marathon if her best previous time is less than 3.5 hours. Everyone in your class has either telephoned AN or sent him an e-mail message. (6 marks)
ii)
QUESTION 3 a) If n is an even integer, then i) ii) iii) iv) Prove that n2 is even. Prove that the product of an even integer and any integer is also even. Prove that the sum of three even integer is also even. Hence prove that 9n2 + 3n - 2 is even. (8 marks) b) Give the simplest possible conclusion for arguments given below. Show all your steps. The program is running if and only if the computer is working. The computer is working or the power is off. The power is on. (4 marks) QUESTION 4 a) Use set builder notation to give a description of the set shown below. S b) c) ={3,6,9}.
Obtain the power set P(S) for the set given in (a). What are the elements of the set A ={ (x,y) | x,y e Z and x2 + y2 < 4 } , and what is its cardinality? (6 marks)
d)
A function assigns to each positive integer its smallest decimal digit. i) ii) Find the domain and range of the function. Is this function onto? Is it one-to-one? Explain your answer. (6 marks)
CONFIDENTIAL
CONFIDENTIAL
CS/JAN 2012/CSC510/ITC430
QUESTION 5 a) Provide a counterexample to show that the relation R = { ( x , y ) G R2| x 2 > y } is not transitive. (4 marks) b) Let R be the relation on the set of all people who live in Seri Iskandar. R = {{x,y) | x l i v e s w i t h i n a k i l o m e t e r of y }.
QUESTION 6 a) Draw the state diagram for the DFSA given by the state table below. Final states are s0 S3 and s 4 .
Input State
0
So
Si Si
1
s2
Si
s3 s4
S5 S4 S5
s2
S3
s4 s4 s4 s4
(5 marks)
s4
S5
b)
Construct a deterministic finite-state automaton that recognizes any input string that contains either all 1s or all Os. (6 marks)
CONFIDENTIAL
CONFIDENTIAL QUESTION 7 a)
CS/JAN 2012/CSC510/ITC430
Study the grammar given below and answer the following questions. G = { V , T , S , P } with Vocabulary, v = { a , b , s , A } , Terminals, T = { a , b , } , Starting symbol, s, and
{0,1}.
S l := s i + s 2 ; 52 : = S2 + S 3 ; 53 : = S3 + 6 ; i : = i +1 ; {sl= i3 ; s2=(i+l)3 i3 ; s 3 = 6* ( i + 1) }
(7 marks)
CONFIDENTIAL
CONFIDENTIAL
CS/JAN 2012/CSC510/ITC430
b)
show that a = dq + r is the loop invariant. (4 marks) c) Proof the correctness of the program segment if x < 0 then x:= 0 with respect to the precondition { } and the postcondition x 0. (5 marks)
CONFIDENTIAL