1
UJIAN AKHIR SEMESTER SEMESTER GASAL 2018/2019
Program Sarjana - Departemen Sistem Informasi Fakultas Teknologi Informasi dan Komunikasi Institut Teknologi Sepuluh Nopember
Kampus ITS Sukolilo, Surabaya 60111. 031 – 5999944
MATAKULIAH : Logika dan Struktur Diskrit KELAS : A, B, C, D Dosen : Ahmad Muklason, Eko Wahyu Tyas D. Sifat : TERTUTUP Durasi Waktu
Pelaksanaan : 120 Menit Hari/Tanggal : Senin, 10 Des 2018
MARKING SCHEME
Instruction: answer ALL the questions, complete each answer with a brief justification.
For question 1 and 2:
Some sets are defined as follows: A = {1, 3, 3, 3, 5, 5, 5, 5, 5}; B = {8, 4, 6}; C = {1, 3, 5}; D = {a, b, c, d, e}, E = {10, 9, h, i, j}, F = {j, i, h} and the universe consists of integer 1-10 and alphabets a-j.
1. [MARK 10] Answer the following questions:
a) |A| = b) B x D =
c) Power set of E = d) is C proper subset of A?
e) is F subset of E?
ANSWER:
a) 3 (Since duplication is not allowed)
b) {(8,a), (8,b), (8,c), (8,d), (8,e), (4,a), (4,b), (4,c), (4,d), (4,e), (6,a), (6,b), (6,c), (6,d), (6,e)}
c) 25 = 32 d) No e) Yes
MARKING SCHEME:
Each correct answer with/without a brief justification counts 2 points.
2. [MARK 10] Determine the member of the following set operations:
a) A ⊕ C b) Bc  Ec c) ~ ((E  F)  D) d) ((A - F)  D) – (B  C) e) Ec ⊕ Bc
ANSWER:
a) 
b) Bc = {1, 2, 3, 5, 7, 9, 10, a, b, c, d, e, f, g, h, i, j}
Ec = {1, 2, 3, 4, 5, 6, 7, 8, a, b, c, d, e, f, g}
Bc  Ec = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, a, b, c, d, e, f, g, h, i, j} = Universal set c) (E  F) = {h, i, j}
((E  F)  D) = {a, b, c, d, e, h, i, j}
~ ((E  F)  D) = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, f, g}
d) (A - F) = {1, 3, 5}
((A - F)  D) = {1, 3, 5, a, b, c, d, e}
2
(B  C) = 
((A - F)  D) – (B  C) = {1, 3, 5, a, b, c, d, e}
e) Ec = {1, 2, 3, 4, 5, 6, 7, 8, a, b, c, d, e, f, g}
Bc = {1, 2, 3, 5, 7, 9, 10, a, b, c, d, e, f, g, h, i, j}
Ec ⊕ Bc = {4, 6, 8, 9, 10, h, i, j}
MARKING SCHEME:
Each correct answer with/without a brief justification counts 2 points.
3. [MARK 10] Find each of these values.
a) (−133 mod 23 + 261 mod 23) mod 23
b) 80 hours before it reads 11:00 on a 12-hour clock.
c) a ≡ 24 (mod 31) and −15 ≤ a ≤ 15. What is a?
d) Positive integers less than 30 that are relatively prime to 30.
e) The number of positive integers between 50 and 100 that are divisible by 7.
ANSWER:
a) (−133 mod 23 + 261 mod 23) mod 23 = (5 + 8) mod 23 = 13.
b) 11 – (80 mod 12) = 11 – 8 = 3, so the clock reads 3:00.
c) a ≡ 24 (mod 31) and −15 ≤ a ≤ 15, since 24 is too large to satisfy the inequality, we
subtract 31 and obtain the answer is -7.
d) The prime factors of 30 are 2, 3, and 5. Thus we are looking for positive integers less than 30 that have none of these as prime factors. Since the smallest prime number other than these is 7, and 72 is already greater than 30, in fact only primes (and the number 1) will satisfy this condition.
Therefore, the answer is 1, 7, 11, 13, 17, 19, 23, and 29.
e) There are integers less than 100 that are divisible by 7, and of them are less than 50 as well. This leaves 14 - 7 = 7 numbers between 50 and 100 that are divisible by 7.
They are 56, 63, 70, 77, 84, 91, and 98.
MARKING SCHEME:
Each correct answer with a brief justification counts 2 points.
Each correct answer without a brief justification counts 1.5 points.
4. [MARK 10] In how many ways can a photographer at a wedding arrange six people in a row, including the bride and groom, if
a) the bride must be next to the groom?
b) the bride is not next to the groom?
ANSWER:
a) Here is a good way (but certainly not the only way) to approach this problem. Since the bride and groom must stand next to each other, let us treat them as one unit. Then the question asks for the number of ways to arrange five units in a row (the bride-and-groom unit and the four other people). We can think of filling five positions one at a time, so by the product rule there are 5 · 4 · 3 · 2 · 1 = 120 ways to make these choices. This is not quite the answer, however, since there are also two ways to decide on which side of the groom the bride will stand. Therefore, the final answer is 120 · 2 = 240 ways.
b) There are clearly 6 · 5 · 4 · 3 · 2 · 1 = 720 arrangements in all. We just determined in part (a) that 240 of them involve the bride standing next to the groom. Therefore, there are 720 - 240 = 480 ways to arrange the people with the bride not standing next to the groom.
MARKING SCHEME:
Each correct answer with a brief justification counts 5 points.
Each correct answer without a brief justification counts 3 points.
5. [MARK 10] By using induction, prove that 3n−1 is an even number for n = 1, 2, ...
3
ANSWER:
Step 1: Basis Step:
We prove that is correct for the smallest value of n, i.e. 1, we get 3n – 1 = 31-1 = 3-1 = 2. Since 2 is an even number, it is true (proven) that for n=1, 3n – 1 is an even number.
Step 2: Hypothesis Step:
We assume that it is correct for integer k.
So, we assume that 3k-1 is an even number.
Step 3: Inductive Step
We prove that, given the assumption on step 2, it also true for k+1.
We get 3k+1 – 1 = 3 x 3k – 1 = = (2+1) x 3k – 1 = 2 x 3k + 3k-1.
Since 2 x 3k is for sure, an even number and 3k-1 is also an even number as assumed in Step 2, so it is clear that 3k+1 – 1 is also an even number.
MARKING SCHEME:
Step 1 counts for 2 marks Step 2 counts for 2 marks Step 3 counts for 6 marks
6. [MARK 10] What is the value of z, from the following equation:
ANSWER
The looping can be illustrated as follow:
x y x+y z
2 4 6 6
2 5 7 13
3 5 8 21
3 6 9 30
4 6 10 40
4 7 11 51
So, we get the final value of z is 51 MARKING SCHEME
Correct answer without justification (the table) counts for 4 marks.
Correct answer with correct justification (the table) counts for 10 marks.
Wrong answer with partially correct justification (the table): each correct step counts for 1 mark.
7. [MARK 10] If a recursive algorithm is defined as follow:
RR (input: x, an integer) if x=1 return 1 if x=0 return 2
else return x + RR (x mod 2) + RR (x div 2) What is the value of z= RR (10)- RR (5)?
ANSWER
(Step 1)
RR (5) = 5 + RR (5 mod 2) + RR (5 div 2) = 5 + RR (1) + RR (2) = 5 + 1 + RR (2) = 5 + 1 + 2 + RR (2 mod 2) + RR (2 div 2) = 5 + 1 + 2 + RR (0) + RR (1) = 5 + 1 + 2 + 2 + 1 = 11
(Step 2)
RR (10) = 10 + RR (10 mod 2) + RR (10 div 2) = 10 + RR (0) + RR (5) = 10 + 2 + 11 = 23
4
(Step 3)
RR (10) – RR (5) = 23 – 11 = 12
MARKING SCHEME
Correct answer with correct justification counts for 10 marks Correct answer without justification count for 2 marks Wrong answer with partially correct justification:
Step 1 counts for 5 marks Step 2 counts for 3 marks Step 3 counts for 2 marks
8. [MARK 20] A relation R is defined on set S = {2, 4, 6, 7, 8, 9} as follow:
R= {(a, b) | b = 2a)}
a) R= {(a, b) | a ≥ b and a ≤ b}
b) R= {(a, b) | b ≥ a and (b mod a) = 1}
c) R= {(2,2), (2,7), (7,9), (2,9)}
Suppose a 6-bit string defined the relation properties: Reflexive, Irreflexive, Symmetric, Asymmetric, Antisymmetric, Transitive respectively (1 for yes and 0 for no). What is the bit string for each of the above-mentioned relations? (an example answers for point a is 100001, it indicates that the relation has property: Reflexive and Transitive)
ANSWER
a. R = {(2, 4), (4,8)}
R I S As An T
0 1 0 1 1 0
b. R = {(2,2), (4,4), (6,6), (7,7), (8,8), (9,9)}
R I S As An T
1 0 1 0 1 1
c. R = {(2,7), (2,9), (4,9), (6,7), (7,8), (8,9)}
R I S As An T
0 1 0 1 1 0
d. R = {(2,2), (2,7), (7,9), (2,9)}
R I S As An T
0 0 0 0 1 1
MARKING SCHEME
Each point (a-d) counts for 5 marks
In each point, for each wrong item (R, I, … T) substract 1 mark.
9. [MARK 20] Suppose the ticket price (in hundred thousand rupiah) by Emprit Air is shown by the following matrix:
f/t C D E F G
C 0 4 2 3 12
D 0 0 2 2 0
E 2 1 0 1 0
F 4 2 0 0 2
G 1 2 4 0 0
The original city is represented by rows and the destination is represented by column. The value ‘0’
indicates there is no direct flight between the two cities. For example, the ticket price from city C to D is Rp. 400.000, there is no direct flight from city D to C, D to E is Rp. 200.000, E to D is Rp. 100.000. Solve the
5
a) Draw the directed graph representing the above matrix.
b) Intuitively, without using any algorithm, if Mbah Poinem want to travel from cities C to G, which one is the best (cheapest) route she should choose? How much is it?
c) Intuitively, without using any algorithm, if Yu Painten from city C have to travel to other cities exactly one then returns back to city C, which one is the best (cheapest) route she should choose? How much is it? (an example of valid route: C-D-E-F-G-C with cost = 4+2+1+2+1 = 10 = Rp. 1.000.000).
ANSWER
a) The graph should show like this:
b) From C-G, there are some alternative:
1) C-G (cost: 12) 2) C-F-G (cost: 5) 3) C-E-G (cost: 6) 4) C-E-F-G (cost: 5) 5) C-D-E-G (cost: 10) 6) C-D-E-F-G (cost: 9)
So, the cheapest route is C-F-G and C-E-F-G which cost: Rp. 500.000
c) The cheapest route will be: C-E-D-F-G-C with cost (2+1+2+2+1) = Rp. 800.000.
6
MARKING SCHEME:
a. Correct graph counts for 6 marks (deduct evenly for partially correct graph).
b. Correct answer with correct justification (can show two alternatives) counts for 6 marks.
5 marks if can only show one alternative.
c. Any correct route with cheapest cost counts for 8 marks.