0% found this document useful (0 votes)
78 views12 pages

cs1231s Exam21s2 Qns

This document contains an assessment paper for the course CS1231S Discrete Structures. The paper has 21 questions across multiple choice, multiple response, and proof questions. It covers topics like logic, sets, functions, relations, and discrete math.

Uploaded by

mig foo
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)
78 views12 pages

cs1231s Exam21s2 Qns

This document contains an assessment paper for the course CS1231S Discrete Structures. The paper has 21 questions across multiple choice, multiple response, and proof questions. It covers topics like logic, sets, functions, relations, and discrete math.

Uploaded by

mig foo
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/ 12

CS1231S

NATIONAL UNIVERSITY OF SINGAPORE

CS1231S – DISCRETE STRUCTURES


(Semester 2: AY2021/22)

Time Allowed: 2 Hours

INSTRUCTIONS
1. This assessment paper contains TWENTY ONE (21) questions in THREE (3) parts and comprises
TWELVE (12) printed pages. The last two pages are intentionally left blank.
2. This is an OPEN BOOK assessment.
3. Printed/written materials are allowed. Apart from calculators, electronic devices are not
allowed.
4. Answer ALL questions and write your answers only on the ANSWER SHEETS provided.
5. Do not write your name on the ANSWER SHEETS.
6. The maximum mark of this assessment is 100.
Question Max. mark
Part A: Q1 – 10 20
Part B: Q11 – 16 18
Part C: Q17 5
Part C: Q18 10
Part C: Q19 20
Part C: Q20 20
Part C: Q21 7
Total 100

——— END OF INSTRUCTIONS ———


CS1231S
Part A: Multiple Choice Questions [Total: 10×2 = 20 marks]
Each multiple choice question (MCQ) is worth TWO marks and has exactly one correct answer.

1. Which answer in this list is the correct answer to this question?


A. All of the below.
B. None of the below.
C. All of the above.
D. One of the above.
E. None of the above.
F. None of the above.

2. Aiken is taking the CS1231S final exam which consists of the dreadful MRQs (multiple-response
questions). If each MRQ has 5 options A, B, C, D and E, in how many ways can Aiken write his
answer for each MRQ, assuming that he writes at least one option in his answer. Note that the
order of the options in his answer does not matter, for example, ABC, ACB and BCA are considered
the same answer.
A. 31.
B. 32.
C. 325.
D. 3125.
E. None of the above.

3. Which of the following statements is true?


A. (𝑝 ∧ 𝑞) → 𝑟 ≡ (𝑝 → 𝑟) ∧ (𝑞 → 𝑟)
B. (𝑝 ∨ 𝑞) → 𝑟 ≡ (𝑝 → 𝑟) ∨ (𝑞 → 𝑟)
C. 𝑝 ∧ (𝑞 → 𝑟) ≡ (𝑝 ∧ 𝑞) → (𝑝 ∧ 𝑟)
D. 𝑝 ∨ (𝑞 → 𝑟) ≡ (𝑝 ∨ 𝑞) → (𝑝 ∨ 𝑟)
E. None of the above.

4. Given that ∀𝑥 ∃𝑦 𝑃(𝑥, 𝑦) is true on a non-empty domain of discourse, which of the following
statements is true?
A. ∃𝑦 ∀𝑥 𝑃(𝑥, 𝑦)
B. ∃𝑥 ∃𝑦 𝑃(𝑥, 𝑦)
C. ∀𝑥 ∀𝑦 𝑃(𝑥, 𝑦)
D. ∃𝑥 ∀𝑦 ~𝑃(𝑥, 𝑦)
E. None of the above.

- 2 of 12 -
CS1231S
5. Define a set 𝑆 recursively as follows.
(1) 5 ∈ 𝑆. (base clause)
(2) If 𝑥 ∈ 𝑆, then 𝑥 + 3 ∈ 𝑆 and 𝑥 + 5 ∈ 𝑆. (recursion clause)
(3) Membership for 𝑆 can always be demonstrated by (finitely many)
successive applications of clauses above. (minimality clause)
What is the smallest integer 𝑘 such that all integers 𝑛 ≥ 𝑘 are in 𝑆?
A. 7.
B. 8.
C. 9.
D. 10.
E. None of the above.

6. Given the set 𝐴 = {1,2,3,4,5} and bijection 𝑓: 𝐴 → 𝐴 as follows:


𝑓 = {(1,3), (2,4), (3,5), (4,1), (5,2)}.
What is the order of 𝑓 ∘ 𝑓?
A. 2
B. 3
C. 4
D. 5
E. None of the above.

7. Let 𝑆 = {♢, ♣, ♡, ♠}, 𝑉 = {A, 2,3,4,5,6,7,8,9,10, J, Q, K},


and 𝐵 = {(♠, A), (♡, 7), (♣, 9), (♠, 6), (♢, J)}.
Which of the following sets contains 𝐵 as an element? (Note: 𝒫(𝑋) denotes the power set of 𝑋).
A. 𝑆×𝑉
B. 𝑆∪𝑉
C. 𝒫(𝑆 × 𝑉)
D. 𝒫(𝑆 ∪ 𝑉)
E. None of the above.

- 3 of 12 -
CS1231S
8. Given 𝐴 = {1,2,3,4,5} and the partial order 𝑅 on 𝐴 as follows:
𝑅 = {(𝑥, 𝑥) ∶ 𝑥 ∈ 𝐴} ∪ {(2,1), (2,5), (3,1), (3,2), (3,4), (3,5), (4,1)}
How many distinct linearizations of 𝑅 are there?
A. 3
B. 5
C. 7
D. 12
E. None of the above.

9. Aiken working on a problem from circuit design came up with a graph G, while Dueet working on
a problem from computational biology came up with a graph G*. When they met for dinner, they
were surprised to find that that G and G* are isomorphic. Aiken’s graph G has 6 connected
components.
How many connected components are there in G*?
A. G* has at most 6 connected components.
B. G* has at least 6 connected components.
C. G* has at exactly 6 connected components.
D. G* does not have exactly 6 connected components.
E. There is insufficient information to determine.

10. Given the following directed graph 𝐺 = (𝑉, 𝐸), how many walks of length 3 in total are there
between 𝑢 and 𝑤, ∀𝑢, 𝑤 ∈ 𝑉?

a b

c d

A. 8.
B. 20.
C. 22.
D. 24.
E. 25.

- 4 of 12 -
CS1231S
Part B: Multiple Response Questions [Total: 6×3 = 18 marks]
Each multiple response question (MRQ) is worth THREE marks and may have one answer or multiple
answers. Write out all correct answers. For example, if you think that A, B, C are the correct answers,
write A, B, C.
Only if you get all the answers correct will you be awarded three marks. No partial credit will be given
for partially correct answers.

11. Which of the following have the same answer?


A. Number of subsets of {1,2,3,4,5,6,7,8,9,10} with cardinality 4.
B. Number of ways to choose 6 out of 10 persons.
C. Number of ways to arrange 6 persons around a round table.
D. Number of solutions to the equation 𝑥1 + 𝑥2 + 𝑥3 + 𝑥4 + 𝑥5 = 6 where 𝑥𝑖 ∈ ℕ.
E. Number of permutations of ICANDOIT.

12. Given 𝐴 = {1,2,3,4,5} and the partial order 𝑅 on 𝐴 as follows:


𝑅 = {(𝑥, 𝑥) ∶ 𝑥 ∈ 𝐴} ∪ {(2,1), (2,5), (3,1), (3,2), (3,4), (3,5), (4,1)}
(This is the same partial order in Question 8.)
Which of the following statements is/are true with respect to this partial order?
A. 1 is a minimal element.
B. 1 is a maximal element.
C. 4 and 5 are non-comparable.
D. 3 is a smallest element.
E. 5 is a largest element.

13. Given the equivalence relation ~ on ℤ2 defined by


(𝑎, 𝑏) ~ (𝑐, 𝑑) ⇔ 3|(𝑎 − 𝑐) ∧ 2|(𝑏 − 𝑑).
Which of the following is/are equivalence classes under this relation?
A. {(𝑥, 𝑦) ∈ ℤ2 ∶ 𝑥, 𝑦 ∈ ℤ}
B. {(𝑥, 𝑦) ∈ ℤ2 ∶ 3𝑥, 2𝑦 ∈ ℤ}
C. {(𝑥, 𝑦) ∈ ℤ2 ∶ 𝑥 = 3𝑘 − 1, 𝑦 = 2𝑚 where 𝑘, 𝑚 ∈ ℤ}
D. {(𝑥, 𝑦) ∈ ℤ2 ∶ 𝑥 = 2𝑘, 𝑦 = 3𝑚 where 𝑘, 𝑚 ∈ ℤ}
E. {(𝑥, 𝑦) ∈ ℤ2 ∶ 𝑥 = 3𝑘 + 4, 𝑦 = 2𝑚 + 3 where 𝑘, 𝑚 ∈ ℤ}

- 5 of 12 -
CS1231S
14. Suppose 𝑓 and 𝑔 are functions, which of the following statements is/are true?
A. If 𝑓 and 𝑔 are injective, then 𝑔 ∘ 𝑓 is injective.
B. If 𝑓 and 𝑔 are surjective, then 𝑔 ∘ 𝑓 is surjective.
C. If 𝑓 and 𝑔 are bijective, then 𝑔 ∘ 𝑓 is bijective.
D. If 𝑔 ∘ 𝑓 is bijective, then 𝑓 and 𝑔 are bijective.
E. If 𝑔 ∘ 𝑓 is not bijective, then 𝑓 and 𝑔 are not bijective.

15. Which of the following sets is/are countable?


A. The set 𝐴 of all points in the plane with rational coordinates.
B. The set 𝐵 of all infinite sequences of integers.
C. The set 𝐶 of all functions 𝑓: {0,1} → ℕ.
D. The set 𝐷 of all functions 𝑓: ℕ → {0,1}.
E. The set 𝐸 of all 2-element subsets of ℕ.

16. The following are the pre-order traversal and post-order traversal of a binary tree:
Pre-order: U C N A D O I T 
Post-order: N C D I  T O A U
Which of the following is/are possible in-order traversals of this tree?
A. CNUDAIO!T
B. CNUDAIOT!
C. NCUDAIOT!
D. NCUDAI!OT
E. None of the above.

- 6 of 12 -
CS1231S
Part C: There are 5 questions in this part [Total: 62 marks]
17. Prove by mathematical induction: 𝟕 | (𝟓𝟐𝒏+𝟏 + 𝟐𝟐𝒏+𝟏 ) for all 𝑛 ∈ ℕ. [Total: 5 marks]

18. [Total: 10 marks]


(a) For each of the following functions, indicate whether it is injective and whether it is surjective.
Write True or False on the Answer Sheets. You do not need to prove or disprove it. [6 marks]
(i) 𝑓: ℕ → ℕ defined by 𝑓(𝑛) = 𝑛 + 1.
(ii) 𝑓: [3, ∞) → [7, ∞) defined by 𝑓(𝑥) = (𝑥 − 3)2 + 7.
(iii) 𝑓: ℤ+ → ℚ defined by 𝑓(𝑛) = 1/𝑛.
(b) Let ≼ be a partial order on a set 𝑆. A subset 𝐶 of 𝑆 is called a chain if and only if each pair of
elements in 𝐶 is comparable, that is, ∀𝑎, 𝑏 ∈ 𝐶 (𝑎 ≼ 𝑏 ∨ 𝑏 ≼ 𝑎). A maximal chain is a chain 𝑀
such that 𝑡 ∉ 𝑀 ⇒ 𝑀 ∪ {𝑡} is not a chain.
Given a finite set 𝑆 with cardinality 𝑛, what is the maximum number of maximal chains that a
partial order on 𝑆 can have? Explain your answer. (Answer without explanation will not receive
any credit.) [2 marks]
(c) Let ≼ be a partial order on a set 𝑆. An antichain is a subset of 𝑆 such that no two elements in it
are comparable under ≼. A maximal antichain is an antichain that is not a proper subset of any
other antichain.
Let 𝐷𝑛 be the set of positive divisors of integer 𝑛. Given a partial order on 𝐷30 under divisibility,
write out all the maximal antichains in this partial order. [2 marks]

- 7 of 12 -
CS1231S
19. Counting and Probability [Total: 20 marks]
Note that you need not show your working for parts (a) to (c).
(a) [Subtotal: 4 marks]

Three persons went to the famous Gluttons Gourmet Hawker Centre where four of the city’s best
hawker stalls are housed: DiDi Chicken Rice, Singing Char Kway Teow, Alamak Nasi Lemak and
Hurry Hurry Curry Fish Head. Assume that the three of them are indistinguishable. If each of them
is to order from one of these four stalls,
(i) in how many ways can they order their food? [1 mark]
(ii) in how many ways can they order their food from the same stall? [1 mark]
(ii) in how many ways can they order their food from two of the four stalls? [2 marks]

(b) [Subtotal: 5 marks]


A rare disease broke out in a city with a prevalence of 0.1%, that is, it affects 1 out of every 1000
persons. A quick test kit has been developed that has a sensitivity of 85%, which is the probability
that a person with the rare disease is tested positive. Among those who took the test, 10% of the
time it came out positive.
Write your answers correct to 3 significant figures.
(i) Divoc has shown symptoms of the disease. Should he be tested positive, what is the
probability that he actually has the disease? [2 marks]
(ii) What is the probability of a false positive result, that is, a person does not have the disease
but is tested positive? [3 marks]

(c) [Subtotal: 6 marks]


How many equivalence relations are there on a set with 𝑛 elements, where
(i) 𝑛 = 2? [1 mark]
(ii) 𝑛 = 3? [2 marks]
(iii) 𝑛 = 4? [3 marks]

(d) [Subtotal: 5 marks]


(i) Dueet owns a beautiful cat called Meow who loves to wear socks on its four feet. Dueet has
a collection of many cat socks in three colours: white, red and yellow. What is the least
number of socks Dueet must pull out from the drawer to guarantee getting four socks of
matching colour? You do not need to explain your answer. [2 marks]
(ii) Aiken has a mini garden which is an equilateral triangle
with side of 4 metres. He wants to plant five seeds in
his mini garden. Explain that there will be two seeds
within 2 metres of each other. [3 marks]

4m

- 8 of 12 -
CS1231S
20. Graphs and Trees [Total: 20 marks]
(a) Draw all non-isomorphic, connected simple graphs on four vertices. [3 marks]
(b) Prove or disprove the following statements: [8 marks]
(i) The graph 𝐾2,4 is a planar graph.
(ii) The graph 𝐾3,4 is a planar graph.
(iii) There exists a simple graph that is connected and planar with 5 vertices and 8 faces.
(iv) The graph 𝐾5 − {𝑒} where 𝑒 is any edge in the graph is 4-colourable.

(c) [Subtotal: 9 marks] You are given a set of 𝑛 tasks 𝑇 = {𝑇1 , 𝑇2 , 𝑇3 , … , 𝑇𝑛 } . Each task 𝑇𝑘 is
represented by the interval 𝐼𝑘 = [𝑠𝑘 , 𝑒𝑘 ) where 𝑠𝑘 is the start time and 𝑒𝑘 (where 𝑠𝑘 < 𝑒𝑘 ) is the
end time of the task, for 𝑘 = 1,2, … , 𝑛. An instance of this problem with 𝑛 = 10 is shown below.
Instance: 𝑛 = 10, and 𝑇 = {𝑇1 , 𝑇2 , … , 𝑇10 }, and
𝐼1 = [0, 3), 𝐼2 = [11, 19), 𝐼3 = [14, 20), 𝐼4 = [2, 5), 𝐼5 = [8, 12),
𝐼6 = [6, 10), 𝐼7 = [1, 5), 𝐼8 = [12, 16), 𝐼9 = [17, 19), 𝐼10 = [4, 9).

𝐼1 𝐼2

𝐼4 𝐼5 𝐼3
𝐼7 𝐼6 𝐼8
𝐼10 𝐼9

0 4 8 12 16 20

Define a graph 𝐺 = (𝑇, 𝐸) where


𝐸 = { {𝑇𝑥 , 𝑇𝑦 } ∶ (𝐼𝑥 ∩ 𝐼𝑦 ≠ ∅) }
Namely, there is an edge {𝑇𝑥 , 𝑇𝑦 } ∈ 𝐸 if and only if the intervals [𝑠𝑥 , 𝑒𝑥 ) of task 𝑇𝑥 overlaps with
the interval [𝑠𝑦 , 𝑒𝑦 ) of task 𝑇𝑦 . We call 𝐺 an interval graph.
(i) Draw the interval graph 𝐺 for this instance. Ten labelled vertices have been drawn on the
Answer Sheets. [3 marks]
(ii) Give a minimum colouring for the graph 𝐺 from (i) above. [2 marks]
(iii) You want to assign all the tasks to machines so as to minimize the number of machines used.
Each machine can only work on one task at a time. Each machine can do any number of tasks
as long as the tasks do not overlap in time. (You can assume that a machine can (if necessary)
start on a new task immediately after finishing a previous task. In the instance above, tasks
𝑇5 and 𝑇8 can be assigned to the same machine, if necessary.)
Give a short argument (in one or two sentences) that the tasks assigned the same colour in
the coloured graph 𝐺 (obtained in part (ii) above) can be done by one machine. [2 marks]
(iv) Give an assignment of tasks in 𝑇 to machines that minimizes the number of machines needed.
You can use the one from part (c)(ii) above or a different assignment that minimizes the
number of machines. [2 marks]

- 9 of 12 -
CS1231S
21. [Total: 7 marks]
(a) Define a partition of ℤ that divides ℤ into 1231 countably infinite subsets. You do not need to
explain your answer [2 marks]
(b) Define a bijection 𝑓: (0,1) → (0,1] so that you may conclude that (0,1) and (0,1] have the
same cardinality. Prove that your function 𝑓 is a bijection. [5 marks]

=== END OF PAPER ===

- 10 of 12 -
CS1231S
This page is intentionally left blank.

- 11 of 12 -
CS1231S
This page is intentionally left blank.

- 12 of 12 -

You might also like