D-Final New M131Full

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 21

1

M131 Final Revision

Table of Contents

Relations Revision ......................................................................................................................................... 2


Graph and tree revision ....................................................................................................................................6
MTA Questions in Final Exam: .....................................................................................................................15

Kuwait – Salmiya – Salem Al-Mubarak St. North Salmiya Market Complex 2nd floor.
 (965) 2572 6686 - 2571 4343  (965) 2571 0775  info@qeati.com
2

Relations Revision
Q1 : Let R and S be relations on the set { 1,2,3,4} given by :
R = {(1,1),(1,3),(2,1),(2,4),(3,1),(3,3),(4,2)}
S = {(1,1),(1,2),(2,1),(3,3),(3,4),(4,1)}
(a) Represent R and S by two matrices M R and M S . (4 marks)
1 0 1 0 1 1 0 0
   
M R  1 0 0 1  , M  1 0 0 0

1 0 1 0 S 0 0

1 1
0 1 0 0 1 0 0 0

(b) Decide whether relation R is symmetric , antisymmetric , reflexive or transitive. (4marks)


R is not symmetric since (2,1)  R but (1,2)  R ,

it is not anti symmetric since (1,3) (3,1)  R and 1  3 ,


it is not reflexive since (2,2) , (4,4)  R ,
it is not transitive since (2,4) and (4,2)  R but (2,2)  R .

(c) Find the matrices that represent the relations : (6marks)

(i) R  S (ii) R  S (iii) S R


1 0 1 0 1

1 1 
0 0 
1 1 1
 1 , M 1 0  0
M RS  1 0 0  
0 0
M SoR  1 1 0
1 0 1 1 RS 0 0 1 0 1 1 1 1
     
1 1 0 0 0 0 0 0 1 0 0 0

ii. 2, 3 are minimal and 9, 12, 16 are maximal

iii. 4 is the glb and 8 is the lub

b) R2= R°R={(x,x),(y,x),(z,x),(w,y)}

R-1= { (x,x),(x,y),(y,z),(z,w)}

Kuwait – Salmiya – Salem Al-Mubarak St. North Salmiya Market Complex 2nd floor.
 (965) 2572 6686 - 2571 4343  (965) 2571 0775  info@qeati.com
3

Kuwait – Salmiya – Salem Al-Mubarak St. North Salmiya Market Complex 2nd floor.
 (965) 2572 6686 - 2571 4343  (965) 2571 0775  info@qeati.com
4

. Q–3 a (5 marks) Consider the set A= {1,2,3,6,12,24,36,48}.


(i) Draw the Hasse Diagram of the poset (A,|)

(ii) Find the maximal and minimal elements.


Maximal elements: 36 and 48
Minimal element: 1
(iii) Find the least and greatest element if any.
1 is the least element
No greatest element
(iv) Find the greatest lower bound and least upper bound of the subset {1,2,3}.
Upper bounds={6,12,24,36,48}
Lowerbounds={1}
Glb=1
Lub=6

Kuwait – Salmiya – Salem Al-Mubarak St. North Salmiya Market Complex 2nd floor.
 (965) 2572 6686 - 2571 4343  (965) 2571 0775  info@qeati.com
5

Kuwait – Salmiya – Salem Al-Mubarak St. North Salmiya Market Complex 2nd floor.
 (965) 2572 6686 - 2571 4343  (965) 2571 0775  info@qeati.com
6

Graph and tree revision

Kuwait – Salmiya – Salem Al-Mubarak St. North Salmiya Market Complex 2nd floor.
 (965) 2572 6686 - 2571 4343  (965) 2571 0775  info@qeati.com
7

Q: let G is a graph
(a) Represent G by an incidence matrix. ( 5 points)
1 1 0 0 0 0 
 
Incidence matrix I = 1 0 1 1 0 0
0 0 0 0 1 1 
 
0 1 1 0 1 0 
0 0 0 1 0 1 
 
(b) Represent G by an adjacency matrix (5 points)
0 1 0 1 0
Adjacency matrix : A = 1 0 0 1 1 
 
0 0 0 1 1

1 1 1 0 0
0 1 1 0 0

(c) Write an adjacency list that represents G. Assuming vertices are written in alphabetical order (4 points)

Vertix a b c d e
Adjacent Vertices b,d a,d,e d,e a,b,c b,c

(d) Use the adjacency matrix to find number of paths of length 2 from a to each of c,d and e . (6 points )
These are the entries (1,3) , (1,4) and (1,5) in A2 first row of A2  [ 2 1 1 1 1]So they are all of length 1

Kuwait – Salmiya – Salem Al-Mubarak St. North Salmiya Market Complex 2nd floor.
 (965) 2572 6686 - 2571 4343  (965) 2571 0775  info@qeati.com
8

1 0 0 1 1 0
 
0 1 1 0 0 1
Q-5: Let A  1 0 0 0 0 0 be the incidence matrix of a graph G.
 
0 1 1 0 1 0
0 0 0 1 0 1 

(a) ( 5 points ) Draw the graph of G .
V V
1 2

e2
e4
e3 e6
e1
e5

V3 V V
4 5

(b) ( 5 points ) Write the adjacency matrix of G .


0 0 1 1 1
0 0 0 1 1 

Adjacency matrix= 1 0 0 0 0
 
1 1 0 0 0
1 1 0 0 0 
(c) ( 4 points ) How many edges are there in a graph with 9 vertices each of
degree 6?
Let n= the number of edges.The sum of the degrees of vertices=2n=9*6=54.Hence n=27.
(d) Determine the number of edges and vertices in :
(i) (3 points ) The complete graph K9
(ii) (3 points ) The complete bipartite graph K3,7
(i) It has 9 vertices and 9(9-1)/2= 36 edges.
(ii) It has 3+7 =10 vertices and 3*7=21 edges.

Kuwait – Salmiya – Salem Al-Mubarak St. North Salmiya Market Complex 2nd floor.
 (965) 2572 6686 - 2571 4343  (965) 2571 0775  info@qeati.com
9

Q–4 Let A be the incidence matrix of a graph G.


1 0 1 0 0 0
0 0 0 1 1 1
A=  
1 1 0 1 0 0
 
0 0 1 0 1 0
(i) (3 marks) Draw the graph G.
æ 0 0 1 1 ö
(ii)(4 marks) Find the adjacency matrix of G. ç ÷
ç 0 1 1 1 ÷
ç 1 1 1 0 ÷
ç ÷
è 1 1 0 0 ø

Kuwait – Salmiya – Salem Al-Mubarak St. North Salmiya Market Complex 2nd floor.
 (965) 2572 6686 - 2571 4343  (965) 2571 0775  info@qeati.com
10

Q_5
(a) (4 points) Let G be a graph with 9 edges such that every vertex of G has degree 3.
Find the number of vertices of G.
Let n be the number of vertices of G.The sum of the degrees of vertices = 2 (number of
edges) .Thus 3n = 18  n = 6

(b) ( 3 points each ) How many edges and how many vertices does each of the following
graphs has ?
(i) K7 (ii) K5,7
(i) K7 has 7 vertices and 7(7 1)  21 edges
2
(ii) K5,7 has (5 +7 ) =12 vertices and 5*7=35 edges.

(c) Let G be the graph below :

(i) ( 5 points) Find the incidence matrix of G.


1 1 0 0 0 0 
 
1 0 1 1 0 0 
 0 0 0 1 1 0 
 
0 0 0 0 1 1 
0 1 1 0 0 1 
 
(ii) (5 points) Find the adjacency matrix of G.
0  1  0  0  1
1  0  1  0  1 
 
= 0  1  0  1  0 
 
0  0  1  0  1
1  1  0  1  0 

Kuwait – Salmiya – Salem Al-Mubarak St. North Salmiya Market Complex 2nd floor.
 (965) 2572 6686 - 2571 4343  (965) 2571 0775  info@qeati.com
11

Kuwait – Salmiya – Salem Al-Mubarak St. North Salmiya Market Complex 2nd floor.
 (965) 2572 6686 - 2571 4343  (965) 2571 0775  info@qeati.com
12

Q– 5.
(a) (6 marks)
(i) Represent the expression x  y   x  4 / 3 in a binary tree.
2

(ii) Is the tree balanced? Justify.


Yes the tree is balanced since all leaves are at last two levels (h and h -1 i.e. 2 and 3)

(i)Find the prefix and postfix notation of the above expression.

Prefix: +^+xy2/-x43
Postfix: xy+2^x4-3/+

(b) (4 marks) Consider the prefix code represented by the binary tree below:

(i) Encode the word “student”.


1100 1101 1111 000 001 01 1101
(ii) Decode the bit string 010011101
NET

Kuwait – Salmiya – Salem Al-Mubarak St. North Salmiya Market Complex 2nd floor.
 (965) 2572 6686 - 2571 4343  (965) 2571 0775  info@qeati.com
13

Kuwait – Salmiya – Salem Al-Mubarak St. North Salmiya Market Complex 2nd floor.
 (965) 2572 6686 - 2571 4343  (965) 2571 0775  info@qeati.com
14

Q–5:
1 1 1 0
1 0 0 1
a) [3+2 Marks] Let A    be the adjacency matrix of a graph G = (V, E),
1 0 0 1
 
0 1 1 0
V = {a, b, c, d}.
i. Draw G.

ii. Find the incidence matrix of G.


1 1 1 0 0
0 1 0 1 0 

0 0 1 0 1
 
0 0 0 1 1
b) [3+2 Marks] Consider the binary search tree that results when the following words
are inserted in the order given, using alphabetical ordering: STOP, LET, THERE,
TAPE, NONE, YOU, ANT, NINE, OAT, NUT.
i. Draw the tree.

ii. Write the in-order traversal of that tree.


ANT, LET, NINE, NONE, NUT, OAT, STOP, TAPE, THERE, YOU.

Kuwait – Salmiya – Salem Al-Mubarak St. North Salmiya Market Complex 2nd floor.
 (965) 2572 6686 - 2571 4343  (965) 2571 0775  info@qeati.com
15

MTA Questions in Final Exam:

(Q1) The negation of p  q is :


(a)p  q (b)p q (c)p  q (d ) p q (e)none
(Q2) The contrapositive of p  (q  r ) is:
(a)p (q  r) (b)(q r) p (c)(q  r)  p (d ) p (q  r ) (e)none

(Q4) The quotient q and remainder r when 4180 is divided by 245 are :
(a) q = 15 , r = 17 (b) q = 18 , r = 3 (c) q = 17 , r = 15 (d) q = 17 , r = 13

(Q5) The binary notation for the number 43 in decimal notation is :


(a) 110 001 (b) 101011 (c) 101001 (d) 11 00 11 (e) none

(Q6) -17 mod 3 = :


(a) -1 (b) 3 (c) 1 (d) 0 (e) none
(Q7) If degrees of the vertices of a graph G are 7 , 5 , 3 , 2 , 2 , 1 then number of edges of G are :
(a) 20 (b) 10 (c) 12 (d) 15 (e) none

(Q8) If A = { 1,2,6,7,10 } and B = { 3,4,6,7,9 } Then B-A is :


(a) { 1,2,10 } (b) {3,4,6,7,9,10} (c) {3,4,6,7} (d){3,4,9}

Kuwait – Salmiya – Salem Al-Mubarak St. North Salmiya Market Complex 2nd floor.
 (965) 2572 6686 - 2571 4343  (965) 2571 0775  info@qeati.com
16

Q1 (a) Determine the truth value of (r  s)  (r s) when:


(i) both r and s are true. (4points)
(ii) r is true and s is false. (4points)
(i) If r and s are true then (r  s) is true but (r  s) is false hence the statement is false.
(r  s) and (r  s) are true, hence statement is true
(ii) Here both
(b) For the statement “if x  y then x = 3y” .Write: (3 points each)
(i) the converse (ii) the contrapositive .
(i) converse “if x = 3y then x > y ” (ii) contrapositive “ if
x  3 y then x  y

(c) Suppose that P(x) is statement “(x-2)(x-3)<0” where domain is set of integers . Determine truth

value of : (i) xP( x) (ii) xP( x) .


(x-2)(x-3)<0 iff 2 < x < 3 There is no integer in (2,3) hence statement (i) is false and statement (ii) is true

Kuwait – Salmiya – Salem Al-Mubarak St. North Salmiya Market Complex 2nd floor.
 (965) 2572 6686 - 2571 4343  (965) 2571 0775  info@qeati.com
17

Q2 (a) ( 5 points) Find a,b and c if : a = 40 div 7 2b+c = 15 mod 7 b+2c = 17 mod 9
a = 40 div 7 = 5
15 mod 7 =1 and 17 mod 9 = 8
2b+c = 1 and b+2c = 8 gives b = -2 , c = 5

b) Using prime factorization decide whether the number 173 is prime or not .
173 14. Prime numbers less than 14 are 2,3,5,7,11,13 and 173 is not divisible by any of them .
Hence 173 is prime

c)Write the prime factorization of 89100 and 277200 and hence find their GCD and LCM .
89100  22.34.52.11 277200  24.32.52.7.11
LCM =  2 .3 .5 .7.11  2506800
4 4 2

GCD  2 .3 .5 .11  9900


2 2 2

(d) (i) Convert 101010101 from binary to decimal notation.


(ii) Convert the number (713)8 from base 8 to decimal.
(i) (101010101)2 1 4 16  64  256  (341)10
(ii) (713)8  3 1.8  7.82  (459)10

Q3 (a) (6 points) Use the set builder notation to describe the sets
A = { 0 , 3 , 6 , 9 , 12 , 15 } A  {3n : 0  n  5, n integer}

B = { 1 , 4 , 9 , 16 , 25 , …} B  {n2 : n  0, n Integer}

C={a,b,d,o,y} C = { x : x is a letter in “bad boy”}


(b) Let universal set is U ={1,2 ,3 ,4 ,5 ,6 ,7, 8,9,10}. Express each of sets below with bit strings:
(i) A = {1, 3, 5, 7, 9}. (ii) B = {1, 4, 6, 7, 8, 10} (iii) A-B
(i) A = 1010101010 (ii) B = 1001011101 (iii) A-B = 0010100010

(c) If A-B = {1 , 3 , 5 , 6} , B-A = {8 , 9 ,10} and A  B  {2,4,7} :


(i) Find the sets A and B .
A  (A  B )  (A  B )  {1,2,3,4,5,6,7}
B  (B  A)  ( A  B)  {2,4,7,8,9,10}
(ii) Write down the power set of A B .
(ii) P (A  B )  { ,2,4,7,{2,4},{2,7},{4,7},{2,4,7}}

Kuwait – Salmiya – Salem Al-Mubarak St. North Salmiya Market Complex 2nd floor.
 (965) 2572 6686 - 2571 4343  (965) 2571 0775  info@qeati.com
18

Kuwait – Salmiya – Salem Al-Mubarak St. North Salmiya Market Complex 2nd floor.
 (965) 2572 6686 - 2571 4343  (965) 2571 0775  info@qeati.com
19

Kuwait – Salmiya – Salem Al-Mubarak St. North Salmiya Market Complex 2nd floor.
 (965) 2572 6686 - 2571 4343  (965) 2571 0775  info@qeati.com
20

Kuwait – Salmiya – Salem Al-Mubarak St. North Salmiya Market Complex 2nd floor.
 (965) 2572 6686 - 2571 4343  (965) 2571 0775  info@qeati.com
21

Complete Graphs:
Kn , is a simple graph with n nodes in which every node is adjacent to every other node:
Note that Kn has n vertices and edges e = n(n-1)/2

Complete graphs: Kn
Complete bipartite graphs: Km,n

Kuwait – Salmiya – Salem Al-Mubarak St. North Salmiya Market Complex 2nd floor.
 (965) 2572 6686 - 2571 4343  (965) 2571 0775  info@qeati.com

You might also like