0% found this document useful (0 votes)
32 views40 pages

Cuoiki

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)
32 views40 pages

Cuoiki

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/ 40

Lecturer: (Date) Approved by: (Date)

(Signature and Fullname) (Signature and Fullname)

Semester / Academic year 2 2022-2023


FINAL EXAM
Date 30/05/2023
Course title Discrete Structure for Computing
UNIVERSITY OF TECHNOLOGY Course ID CO1007
FACULTY OF CSE Duration 80 mins Question sheet code 2221
Notes: - Students do not use course materials except one A4 hand-writing document.
- Submit the question sheet together with the answer sheet.
- Choose the best answer (only 1) for each question.

For questions 1–5, consider the following adjacency matrix for the simple undirected graph H (the weight 0 means
no connection):

1. (L.O.2.2) Assume that the index of the cell (or the graph’s edge) in the adjacency matrix will be indexed by
order of alphabet and number (from 1 to the end). For instance, cell (A, B) is indexed (1, 2), cell (A, A) is
(1, 1), cell (A, C) is (1, 3), . . ., (G, G) is (7, 7).
Start from A; the initialize step is Step 0; find the value of the Bellman-Ford algorithm’s Third step (Step
3). Note that the weight of an edge is not fixed; instead, it will be changed following the rule:
The weight of the cell/edge where the sum of the row and column index is an odd number will be reduced
by 1 after every 2 step of calculation (if the weight is 1, it cannot reduce more). For instance, at the first and
second steps, the value of cell (1, 2) a.k.a edge (A, B) is 8, and when calculating at the third and fourth steps,
it will be 7 and will be further decreased to 6 when calculating fifth and sixth, . . .
A. 0,4,3,1,4,1,2 B. 0,5,3,1,4,2,3 C. 0,8,3,1,5,2,3 D. 0,3,2,1,3,1,2

2. (L.O.2.2) Can we remove an edge from H to create H1 so that H1 has an Euler circuit? If yes, what edge can
we remove?
A. Can, remove edge BG B. Can, remove edge AF
C. All the other choices are incorrect D. Cannot
3. (L.O.2.2) Apply BFS from B to find a spanning tree of H. What is the total weight of this spanning tree?
Note: When choosing between multiple vertices, choose according to the alphabet in ascending order.
A. 22 B. 9 C. 12 D. 16

Stu.ID: .......................................... Stu.Fullname: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Page: 1


4. (L.O.2.2) Find the minimum spanning tree of H with the root D, we follow the criteria:

• If a child is earlier than its parent in the alphabet, it is a left child, else it is a right child

• There can be more than 1 left child or more than 1 right child.

• When choosing between multiple edges, select the edge with the earliest alphabet in ascending order of
the alphabet list.

What is the in-order traverse of the obtained tree?


A. A C F D B E G B. C F A D B G E C. C F A B G E D D. F C A D G B E
5. (L.O.2.2) Given a set X consisting of sub-graphs S with 6 edges and a vertex A of degree 4. What is the
probability of choosing a graph from X and that is a spanning tree? know that the probability of choosing
the vertices is the same
A. 0.4222 B. 0.0063 C. 0.0066 D. 0.4444
6. (L.O.2.2) A building has a ground floor G and other four floors marked 1,2,3,4. Seven people get in the
elevator at G. How many ways can they get out of the elevator on the remaining floors if

(a) every floor has at least one person get out and,

(b) the order of the people coming out on the same floors does not matter

A. 8400. B. 4800. C. 1319. D. 1913.


7. (L.O.3.1) An athlete decides to climb the mountain on a specific day from A to B. If this person has an
accident or bad weather, he will immediately stop climbing and return to A. According to the survey this
season, the possibility of a day with good weather is 60%, normal weather is 30%, and bad weather is 10%.
Know that the chance of this athlete having an accident in good weather is 1%, and this chance is 5% in
normal weather. Find the probability that this athlete reaches B.
A. 2.1%. B. 12.1%. C. 97.9%. D. 87.9%.
8. (L.O.2.2) Consider a team chess match, knowing that each team has 5 players, and each player will have to
play games against every player from the opponent team. The team that has more wins in the match is the
winning team, and the probability of winning for each player is the same. What kind of graph represents the
match, and what is the probability of there being a winning team?
A. All the others answers are incorrect B. K5,5 , 0.589
C. W5.5 , 0.422 D. K5,5 , 0.5

9. (L.O.3.1) Let G = (V, E) be a weighted directed graph with V = {1, ..., 100}. The edges of the graph and its
weights w(i, j) are assigned according to the following rule:

E = {(i, j)|j = i + 1, or j = 3i}, w(i, j) = 1,

for all (i, j) ∈ E. The shortest path in G from vertex u = 1 to vertex v = 100 has length
A. 4. B. 7. C. 27. D. 33.
10. (L.O.2.2) The number of relations that are both reflexive and symmetric on a set of 2023 elements is
2 2022∗2023 2022∗2023
+1
A. 22023 . B. 22022∗2023 . C. 2 2 . D. 2 2 .
11. (L.O.2.2) Given a W3 graph, the cycle vertices are indexed from 1 to 3, and the middle vertex is 4. The value
of each edge is the sum of its adjacency vertex. For instance, the edge between vertex 2 and 3 has a value of
5. What is the expectation of the total value of a spanning tree chosen from this W3 ?
A. 15 B. 14.25 C. 15.5 D. 16

Stu.ID: .......................................... Stu.Fullname: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Page: 2


12. (L.O.3.2) Consider the weighted undirected graph G

What is the total weight of the minimum spanning tree rooted at A obtained using Prim’s algorithm?
A. 18 B. 15 C. 12 D. 30
13. (L.O.2.2) How many binary strings of length 8 do not contain at least six consecutive 1s?
A. 248. B. 250. C. 249. D. 246.
14. (L.O.1.2) The degree sequence of a simple graph is the sequence of the degrees of the nodes in the graph in
decreasing order. Which of the following sequences can not be the degree sequence of any graph?
(I) 7,6,5,5,5,4,4,2,2; (II)7,6,6,6,4,4,2,2; (III) 8,7,7,6,4,2,2,1,1; (IV)9,9,6,6,6,6,5,4,3,2
A. I and IV. B. II and III. C. I only. D. II and IV.

15. (L.O.2.2) What is the probability that

x+y+z ≡1 mod p,

when x, y and z are chosen uniformly at random from {0, . . . , p − 1} with an odd prime number p?
A. 1/p3 . B. 1/p. C. 3/p. D. 1/3p.

16. (L.O.2.2) Given a discrete structure final test with 5 questions on Counting, 5 questions on Probability, 4
questions on Graph, 4 questions on Connectivity, and 7 on Tree. A sample student who has 30% of doing
a Counting question right, 40% of doing a Probability question right, 50% of doing a Graph question right,
60% of doing a Connectivity question wrong, and 70% of doing a Tree question right. What is the expected
number of correct questions this student can have?
A. 12 B. 13 C. 12.5 D. 11
17. (L.O.3.2) Consider the weighted directed graph G

The total weights of the edges of the shortest paths from vertex A to vertices B, C, D, E, and F , respectively,
are
A. 3, 5, 2, 4, and 7. B. 3, 7, 4, 5, and 7.
C. 3, 7, 2, 4, and 7. D. The shortest paths do not exist.

18. (L.O.1.2) Find in-order traversal of a binary tree with pre-order ADEBJCF HIG and post-order
EJBDHIF GCA
A. EDJBAHF ICG B. EDJBAF HICG C. EDJBAHF CIG D. ADJBEHF ICG
19. (L.O.1.2) How many arrangements of the letters in ABRACADABRA have no A adjacent to a B?
A. 5660 B. 3360 C. 5520 D. 5880

Stu.ID: .......................................... Stu.Fullname: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Page: 3


20. (L.O.1.2) Let’s consider an undirected graph given by the following adjacency list.

Vertex Adjacent vertices


a b, d, f
b a, c, e
c b, d, h
d a, c, g
e b, f, h
f a, e, g
g d, f, h
h c, e, g
Which of the following assessments is correct?
A. The graph is bipartite. B. The graph has no Euler circuit.
C. The graph has a Hamilton circuit. D. All answers are correct.

21. (L.O.1.2) How many ways are there to select five bills from a cash box containing $1, $2, $5, $10, $20,
$50, and $100 bills? Assume that the order in which the bills are chosen does not matter; the bills of each
denomination are indistinguishable, and there are at least five bills of each type.
A. 462 B. 792 C. 330 D. 1287
22. (L.O.3.1) Assume the population’s disease B ratio is 1/10000. What is the probability of a person having B,
given that person tests positive for B? Assume that there is a 99.9% chance a person with the disease tests
positive, and a 0.02% chance a person without B tests positive for it. Choose the best approximate of the
probability.
A. 33.31% B. 18.02% C. 75.53% D. 52.25%
23. (L.O.3.1) A grocery store has a promotion for customers when shopping. The promotional gift is any 10
toothbrushes from Colgate, Oral-B, and P/S brands. How many different ways to create promotional gifts?

A. 23 B. 12 C. 87 D. 66
24. (L.O.1.2) Given the following graph,

What is the shortest path (total weight) from A to the remaining vertices B, C, D, E, F:

A. −4, −5, 1, −1, 0. B. −4, −4, −1, −2, 0. C. −5, −4, −1, −3, 0. D. Another answer.

25. (L.O.3.1) How many internal vertices are in a full 5-ary tree with 101 leaves?
A. 33 B. 28 C. 25 D. 30

Stu.ID: .......................................... Stu.Fullname: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Page: 4


Solution 2221
1. A. 8. A. 15. B. 22. A.
2. A. 9. B. 16. A.
3. A. 10. D. 17. A. 23. D.
4. A. 11. A. 18. A.
5. A. 12. B. 19. D. 24. C.
6. A. 13. A. 20. D.
7. D. 14. B. 21. A. 25. C.

Stu.ID: .......................................... Stu.Fullname: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Page: 1


Lecturer: (Date) Approved by: (Date)
(Signature and Fullname) (Signature and Fullname)

Semester / Academic year 2 2022-2023


FINAL EXAM
Date 30/05/2023
Course title Discrete Structure for Computing
UNIVERSITY OF TECHNOLOGY Course ID CO1007
FACULTY OF CSE Duration 80 mins Question sheet code 2222
Notes: - Students do not use course materials except one A4 hand-writing document.
- Submit the question sheet together with the answer sheet.
- Choose the best answer (only 1) for each question.

1. (L.O.2.2) Consider a team chess match, knowing that each team has 5 players, and each player will have to
play games against every player from the opponent team. The team that has more wins in the match is the
winning team, and the probability of winning for each player is the same. What kind of graph represents the
match, and what is the probability of there being a winning team?
A. K5,5 , 0.5 B. All the others answers are incorrect
C. K5,5 , 0.589 D. W5.5 , 0.422

2. (L.O.1.2) Let’s consider an undirected graph given by the following adjacency list.

Vertex Adjacent vertices


a b, d, f
b a, c, e
c b, d, h
d a, c, g
e b, f, h
f a, e, g
g d, f, h
h c, e, g
Which of the following assessments is correct?
A. All answers are correct. B. The graph is bipartite.
C. The graph has no Euler circuit. D. The graph has a Hamilton circuit.

3. (L.O.2.2) What is the probability that

x+y+z ≡1 mod p,

when x, y and z are chosen uniformly at random from {0, . . . , p − 1} with an odd prime number p?
A. 1/3p. B. 1/p3 . C. 1/p. D. 3/p.

4. (L.O.3.1) A grocery store has a promotion for customers when shopping. The promotional gift is any 10
toothbrushes from Colgate, Oral-B, and P/S brands. How many different ways to create promotional gifts?

A. 66 B. 23 C. 12 D. 87
5. (L.O.2.2) A building has a ground floor G and other four floors marked 1,2,3,4. Seven people get in the
elevator at G. How many ways can they get out of the elevator on the remaining floors if

(a) every floor has at least one person get out and,

(b) the order of the people coming out on the same floors does not matter

A. 1913. B. 8400. C. 4800. D. 1319.

Stu.ID: .......................................... Stu.Fullname: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Page: 1


6. (L.O.3.1) An athlete decides to climb the mountain on a specific day from A to B. If this person has an
accident or bad weather, he will immediately stop climbing and return to A. According to the survey this
season, the possibility of a day with good weather is 60%, normal weather is 30%, and bad weather is 10%.
Know that the chance of this athlete having an accident in good weather is 1%, and this chance is 5% in
normal weather. Find the probability that this athlete reaches B.
A. 87.9%. B. 2.1%. C. 12.1%. D. 97.9%.
7. (L.O.1.2) Given the following graph,

What is the shortest path (total weight) from A to the remaining vertices B, C, D, E, F:

A. Another answer. B. −4, −5, 1, −1, 0. C. −4, −4, −1, −2, 0. D. −5, −4, −1, −3, 0.

8. (L.O.3.1) How many internal vertices are in a full 5-ary tree with 101 leaves?
A. 30 B. 33 C. 28 D. 25
9. (L.O.1.2) The degree sequence of a simple graph is the sequence of the degrees of the nodes in the graph in
decreasing order. Which of the following sequences can not be the degree sequence of any graph?
(I) 7,6,5,5,5,4,4,2,2; (II)7,6,6,6,4,4,2,2; (III) 8,7,7,6,4,2,2,1,1; (IV)9,9,6,6,6,6,5,4,3,2
A. II and IV. B. I and IV. C. II and III. D. I only.

10. (L.O.1.2) How many arrangements of the letters in ABRACADABRA have no A adjacent to a B?
A. 5880 B. 5660 C. 3360 D. 5520
11. (L.O.1.2) Find in-order traversal of a binary tree with pre-order ADEBJCF HIG and post-order
EJBDHIF GCA
A. ADJBEHF ICG B. EDJBAHF ICG C. EDJBAF HICG D. EDJBAHF CIG

For questions 12–16, consider the following adjacency matrix for the simple undirected graph H (the weight 0
means no connection):

Stu.ID: .......................................... Stu.Fullname: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Page: 2


12. (L.O.2.2) Assume that the index of the cell (or the graph’s edge) in the adjacency matrix will be indexed by
order of alphabet and number (from 1 to the end). For instance, cell (A, B) is indexed (1, 2), cell (A, A) is
(1, 1), cell (A, C) is (1, 3), . . ., (G, G) is (7, 7).
Start from A; the initialize step is Step 0; find the value of the Bellman-Ford algorithm’s Third step (Step
3). Note that the weight of an edge is not fixed; instead, it will be changed following the rule:
The weight of the cell/edge where the sum of the row and column index is an odd number will be reduced
by 1 after every 2 step of calculation (if the weight is 1, it cannot reduce more). For instance, at the first and
second steps, the value of cell (1, 2) a.k.a edge (A, B) is 8, and when calculating at the third and fourth steps,
it will be 7 and will be further decreased to 6 when calculating fifth and sixth, . . .
A. 0,3,2,1,3,1,2 B. 0,4,3,1,4,1,2 C. 0,5,3,1,4,2,3 D. 0,8,3,1,5,2,3

13. (L.O.2.2) Can we remove an edge from H to create H1 so that H1 has an Euler circuit? If yes, what edge can
we remove?
A. Cannot B. Can, remove edge BG
C. Can, remove edge AF D. All the other choices are incorrect

14. (L.O.2.2) Apply BFS from B to find a spanning tree of H. What is the total weight of this spanning tree?
Note: When choosing between multiple vertices, choose according to the alphabet in ascending order.
A. 16 B. 22 C. 9 D. 12
15. (L.O.2.2) Find the minimum spanning tree of H with the root D, we follow the criteria:

• If a child is earlier than its parent in the alphabet, it is a left child, else it is a right child

• There can be more than 1 left child or more than 1 right child.

• When choosing between multiple edges, select the edge with the earliest alphabet in ascending order of
the alphabet list.

What is the in-order traverse of the obtained tree?


A. F C A D G B E B. A C F D B E G C. C F A D B G E D. C F A B G E D
16. (L.O.2.2) Given a set X consisting of sub-graphs S with 6 edges and a vertex A of degree 4. What is the
probability of choosing a graph from X and that is a spanning tree? know that the probability of choosing
the vertices is the same
A. 0.4444 B. 0.4222 C. 0.0063 D. 0.0066
17. (L.O.3.2) Consider the weighted directed graph G

The total weights of the edges of the shortest paths from vertex A to vertices B, C, D, E, and F , respectively,
are
A. The shortest paths do not exist. B. 3, 5, 2, 4, and 7.
C. 3, 7, 4, 5, and 7. D. 3, 7, 2, 4, and 7.

18. (L.O.1.2) How many ways are there to select five bills from a cash box containing $1, $2, $5, $10, $20,
$50, and $100 bills? Assume that the order in which the bills are chosen does not matter; the bills of each
denomination are indistinguishable, and there are at least five bills of each type.
A. 1287 B. 462 C. 792 D. 330
19. (L.O.2.2) How many binary strings of length 8 do not contain at least six consecutive 1s?
A. 246. B. 248. C. 250. D. 249.

Stu.ID: .......................................... Stu.Fullname: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Page: 3


20. (L.O.3.1) Assume the population’s disease B ratio is 1/10000. What is the probability of a person having B,
given that person tests positive for B? Assume that there is a 99.9% chance a person with the disease tests
positive, and a 0.02% chance a person without B tests positive for it. Choose the best approximate of the
probability.
A. 52.25% B. 33.31% C. 18.02% D. 75.53%
21. (L.O.3.2) Consider the weighted undirected graph G

What is the total weight of the minimum spanning tree rooted at A obtained using Prim’s algorithm?
A. 30 B. 18 C. 15 D. 12
22. (L.O.2.2) The number of relations that are both reflexive and symmetric on a set of 2023 elements is
2022∗2023 2 2022∗2023
+1
A. 2 2 . B. 22023 . C. 22022∗2023 . D. 2 2 .
23. (L.O.2.2) Given a discrete structure final test with 5 questions on Counting, 5 questions on Probability, 4
questions on Graph, 4 questions on Connectivity, and 7 on Tree. A sample student who has 30% of doing
a Counting question right, 40% of doing a Probability question right, 50% of doing a Graph question right,
60% of doing a Connectivity question wrong, and 70% of doing a Tree question right. What is the expected
number of correct questions this student can have?
A. 11 B. 12 C. 13 D. 12.5
24. (L.O.3.1) Let G = (V, E) be a weighted directed graph with V = {1, ..., 100}. The edges of the graph and its
weights w(i, j) are assigned according to the following rule:

E = {(i, j)|j = i + 1, or j = 3i}, w(i, j) = 1,

for all (i, j) ∈ E. The shortest path in G from vertex u = 1 to vertex v = 100 has length
A. 33. B. 4. C. 7. D. 27.
25. (L.O.2.2) Given a W3 graph, the cycle vertices are indexed from 1 to 3, and the middle vertex is 4. The value
of each edge is the sum of its adjacency vertex. For instance, the edge between vertex 2 and 3 has a value of
5. What is the expectation of the total value of a spanning tree chosen from this W3 ?
A. 16 B. 15 C. 14.25 D. 15.5

Stu.ID: .......................................... Stu.Fullname: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Page: 4


Solution 2222
1. B. 8. D. 14. B. 21. C.
2. A. 9. C. 15. B.
22. A.
3. C. 10. A. 16. B.
4. A. 11. B. 17. B. 23. B.
5. B. 18. B.
24. C.
6. A. 12. B. 19. B.
7. D. 13. B. 20. B. 25. B.

Stu.ID: .......................................... Stu.Fullname: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Page: 1


Lecturer: (Date) Approved by: (Date)
(Signature and Fullname) (Signature and Fullname)

Semester / Academic year 2 2022-2023


FINAL EXAM
Date 30/05/2023
Course title Discrete Structure for Computing
UNIVERSITY OF TECHNOLOGY Course ID CO1007
FACULTY OF CSE Duration 80 mins Question sheet code 2223
Notes: - Students do not use course materials except one A4 hand-writing document.
- Submit the question sheet together with the answer sheet.
- Choose the best answer (only 1) for each question.

1. (L.O.3.1) A grocery store has a promotion for customers when shopping. The promotional gift is any 10
toothbrushes from Colgate, Oral-B, and P/S brands. How many different ways to create promotional gifts?

A. 23 B. 66 C. 12 D. 87
2. (L.O.1.2) Let’s consider an undirected graph given by the following adjacency list.

Vertex Adjacent vertices


a b, d, f
b a, c, e
c b, d, h
d a, c, g
e b, f, h
f a, e, g
g d, f, h
h c, e, g
Which of the following assessments is correct?
A. The graph is bipartite. B. All answers are correct.
C. The graph has no Euler circuit. D. The graph has a Hamilton circuit.
3. (L.O.2.2) What is the probability that

x+y+z ≡1 mod p,

when x, y and z are chosen uniformly at random from {0, . . . , p − 1} with an odd prime number p?
A. 1/p3 . B. 1/3p. C. 1/p. D. 3/p.

4. (L.O.1.2) The degree sequence of a simple graph is the sequence of the degrees of the nodes in the graph in
decreasing order. Which of the following sequences can not be the degree sequence of any graph?
(I) 7,6,5,5,5,4,4,2,2; (II)7,6,6,6,4,4,2,2; (III) 8,7,7,6,4,2,2,1,1; (IV)9,9,6,6,6,6,5,4,3,2
A. I and IV. B. II and IV. C. II and III. D. I only.
5. (L.O.3.1) Let G = (V, E) be a weighted directed graph with V = {1, ..., 100}. The edges of the graph and its
weights w(i, j) are assigned according to the following rule:

E = {(i, j)|j = i + 1, or j = 3i}, w(i, j) = 1,

for all (i, j) ∈ E. The shortest path in G from vertex u = 1 to vertex v = 100 has length
A. 4. B. 33. C. 7. D. 27.
6. (L.O.2.2) Given a discrete structure final test with 5 questions on Counting, 5 questions on Probability, 4
questions on Graph, 4 questions on Connectivity, and 7 on Tree. A sample student who has 30% of doing
a Counting question right, 40% of doing a Probability question right, 50% of doing a Graph question right,
60% of doing a Connectivity question wrong, and 70% of doing a Tree question right. What is the expected
number of correct questions this student can have?
A. 12 B. 11 C. 13 D. 12.5

Stu.ID: .......................................... Stu.Fullname: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Page: 1


7. (L.O.2.2) A building has a ground floor G and other four floors marked 1,2,3,4. Seven people get in the
elevator at G. How many ways can they get out of the elevator on the remaining floors if

(a) every floor has at least one person get out and,

(b) the order of the people coming out on the same floors does not matter

A. 8400. B. 1913. C. 4800. D. 1319.


8. (L.O.3.1) How many internal vertices are in a full 5-ary tree with 101 leaves?
A. 33 B. 30 C. 28 D. 25
9. (L.O.2.2) Consider a team chess match, knowing that each team has 5 players, and each player will have to
play games against every player from the opponent team. The team that has more wins in the match is the
winning team, and the probability of winning for each player is the same. What kind of graph represents the
match, and what is the probability of there being a winning team?
A. All the others answers are incorrect B. K5,5 , 0.5
C. K5,5 , 0.589 D. W5.5 , 0.422

10. (L.O.3.1) An athlete decides to climb the mountain on a specific day from A to B. If this person has an
accident or bad weather, he will immediately stop climbing and return to A. According to the survey this
season, the possibility of a day with good weather is 60%, normal weather is 30%, and bad weather is 10%.
Know that the chance of this athlete having an accident in good weather is 1%, and this chance is 5% in
normal weather. Find the probability that this athlete reaches B.
A. 2.1%. B. 87.9%. C. 12.1%. D. 97.9%.
11. (L.O.1.2) How many arrangements of the letters in ABRACADABRA have no A adjacent to a B?
A. 5660 B. 5880 C. 3360 D. 5520
12. (L.O.2.2) Given a W3 graph, the cycle vertices are indexed from 1 to 3, and the middle vertex is 4. The value
of each edge is the sum of its adjacency vertex. For instance, the edge between vertex 2 and 3 has a value of
5. What is the expectation of the total value of a spanning tree chosen from this W3 ?
A. 15 B. 16 C. 14.25 D. 15.5
13. (L.O.3.2) Consider the weighted undirected graph G

What is the total weight of the minimum spanning tree rooted at A obtained using Prim’s algorithm?
A. 18 B. 30 C. 15 D. 12
14. (L.O.2.2) How many binary strings of length 8 do not contain at least six consecutive 1s?
A. 248. B. 246. C. 250. D. 249.
15. (L.O.2.2) The number of relations that are both reflexive and symmetric on a set of 2023 elements is
2 2022∗2023 2022∗2023
+1
A. 22023 . B. 2 2 . C. 22022∗2023 . D. 2 2 .
16. (L.O.1.2) Find in-order traversal of a binary tree with pre-order ADEBJCF HIG and post-order
EJBDHIF GCA
A. EDJBAHF ICG B. ADJBEHF ICG C. EDJBAF HICG D. EDJBAHF CIG

Stu.ID: .......................................... Stu.Fullname: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Page: 2


17. (L.O.3.2) Consider the weighted directed graph G

The total weights of the edges of the shortest paths from vertex A to vertices B, C, D, E, and F , respectively,
are
A. 3, 5, 2, 4, and 7. B. The shortest paths do not exist.
C. 3, 7, 4, 5, and 7. D. 3, 7, 2, 4, and 7.

18. (L.O.1.2) Given the following graph,

What is the shortest path (total weight) from A to the remaining vertices B, C, D, E, F:

A. −4, −5, 1, −1, 0. B. Another answer. C. −4, −4, −1, −2, 0. D. −5, −4, −1, −3, 0.

19. (L.O.3.1) Assume the population’s disease B ratio is 1/10000. What is the probability of a person having B,
given that person tests positive for B? Assume that there is a 99.9% chance a person with the disease tests
positive, and a 0.02% chance a person without B tests positive for it. Choose the best approximate of the
probability.
A. 33.31% B. 52.25% C. 18.02% D. 75.53%
20. (L.O.1.2) How many ways are there to select five bills from a cash box containing $1, $2, $5, $10, $20,
$50, and $100 bills? Assume that the order in which the bills are chosen does not matter; the bills of each
denomination are indistinguishable, and there are at least five bills of each type.
A. 462 B. 1287 C. 792 D. 330

For questions 21–25, consider the following adjacency matrix for the simple undirected graph H (the weight 0
means no connection):

Stu.ID: .......................................... Stu.Fullname: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Page: 3


21. (L.O.2.2) Assume that the index of the cell (or the graph’s edge) in the adjacency matrix will be indexed by
order of alphabet and number (from 1 to the end). For instance, cell (A, B) is indexed (1, 2), cell (A, A) is
(1, 1), cell (A, C) is (1, 3), . . ., (G, G) is (7, 7).
Start from A; the initialize step is Step 0; find the value of the Bellman-Ford algorithm’s Third step (Step
3). Note that the weight of an edge is not fixed; instead, it will be changed following the rule:
The weight of the cell/edge where the sum of the row and column index is an odd number will be reduced
by 1 after every 2 step of calculation (if the weight is 1, it cannot reduce more). For instance, at the first and
second steps, the value of cell (1, 2) a.k.a edge (A, B) is 8, and when calculating at the third and fourth steps,
it will be 7 and will be further decreased to 6 when calculating fifth and sixth, . . .
A. 0,4,3,1,4,1,2 B. 0,3,2,1,3,1,2 C. 0,5,3,1,4,2,3 D. 0,8,3,1,5,2,3

22. (L.O.2.2) Can we remove an edge from H to create H1 so that H1 has an Euler circuit? If yes, what edge can
we remove?
A. Can, remove edge BG B. Cannot
C. Can, remove edge AF D. All the other choices are incorrect

23. (L.O.2.2) Apply BFS from B to find a spanning tree of H. What is the total weight of this spanning tree?
Note: When choosing between multiple vertices, choose according to the alphabet in ascending order.
A. 22 B. 16 C. 9 D. 12
24. (L.O.2.2) Find the minimum spanning tree of H with the root D, we follow the criteria:

• If a child is earlier than its parent in the alphabet, it is a left child, else it is a right child

• There can be more than 1 left child or more than 1 right child.

• When choosing between multiple edges, select the edge with the earliest alphabet in ascending order of
the alphabet list.

What is the in-order traverse of the obtained tree?


A. A C F D B E G B. F C A D G B E C. C F A D B G E D. C F A B G E D
25. (L.O.2.2) Given a set X consisting of sub-graphs S with 6 edges and a vertex A of degree 4. What is the
probability of choosing a graph from X and that is a spanning tree? know that the probability of choosing
the vertices is the same
A. 0.4222 B. 0.4444 C. 0.0063 D. 0.0066

Stu.ID: .......................................... Stu.Fullname: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Page: 4


Solution 2223
1. B. 8. D. 15. B. 21. A.
2. B. 9. A. 16. A.
22. A.
3. C. 10. B. 17. A.
4. C. 11. B. 18. D. 23. A.
5. C. 12. A.
19. A. 24. A.
6. A. 13. C.
20. A.
7. A. 14. A. 25. A.

Stu.ID: .......................................... Stu.Fullname: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Page: 1


Lecturer: (Date) Approved by: (Date)
(Signature and Fullname) (Signature and Fullname)

Semester / Academic year 2 2022-2023


FINAL EXAM
Date 30/05/2023
Course title Discrete Structure for Computing
UNIVERSITY OF TECHNOLOGY Course ID CO1007
FACULTY OF CSE Duration 80 mins Question sheet code 2224
Notes: - Students do not use course materials except one A4 hand-writing document.
- Submit the question sheet together with the answer sheet.
- Choose the best answer (only 1) for each question.

1. (L.O.2.2) A building has a ground floor G and other four floors marked 1,2,3,4. Seven people get in the
elevator at G. How many ways can they get out of the elevator on the remaining floors if

(a) every floor has at least one person get out and,

(b) the order of the people coming out on the same floors does not matter

A. 8400. B. 1319. C. 4800. D. 1913.


2. (L.O.2.2) Given a W3 graph, the cycle vertices are indexed from 1 to 3, and the middle vertex is 4. The value
of each edge is the sum of its adjacency vertex. For instance, the edge between vertex 2 and 3 has a value of
5. What is the expectation of the total value of a spanning tree chosen from this W3 ?
A. 15 B. 15.5 C. 14.25 D. 16
3. (L.O.1.2) Given the following graph,

What is the shortest path (total weight) from A to the remaining vertices B, C, D, E, F:

A. −4, −5, 1, −1, 0. B. −5, −4, −1, −3, 0. C. −4, −4, −1, −2, 0. D. Another answer.

4. (L.O.1.2) The degree sequence of a simple graph is the sequence of the degrees of the nodes in the graph in
decreasing order. Which of the following sequences can not be the degree sequence of any graph?
(I) 7,6,5,5,5,4,4,2,2; (II)7,6,6,6,4,4,2,2; (III) 8,7,7,6,4,2,2,1,1; (IV)9,9,6,6,6,6,5,4,3,2
A. I and IV. B. I only. C. II and III. D. II and IV.

5. (L.O.1.2) How many ways are there to select five bills from a cash box containing $1, $2, $5, $10, $20,
$50, and $100 bills? Assume that the order in which the bills are chosen does not matter; the bills of each
denomination are indistinguishable, and there are at least five bills of each type.
A. 462 B. 330 C. 792 D. 1287

Stu.ID: .......................................... Stu.Fullname: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Page: 1


6. (L.O.1.2) Let’s consider an undirected graph given by the following adjacency list.

Vertex Adjacent vertices


a b, d, f
b a, c, e
c b, d, h
d a, c, g
e b, f, h
f a, e, g
g d, f, h
h c, e, g
Which of the following assessments is correct?
A. The graph is bipartite. B. The graph has a Hamilton circuit.
C. The graph has no Euler circuit. D. All answers are correct.

7. (L.O.1.2) Find in-order traversal of a binary tree with pre-order ADEBJCF HIG and post-order
EJBDHIF GCA
A. EDJBAHF ICG B. EDJBAHF CIG C. EDJBAF HICG D. ADJBEHF ICG
8. (L.O.2.2) Given a discrete structure final test with 5 questions on Counting, 5 questions on Probability, 4
questions on Graph, 4 questions on Connectivity, and 7 on Tree. A sample student who has 30% of doing
a Counting question right, 40% of doing a Probability question right, 50% of doing a Graph question right,
60% of doing a Connectivity question wrong, and 70% of doing a Tree question right. What is the expected
number of correct questions this student can have?
A. 12 B. 12.5 C. 13 D. 11
9. (L.O.3.1) An athlete decides to climb the mountain on a specific day from A to B. If this person has an
accident or bad weather, he will immediately stop climbing and return to A. According to the survey this
season, the possibility of a day with good weather is 60%, normal weather is 30%, and bad weather is 10%.
Know that the chance of this athlete having an accident in good weather is 1%, and this chance is 5% in
normal weather. Find the probability that this athlete reaches B.
A. 2.1%. B. 97.9%. C. 12.1%. D. 87.9%.

For questions 10–14, consider the following adjacency matrix for the simple undirected graph H (the weight 0
means no connection):

Stu.ID: .......................................... Stu.Fullname: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Page: 2


10. (L.O.2.2) Assume that the index of the cell (or the graph’s edge) in the adjacency matrix will be indexed by
order of alphabet and number (from 1 to the end). For instance, cell (A, B) is indexed (1, 2), cell (A, A) is
(1, 1), cell (A, C) is (1, 3), . . ., (G, G) is (7, 7).
Start from A; the initialize step is Step 0; find the value of the Bellman-Ford algorithm’s Third step (Step
3). Note that the weight of an edge is not fixed; instead, it will be changed following the rule:
The weight of the cell/edge where the sum of the row and column index is an odd number will be reduced
by 1 after every 2 step of calculation (if the weight is 1, it cannot reduce more). For instance, at the first and
second steps, the value of cell (1, 2) a.k.a edge (A, B) is 8, and when calculating at the third and fourth steps,
it will be 7 and will be further decreased to 6 when calculating fifth and sixth, . . .
A. 0,4,3,1,4,1,2 B. 0,8,3,1,5,2,3 C. 0,5,3,1,4,2,3 D. 0,3,2,1,3,1,2
11. (L.O.2.2) Can we remove an edge from H to create H1 so that H1 has an Euler circuit? If yes, what edge can
we remove?
A. Can, remove edge BG B. All the other choices are incorrect
C. Can, remove edge AF D. Cannot
12. (L.O.2.2) Apply BFS from B to find a spanning tree of H. What is the total weight of this spanning tree?
Note: When choosing between multiple vertices, choose according to the alphabet in ascending order.
A. 22 B. 12 C. 9 D. 16
13. (L.O.2.2) Find the minimum spanning tree of H with the root D, we follow the criteria:

• If a child is earlier than its parent in the alphabet, it is a left child, else it is a right child

• There can be more than 1 left child or more than 1 right child.

• When choosing between multiple edges, select the edge with the earliest alphabet in ascending order of
the alphabet list.

What is the in-order traverse of the obtained tree?


A. A C F D B E G B. C F A B G E D C. C F A D B G E D. F C A D G B E
14. (L.O.2.2) Given a set X consisting of sub-graphs S with 6 edges and a vertex A of degree 4. What is the
probability of choosing a graph from X and that is a spanning tree? know that the probability of choosing
the vertices is the same
A. 0.4222 B. 0.0066 C. 0.0063 D. 0.4444
15. (L.O.3.1) A grocery store has a promotion for customers when shopping. The promotional gift is any 10
toothbrushes from Colgate, Oral-B, and P/S brands. How many different ways to create promotional gifts?

A. 23 B. 87 C. 12 D. 66
16. (L.O.1.2) How many arrangements of the letters in ABRACADABRA have no A adjacent to a B?
A. 5660 B. 5520 C. 3360 D. 5880
17. (L.O.2.2) How many binary strings of length 8 do not contain at least six consecutive 1s?
A. 248. B. 249. C. 250. D. 246.
18. (L.O.3.1) How many internal vertices are in a full 5-ary tree with 101 leaves?
A. 33 B. 25 C. 28 D. 30
19. (L.O.3.2) Consider the weighted undirected graph G

What is the total weight of the minimum spanning tree rooted at A obtained using Prim’s algorithm?
A. 18 B. 12 C. 15 D. 30

Stu.ID: .......................................... Stu.Fullname: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Page: 3


20. (L.O.2.2) The number of relations that are both reflexive and symmetric on a set of 2023 elements is
2 2022∗2023 2022∗2023
+1
A. 22023 . B. 2 2 . C. 22022∗2023 . D. 2 2 .
21. (L.O.3.1) Assume the population’s disease B ratio is 1/10000. What is the probability of a person having B,
given that person tests positive for B? Assume that there is a 99.9% chance a person with the disease tests
positive, and a 0.02% chance a person without B tests positive for it. Choose the best approximate of the
probability.
A. 33.31% B. 75.53% C. 18.02% D. 52.25%
22. (L.O.3.1) Let G = (V, E) be a weighted directed graph with V = {1, ..., 100}. The edges of the graph and its
weights w(i, j) are assigned according to the following rule:

E = {(i, j)|j = i + 1, or j = 3i}, w(i, j) = 1,

for all (i, j) ∈ E. The shortest path in G from vertex u = 1 to vertex v = 100 has length
A. 4. B. 27. C. 7. D. 33.
23. (L.O.2.2) What is the probability that

x+y+z ≡1 mod p,

when x, y and z are chosen uniformly at random from {0, . . . , p − 1} with an odd prime number p?
A. 1/p3 . B. 3/p. C. 1/p. D. 1/3p.

24. (L.O.3.2) Consider the weighted directed graph G

The total weights of the edges of the shortest paths from vertex A to vertices B, C, D, E, and F , respectively,
are
A. 3, 5, 2, 4, and 7. B. 3, 7, 2, 4, and 7.
C. 3, 7, 4, 5, and 7. D. The shortest paths do not exist.

25. (L.O.2.2) Consider a team chess match, knowing that each team has 5 players, and each player will have to
play games against every player from the opponent team. The team that has more wins in the match is the
winning team, and the probability of winning for each player is the same. What kind of graph represents the
match, and what is the probability of there being a winning team?
A. All the others answers are incorrect B. W5.5 , 0.422
C. K5,5 , 0.589 D. K5,5 , 0.5

Stu.ID: .......................................... Stu.Fullname: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Page: 4


Solution 2224
1. A. 8. A. 14. A. 21. A.
2. A. 9. D. 15. D.
22. C.
3. B. 16. D.
4. C. 10. A. 17. A. 23. C.
5. A. 11. A. 18. B.
24. A.
6. D. 12. A. 19. C.
7. A. 13. A. 20. D. 25. A.

Stu.ID: .......................................... Stu.Fullname: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Page: 1


Lecturer: (Date) Approved by: (Date)
(Signature and Fullname) (Signature and Fullname)

Semester / Academic year 2 2022-2023


FINAL EXAM
Date 30/05/2023
Course title Discrete Structure for Computing
UNIVERSITY OF TECHNOLOGY Course ID CO1007
FACULTY OF CSE Duration 80 mins Question sheet code 2225
Notes: - Students do not use course materials except one A4 hand-writing document.
- Submit the question sheet together with the answer sheet.
- Choose the best answer (only 1) for each question.

1. (L.O.1.2) How many arrangements of the letters in ABRACADABRA have no A adjacent to a B?


A. 5880 B. 5660 C. 5520 D. 3360
2. (L.O.3.1) How many internal vertices are in a full 5-ary tree with 101 leaves?
A. 30 B. 33 C. 25 D. 28
3. (L.O.1.2) Let’s consider an undirected graph given by the following adjacency list.

Vertex Adjacent vertices


a b, d, f
b a, c, e
c b, d, h
d a, c, g
e b, f, h
f a, e, g
g d, f, h
h c, e, g
Which of the following assessments is correct?
A. All answers are correct. B. The graph is bipartite.
C. The graph has a Hamilton circuit. D. The graph has no Euler circuit.

4. (L.O.2.2) How many binary strings of length 8 do not contain at least six consecutive 1s?
A. 246. B. 248. C. 249. D. 250.
5. (L.O.3.1) A grocery store has a promotion for customers when shopping. The promotional gift is any 10
toothbrushes from Colgate, Oral-B, and P/S brands. How many different ways to create promotional gifts?

A. 66 B. 23 C. 87 D. 12
6. (L.O.3.2) Consider the weighted undirected graph G

What is the total weight of the minimum spanning tree rooted at A obtained using Prim’s algorithm?
A. 30 B. 18 C. 12 D. 15

Stu.ID: .......................................... Stu.Fullname: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Page: 1


7. (L.O.1.2) How many ways are there to select five bills from a cash box containing $1, $2, $5, $10, $20,
$50, and $100 bills? Assume that the order in which the bills are chosen does not matter; the bills of each
denomination are indistinguishable, and there are at least five bills of each type.
A. 1287 B. 462 C. 330 D. 792
8. (L.O.1.2) Given the following graph,

What is the shortest path (total weight) from A to the remaining vertices B, C, D, E, F:

A. Another answer. B. −4, −5, 1, −1, 0. C. −5, −4, −1, −3, 0. D. −4, −4, −1, −2, 0.

9. (L.O.2.2) What is the probability that

x+y+z ≡1 mod p,

when x, y and z are chosen uniformly at random from {0, . . . , p − 1} with an odd prime number p?
A. 1/3p. B. 1/p3 . C. 3/p. D. 1/p.

10. (L.O.1.2) Find in-order traversal of a binary tree with pre-order ADEBJCF HIG and post-order
EJBDHIF GCA
A. ADJBEHF ICG B. EDJBAHF ICG C. EDJBAHF CIG D. EDJBAF HICG
11. (L.O.2.2) A building has a ground floor G and other four floors marked 1,2,3,4. Seven people get in the
elevator at G. How many ways can they get out of the elevator on the remaining floors if

(a) every floor has at least one person get out and,

(b) the order of the people coming out on the same floors does not matter

A. 1913. B. 8400. C. 1319. D. 4800.


12. (L.O.2.2) Consider a team chess match, knowing that each team has 5 players, and each player will have to
play games against every player from the opponent team. The team that has more wins in the match is the
winning team, and the probability of winning for each player is the same. What kind of graph represents the
match, and what is the probability of there being a winning team?
A. K5,5 , 0.5 B. All the others answers are incorrect
C. W5.5 , 0.422 D. K5,5 , 0.589

13. (L.O.2.2) The number of relations that are both reflexive and symmetric on a set of 2023 elements is
2022∗2023 2 2022∗2023
+1
A. 2 2 . B. 22023 . C. 2 2 . D. 22022∗2023 .
14. (L.O.2.2) Given a discrete structure final test with 5 questions on Counting, 5 questions on Probability, 4
questions on Graph, 4 questions on Connectivity, and 7 on Tree. A sample student who has 30% of doing
a Counting question right, 40% of doing a Probability question right, 50% of doing a Graph question right,
60% of doing a Connectivity question wrong, and 70% of doing a Tree question right. What is the expected
number of correct questions this student can have?
A. 11 B. 12 C. 12.5 D. 13

Stu.ID: .......................................... Stu.Fullname: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Page: 2


15. (L.O.3.2) Consider the weighted directed graph G

The total weights of the edges of the shortest paths from vertex A to vertices B, C, D, E, and F , respectively,
are
A. The shortest paths do not exist. B. 3, 5, 2, 4, and 7.
C. 3, 7, 2, 4, and 7. D. 3, 7, 4, 5, and 7.

For questions 16–20, consider the following adjacency matrix for the simple undirected graph H (the weight 0
means no connection):

16. (L.O.2.2) Assume that the index of the cell (or the graph’s edge) in the adjacency matrix will be indexed by
order of alphabet and number (from 1 to the end). For instance, cell (A, B) is indexed (1, 2), cell (A, A) is
(1, 1), cell (A, C) is (1, 3), . . ., (G, G) is (7, 7).
Start from A; the initialize step is Step 0; find the value of the Bellman-Ford algorithm’s Third step (Step
3). Note that the weight of an edge is not fixed; instead, it will be changed following the rule:
The weight of the cell/edge where the sum of the row and column index is an odd number will be reduced
by 1 after every 2 step of calculation (if the weight is 1, it cannot reduce more). For instance, at the first and
second steps, the value of cell (1, 2) a.k.a edge (A, B) is 8, and when calculating at the third and fourth steps,
it will be 7 and will be further decreased to 6 when calculating fifth and sixth, . . .
A. 0,3,2,1,3,1,2 B. 0,4,3,1,4,1,2 C. 0,8,3,1,5,2,3 D. 0,5,3,1,4,2,3

17. (L.O.2.2) Can we remove an edge from H to create H1 so that H1 has an Euler circuit? If yes, what edge can
we remove?
A. Cannot B. Can, remove edge BG
C. All the other choices are incorrect D. Can, remove edge AF

18. (L.O.2.2) Apply BFS from B to find a spanning tree of H. What is the total weight of this spanning tree?
Note: When choosing between multiple vertices, choose according to the alphabet in ascending order.
A. 16 B. 22 C. 12 D. 9

Stu.ID: .......................................... Stu.Fullname: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Page: 3


19. (L.O.2.2) Find the minimum spanning tree of H with the root D, we follow the criteria:

• If a child is earlier than its parent in the alphabet, it is a left child, else it is a right child

• There can be more than 1 left child or more than 1 right child.

• When choosing between multiple edges, select the edge with the earliest alphabet in ascending order of
the alphabet list.

What is the in-order traverse of the obtained tree?


A. F C A D G B E B. A C F D B E G C. C F A B G E D D. C F A D B G E
20. (L.O.2.2) Given a set X consisting of sub-graphs S with 6 edges and a vertex A of degree 4. What is the
probability of choosing a graph from X and that is a spanning tree? know that the probability of choosing
the vertices is the same
A. 0.4444 B. 0.4222 C. 0.0066 D. 0.0063
21. (L.O.3.1) An athlete decides to climb the mountain on a specific day from A to B. If this person has an
accident or bad weather, he will immediately stop climbing and return to A. According to the survey this
season, the possibility of a day with good weather is 60%, normal weather is 30%, and bad weather is 10%.
Know that the chance of this athlete having an accident in good weather is 1%, and this chance is 5% in
normal weather. Find the probability that this athlete reaches B.
A. 87.9%. B. 2.1%. C. 97.9%. D. 12.1%.
22. (L.O.3.1) Let G = (V, E) be a weighted directed graph with V = {1, ..., 100}. The edges of the graph and its
weights w(i, j) are assigned according to the following rule:

E = {(i, j)|j = i + 1, or j = 3i}, w(i, j) = 1,

for all (i, j) ∈ E. The shortest path in G from vertex u = 1 to vertex v = 100 has length
A. 33. B. 4. C. 27. D. 7.
23. (L.O.3.1) Assume the population’s disease B ratio is 1/10000. What is the probability of a person having B,
given that person tests positive for B? Assume that there is a 99.9% chance a person with the disease tests
positive, and a 0.02% chance a person without B tests positive for it. Choose the best approximate of the
probability.
A. 52.25% B. 33.31% C. 75.53% D. 18.02%
24. (L.O.1.2) The degree sequence of a simple graph is the sequence of the degrees of the nodes in the graph in
decreasing order. Which of the following sequences can not be the degree sequence of any graph?
(I) 7,6,5,5,5,4,4,2,2; (II)7,6,6,6,4,4,2,2; (III) 8,7,7,6,4,2,2,1,1; (IV)9,9,6,6,6,6,5,4,3,2
A. II and IV. B. I and IV. C. I only. D. II and III.

25. (L.O.2.2) Given a W3 graph, the cycle vertices are indexed from 1 to 3, and the middle vertex is 4. The value
of each edge is the sum of its adjacency vertex. For instance, the edge between vertex 2 and 3 has a value of
5. What is the expectation of the total value of a spanning tree chosen from this W3 ?
A. 16 B. 15 C. 15.5 D. 14.25

Stu.ID: .......................................... Stu.Fullname: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Page: 4


Solution 2225
1. A. 8. C. 15. B. 21. A.
2. C. 9. D.
22. D.
3. A. 10. B. 16. B.

4. B. 11. B. 17. B. 23. B.


5. A. 12. B. 18. B.
24. D.
6. D. 13. A. 19. B.

7. B. 14. B. 20. B. 25. B.

Stu.ID: .......................................... Stu.Fullname: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Page: 1


Lecturer: (Date) Approved by: (Date)
(Signature and Fullname) (Signature and Fullname)

Semester / Academic year 2 2022-2023


FINAL EXAM
Date 30/05/2023
Course title Discrete Structure for Computing
UNIVERSITY OF TECHNOLOGY Course ID CO1007
FACULTY OF CSE Duration 80 mins Question sheet code 2226
Notes: - Students do not use course materials except one A4 hand-writing document.
- Submit the question sheet together with the answer sheet.
- Choose the best answer (only 1) for each question.

1. (L.O.3.2) Consider the weighted undirected graph G

What is the total weight of the minimum spanning tree rooted at A obtained using Prim’s algorithm?
A. 18 B. 30 C. 12 D. 15
2. (L.O.3.1) A grocery store has a promotion for customers when shopping. The promotional gift is any 10
toothbrushes from Colgate, Oral-B, and P/S brands. How many different ways to create promotional gifts?

A. 23 B. 66 C. 87 D. 12

For questions 3–7, consider the following adjacency matrix for the simple undirected graph H (the weight 0 means
no connection):

Stu.ID: .......................................... Stu.Fullname: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Page: 1


3. (L.O.2.2) Assume that the index of the cell (or the graph’s edge) in the adjacency matrix will be indexed by
order of alphabet and number (from 1 to the end). For instance, cell (A, B) is indexed (1, 2), cell (A, A) is
(1, 1), cell (A, C) is (1, 3), . . ., (G, G) is (7, 7).
Start from A; the initialize step is Step 0; find the value of the Bellman-Ford algorithm’s Third step (Step
3). Note that the weight of an edge is not fixed; instead, it will be changed following the rule:
The weight of the cell/edge where the sum of the row and column index is an odd number will be reduced
by 1 after every 2 step of calculation (if the weight is 1, it cannot reduce more). For instance, at the first and
second steps, the value of cell (1, 2) a.k.a edge (A, B) is 8, and when calculating at the third and fourth steps,
it will be 7 and will be further decreased to 6 when calculating fifth and sixth, . . .
A. 0,4,3,1,4,1,2 B. 0,3,2,1,3,1,2 C. 0,8,3,1,5,2,3 D. 0,5,3,1,4,2,3
4. (L.O.2.2) Can we remove an edge from H to create H1 so that H1 has an Euler circuit? If yes, what edge can
we remove?
A. Can, remove edge BG B. Cannot
C. All the other choices are incorrect D. Can, remove edge AF
5. (L.O.2.2) Apply BFS from B to find a spanning tree of H. What is the total weight of this spanning tree?
Note: When choosing between multiple vertices, choose according to the alphabet in ascending order.
A. 22 B. 16 C. 12 D. 9
6. (L.O.2.2) Find the minimum spanning tree of H with the root D, we follow the criteria:

• If a child is earlier than its parent in the alphabet, it is a left child, else it is a right child

• There can be more than 1 left child or more than 1 right child.

• When choosing between multiple edges, select the edge with the earliest alphabet in ascending order of
the alphabet list.

What is the in-order traverse of the obtained tree?


A. A C F D B E G B. F C A D G B E C. C F A B G E D D. C F A D B G E
7. (L.O.2.2) Given a set X consisting of sub-graphs S with 6 edges and a vertex A of degree 4. What is the
probability of choosing a graph from X and that is a spanning tree? know that the probability of choosing
the vertices is the same
A. 0.4222 B. 0.4444 C. 0.0066 D. 0.0063
8. (L.O.3.1) Let G = (V, E) be a weighted directed graph with V = {1, ..., 100}. The edges of the graph and its
weights w(i, j) are assigned according to the following rule:

E = {(i, j)|j = i + 1, or j = 3i}, w(i, j) = 1,

for all (i, j) ∈ E. The shortest path in G from vertex u = 1 to vertex v = 100 has length
A. 4. B. 33. C. 27. D. 7.
9. (L.O.1.2) How many arrangements of the letters in ABRACADABRA have no A adjacent to a B?
A. 5660 B. 5880 C. 5520 D. 3360
10. (L.O.2.2) Given a W3 graph, the cycle vertices are indexed from 1 to 3, and the middle vertex is 4. The value
of each edge is the sum of its adjacency vertex. For instance, the edge between vertex 2 and 3 has a value of
5. What is the expectation of the total value of a spanning tree chosen from this W3 ?
A. 15 B. 16 C. 15.5 D. 14.25
11. (L.O.2.2) Consider a team chess match, knowing that each team has 5 players, and each player will have to
play games against every player from the opponent team. The team that has more wins in the match is the
winning team, and the probability of winning for each player is the same. What kind of graph represents the
match, and what is the probability of there being a winning team?
A. All the others answers are incorrect B. K5,5 , 0.5
C. W5.5 , 0.422 D. K5,5 , 0.589

12. (L.O.1.2) How many ways are there to select five bills from a cash box containing $1, $2, $5, $10, $20,
$50, and $100 bills? Assume that the order in which the bills are chosen does not matter; the bills of each
denomination are indistinguishable, and there are at least five bills of each type.
A. 462 B. 1287 C. 330 D. 792

Stu.ID: .......................................... Stu.Fullname: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Page: 2


13. (L.O.1.2) The degree sequence of a simple graph is the sequence of the degrees of the nodes in the graph in
decreasing order. Which of the following sequences can not be the degree sequence of any graph?
(I) 7,6,5,5,5,4,4,2,2; (II)7,6,6,6,4,4,2,2; (III) 8,7,7,6,4,2,2,1,1; (IV)9,9,6,6,6,6,5,4,3,2
A. I and IV. B. II and IV. C. I only. D. II and III.

14. (L.O.3.2) Consider the weighted directed graph G

The total weights of the edges of the shortest paths from vertex A to vertices B, C, D, E, and F , respectively,
are
A. 3, 5, 2, 4, and 7. B. The shortest paths do not exist.
C. 3, 7, 2, 4, and 7. D. 3, 7, 4, 5, and 7.

15. (L.O.3.1) Assume the population’s disease B ratio is 1/10000. What is the probability of a person having B,
given that person tests positive for B? Assume that there is a 99.9% chance a person with the disease tests
positive, and a 0.02% chance a person without B tests positive for it. Choose the best approximate of the
probability.
A. 33.31% B. 52.25% C. 75.53% D. 18.02%
16. (L.O.3.1) An athlete decides to climb the mountain on a specific day from A to B. If this person has an
accident or bad weather, he will immediately stop climbing and return to A. According to the survey this
season, the possibility of a day with good weather is 60%, normal weather is 30%, and bad weather is 10%.
Know that the chance of this athlete having an accident in good weather is 1%, and this chance is 5% in
normal weather. Find the probability that this athlete reaches B.
A. 2.1%. B. 87.9%. C. 97.9%. D. 12.1%.
17. (L.O.3.1) How many internal vertices are in a full 5-ary tree with 101 leaves?
A. 33 B. 30 C. 25 D. 28
18. (L.O.1.2) Let’s consider an undirected graph given by the following adjacency list.

Vertex Adjacent vertices


a b, d, f
b a, c, e
c b, d, h
d a, c, g
e b, f, h
f a, e, g
g d, f, h
h c, e, g
Which of the following assessments is correct?
A. The graph is bipartite. B. All answers are correct.
C. The graph has a Hamilton circuit. D. The graph has no Euler circuit.

19. (L.O.2.2) The number of relations that are both reflexive and symmetric on a set of 2023 elements is
2 2022∗2023 2022∗2023
+1
A. 22023 . B. 2 2 . C. 2 2 . D. 22022∗2023 .

Stu.ID: .......................................... Stu.Fullname: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Page: 3


20. (L.O.1.2) Given the following graph,

What is the shortest path (total weight) from A to the remaining vertices B, C, D, E, F:

A. −4, −5, 1, −1, 0. B. Another answer. C. −5, −4, −1, −3, 0. D. −4, −4, −1, −2, 0.

21. (L.O.2.2) A building has a ground floor G and other four floors marked 1,2,3,4. Seven people get in the
elevator at G. How many ways can they get out of the elevator on the remaining floors if

(a) every floor has at least one person get out and,

(b) the order of the people coming out on the same floors does not matter

A. 8400. B. 1913. C. 1319. D. 4800.


22. (L.O.2.2) What is the probability that

x+y+z ≡1 mod p,

when x, y and z are chosen uniformly at random from {0, . . . , p − 1} with an odd prime number p?
A. 1/p3 . B. 1/3p. C. 3/p. D. 1/p.

23. (L.O.1.2) Find in-order traversal of a binary tree with pre-order ADEBJCF HIG and post-order
EJBDHIF GCA
A. EDJBAHF ICG B. ADJBEHF ICG C. EDJBAHF CIG D. EDJBAF HICG
24. (L.O.2.2) How many binary strings of length 8 do not contain at least six consecutive 1s?
A. 248. B. 246. C. 249. D. 250.
25. (L.O.2.2) Given a discrete structure final test with 5 questions on Counting, 5 questions on Probability, 4
questions on Graph, 4 questions on Connectivity, and 7 on Tree. A sample student who has 30% of doing
a Counting question right, 40% of doing a Probability question right, 50% of doing a Graph question right,
60% of doing a Connectivity question wrong, and 70% of doing a Tree question right. What is the expected
number of correct questions this student can have?
A. 12 B. 11 C. 12.5 D. 13

Stu.ID: .......................................... Stu.Fullname: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Page: 4


Solution 2226
1. D. 7. A. 14. A. 21. A.

2. B. 8. D. 15. A.
22. D.
9. B. 16. B.
3. A. 10. A. 17. C. 23. A.
4. A. 11. A. 18. B.
24. A.
5. A. 12. A. 19. B.
6. A. 13. D. 20. C. 25. A.

Stu.ID: .......................................... Stu.Fullname: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Page: 1


Lecturer: (Date) Approved by: (Date)
(Signature and Fullname) (Signature and Fullname)

Semester / Academic year 2 2022-2023


FINAL EXAM
Date 30/05/2023
Course title Discrete Structure for Computing
UNIVERSITY OF TECHNOLOGY Course ID CO1007
FACULTY OF CSE Duration 80 mins Question sheet code 2227
Notes: - Students do not use course materials except one A4 hand-writing document.
- Submit the question sheet together with the answer sheet.
- Choose the best answer (only 1) for each question.

1. (L.O.2.2) Given a discrete structure final test with 5 questions on Counting, 5 questions on Probability, 4
questions on Graph, 4 questions on Connectivity, and 7 on Tree. A sample student who has 30% of doing
a Counting question right, 40% of doing a Probability question right, 50% of doing a Graph question right,
60% of doing a Connectivity question wrong, and 70% of doing a Tree question right. What is the expected
number of correct questions this student can have?
A. 12 B. 12.5 C. 11 D. 13
2. (L.O.1.2) How many arrangements of the letters in ABRACADABRA have no A adjacent to a B?
A. 5660 B. 5520 C. 5880 D. 3360
3. (L.O.2.2) Consider a team chess match, knowing that each team has 5 players, and each player will have to
play games against every player from the opponent team. The team that has more wins in the match is the
winning team, and the probability of winning for each player is the same. What kind of graph represents the
match, and what is the probability of there being a winning team?
A. All the others answers are incorrect B. W5.5 , 0.422
C. K5,5 , 0.5 D. K5,5 , 0.589

4. (L.O.3.1) An athlete decides to climb the mountain on a specific day from A to B. If this person has an
accident or bad weather, he will immediately stop climbing and return to A. According to the survey this
season, the possibility of a day with good weather is 60%, normal weather is 30%, and bad weather is 10%.
Know that the chance of this athlete having an accident in good weather is 1%, and this chance is 5% in
normal weather. Find the probability that this athlete reaches B.
A. 2.1%. B. 97.9%. C. 87.9%. D. 12.1%.
5. (L.O.3.1) Let G = (V, E) be a weighted directed graph with V = {1, ..., 100}. The edges of the graph and its
weights w(i, j) are assigned according to the following rule:

E = {(i, j)|j = i + 1, or j = 3i}, w(i, j) = 1,

for all (i, j) ∈ E. The shortest path in G from vertex u = 1 to vertex v = 100 has length
A. 4. B. 27. C. 33. D. 7.
6. (L.O.2.2) A building has a ground floor G and other four floors marked 1,2,3,4. Seven people get in the
elevator at G. How many ways can they get out of the elevator on the remaining floors if

(a) every floor has at least one person get out and,

(b) the order of the people coming out on the same floors does not matter

A. 8400. B. 1319. C. 1913. D. 4800.

For questions 7–11, consider the following adjacency matrix for the simple undirected graph H (the weight 0
means no connection):

Stu.ID: .......................................... Stu.Fullname: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Page: 1


7. (L.O.2.2) Assume that the index of the cell (or the graph’s edge) in the adjacency matrix will be indexed by
order of alphabet and number (from 1 to the end). For instance, cell (A, B) is indexed (1, 2), cell (A, A) is
(1, 1), cell (A, C) is (1, 3), . . ., (G, G) is (7, 7).
Start from A; the initialize step is Step 0; find the value of the Bellman-Ford algorithm’s Third step (Step
3). Note that the weight of an edge is not fixed; instead, it will be changed following the rule:
The weight of the cell/edge where the sum of the row and column index is an odd number will be reduced
by 1 after every 2 step of calculation (if the weight is 1, it cannot reduce more). For instance, at the first and
second steps, the value of cell (1, 2) a.k.a edge (A, B) is 8, and when calculating at the third and fourth steps,
it will be 7 and will be further decreased to 6 when calculating fifth and sixth, . . .
A. 0,4,3,1,4,1,2 B. 0,8,3,1,5,2,3 C. 0,3,2,1,3,1,2 D. 0,5,3,1,4,2,3

8. (L.O.2.2) Can we remove an edge from H to create H1 so that H1 has an Euler circuit? If yes, what edge can
we remove?
A. Can, remove edge BG B. All the other choices are incorrect
C. Cannot D. Can, remove edge AF

9. (L.O.2.2) Apply BFS from B to find a spanning tree of H. What is the total weight of this spanning tree?
Note: When choosing between multiple vertices, choose according to the alphabet in ascending order.
A. 22 B. 12 C. 16 D. 9
10. (L.O.2.2) Find the minimum spanning tree of H with the root D, we follow the criteria:

• If a child is earlier than its parent in the alphabet, it is a left child, else it is a right child

• There can be more than 1 left child or more than 1 right child.

• When choosing between multiple edges, select the edge with the earliest alphabet in ascending order of
the alphabet list.

What is the in-order traverse of the obtained tree?


A. A C F D B E G B. C F A B G E D C. F C A D G B E D. C F A D B G E
11. (L.O.2.2) Given a set X consisting of sub-graphs S with 6 edges and a vertex A of degree 4. What is the
probability of choosing a graph from X and that is a spanning tree? know that the probability of choosing
the vertices is the same
A. 0.4222 B. 0.0066 C. 0.4444 D. 0.0063

Stu.ID: .......................................... Stu.Fullname: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Page: 2


12. (L.O.1.2) Given the following graph,

What is the shortest path (total weight) from A to the remaining vertices B, C, D, E, F:

A. −4, −5, 1, −1, 0. B. −5, −4, −1, −3, 0. C. Another answer. D. −4, −4, −1, −2, 0.

13. (L.O.2.2) Given a W3 graph, the cycle vertices are indexed from 1 to 3, and the middle vertex is 4. The value
of each edge is the sum of its adjacency vertex. For instance, the edge between vertex 2 and 3 has a value of
5. What is the expectation of the total value of a spanning tree chosen from this W3 ?
A. 15 B. 15.5 C. 16 D. 14.25
14. (L.O.3.1) Assume the population’s disease B ratio is 1/10000. What is the probability of a person having B,
given that person tests positive for B? Assume that there is a 99.9% chance a person with the disease tests
positive, and a 0.02% chance a person without B tests positive for it. Choose the best approximate of the
probability.
A. 33.31% B. 75.53% C. 52.25% D. 18.02%
15. (L.O.3.1) A grocery store has a promotion for customers when shopping. The promotional gift is any 10
toothbrushes from Colgate, Oral-B, and P/S brands. How many different ways to create promotional gifts?

A. 23 B. 87 C. 66 D. 12
16. (L.O.3.1) How many internal vertices are in a full 5-ary tree with 101 leaves?
A. 33 B. 25 C. 30 D. 28
17. (L.O.1.2) The degree sequence of a simple graph is the sequence of the degrees of the nodes in the graph in
decreasing order. Which of the following sequences can not be the degree sequence of any graph?
(I) 7,6,5,5,5,4,4,2,2; (II)7,6,6,6,4,4,2,2; (III) 8,7,7,6,4,2,2,1,1; (IV)9,9,6,6,6,6,5,4,3,2
A. I and IV. B. I only. C. II and IV. D. II and III.

18. (L.O.3.2) Consider the weighted directed graph G

The total weights of the edges of the shortest paths from vertex A to vertices B, C, D, E, and F , respectively,
are
A. 3, 5, 2, 4, and 7. B. 3, 7, 2, 4, and 7.
C. The shortest paths do not exist. D. 3, 7, 4, 5, and 7.

19. (L.O.2.2) How many binary strings of length 8 do not contain at least six consecutive 1s?
A. 248. B. 249. C. 246. D. 250.
20. (L.O.2.2) The number of relations that are both reflexive and symmetric on a set of 2023 elements is
2 2022∗2023 2022∗2023
+1
A. 22023 . B. 2 2 . C. 2 2 . D. 22022∗2023 .

Stu.ID: .......................................... Stu.Fullname: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Page: 3


21. (L.O.1.2) Find in-order traversal of a binary tree with pre-order ADEBJCF HIG and post-order
EJBDHIF GCA
A. EDJBAHF ICG B. EDJBAHF CIG C. ADJBEHF ICG D. EDJBAF HICG
22. (L.O.1.2) Let’s consider an undirected graph given by the following adjacency list.

Vertex Adjacent vertices


a b, d, f
b a, c, e
c b, d, h
d a, c, g
e b, f, h
f a, e, g
g d, f, h
h c, e, g
Which of the following assessments is correct?
A. The graph is bipartite. B. The graph has a Hamilton circuit.
C. All answers are correct. D. The graph has no Euler circuit.

23. (L.O.1.2) How many ways are there to select five bills from a cash box containing $1, $2, $5, $10, $20,
$50, and $100 bills? Assume that the order in which the bills are chosen does not matter; the bills of each
denomination are indistinguishable, and there are at least five bills of each type.
A. 462 B. 330 C. 1287 D. 792
24. (L.O.2.2) What is the probability that

x+y+z ≡1 mod p,

when x, y and z are chosen uniformly at random from {0, . . . , p − 1} with an odd prime number p?
A. 1/p3 . B. 3/p. C. 1/3p. D. 1/p.

25. (L.O.3.2) Consider the weighted undirected graph G

What is the total weight of the minimum spanning tree rooted at A obtained using Prim’s algorithm?
A. 18 B. 12 C. 30 D. 15

Stu.ID: .......................................... Stu.Fullname: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Page: 4


Solution 2227
1. A. 7. A. 14. A. 21. A.

2. C. 8. A. 15. C.
22. C.
3. A. 9. A. 16. B.

4. C. 10. A. 17. D. 23. A.


11. A. 18. A.
5. D. 24. D.
12. B. 19. A.
6. A.
13. A. 20. C. 25. D.

Stu.ID: .......................................... Stu.Fullname: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Page: 1


Lecturer: (Date) Approved by: (Date)
(Signature and Fullname) (Signature and Fullname)

Semester / Academic year 2 2022-2023


FINAL EXAM
Date 30/05/2023
Course title Discrete Structure for Computing
UNIVERSITY OF TECHNOLOGY Course ID CO1007
FACULTY OF CSE Duration 80 mins Question sheet code 2228
Notes: - Students do not use course materials except one A4 hand-writing document.
- Submit the question sheet together with the answer sheet.
- Choose the best answer (only 1) for each question.

1. (L.O.2.2) What is the probability that

x+y+z ≡1 mod p,

when x, y and z are chosen uniformly at random from {0, . . . , p − 1} with an odd prime number p?
A. 1/p. B. 1/p3 . C. 3/p. D. 1/3p.

2. (L.O.2.2) The number of relations that are both reflexive and symmetric on a set of 2023 elements is
2 2022∗2023 2022∗2023
+1
A. 22022∗2023 . B. 22023 . C. 2 2 . D. 2 2 .
3. (L.O.1.2) Find in-order traversal of a binary tree with pre-order ADEBJCF HIG and post-order
EJBDHIF GCA
A. EDJBAF HICG B. EDJBAHF ICG C. EDJBAHF CIG D. ADJBEHF ICG
4. (L.O.3.1) Assume the population’s disease B ratio is 1/10000. What is the probability of a person having B,
given that person tests positive for B? Assume that there is a 99.9% chance a person with the disease tests
positive, and a 0.02% chance a person without B tests positive for it. Choose the best approximate of the
probability.
A. 18.02% B. 33.31% C. 75.53% D. 52.25%
5. (L.O.3.1) An athlete decides to climb the mountain on a specific day from A to B. If this person has an
accident or bad weather, he will immediately stop climbing and return to A. According to the survey this
season, the possibility of a day with good weather is 60%, normal weather is 30%, and bad weather is 10%.
Know that the chance of this athlete having an accident in good weather is 1%, and this chance is 5% in
normal weather. Find the probability that this athlete reaches B.
A. 12.1%. B. 2.1%. C. 97.9%. D. 87.9%.
6. (L.O.2.2) Given a discrete structure final test with 5 questions on Counting, 5 questions on Probability, 4
questions on Graph, 4 questions on Connectivity, and 7 on Tree. A sample student who has 30% of doing
a Counting question right, 40% of doing a Probability question right, 50% of doing a Graph question right,
60% of doing a Connectivity question wrong, and 70% of doing a Tree question right. What is the expected
number of correct questions this student can have?
A. 13 B. 12 C. 12.5 D. 11
7. (L.O.3.1) A grocery store has a promotion for customers when shopping. The promotional gift is any 10
toothbrushes from Colgate, Oral-B, and P/S brands. How many different ways to create promotional gifts?

A. 12 B. 23 C. 87 D. 66
8. (L.O.3.1) Let G = (V, E) be a weighted directed graph with V = {1, ..., 100}. The edges of the graph and its
weights w(i, j) are assigned according to the following rule:

E = {(i, j)|j = i + 1, or j = 3i}, w(i, j) = 1,

for all (i, j) ∈ E. The shortest path in G from vertex u = 1 to vertex v = 100 has length
A. 7. B. 4. C. 27. D. 33.

Stu.ID: .......................................... Stu.Fullname: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Page: 1


9. (L.O.2.2) Given a W3 graph, the cycle vertices are indexed from 1 to 3, and the middle vertex is 4. The value
of each edge is the sum of its adjacency vertex. For instance, the edge between vertex 2 and 3 has a value of
5. What is the expectation of the total value of a spanning tree chosen from this W3 ?
A. 14.25 B. 15 C. 15.5 D. 16

For questions 10–14, consider the following adjacency matrix for the simple undirected graph H (the weight 0
means no connection):

10. (L.O.2.2) Assume that the index of the cell (or the graph’s edge) in the adjacency matrix will be indexed by
order of alphabet and number (from 1 to the end). For instance, cell (A, B) is indexed (1, 2), cell (A, A) is
(1, 1), cell (A, C) is (1, 3), . . ., (G, G) is (7, 7).
Start from A; the initialize step is Step 0; find the value of the Bellman-Ford algorithm’s Third step (Step
3). Note that the weight of an edge is not fixed; instead, it will be changed following the rule:
The weight of the cell/edge where the sum of the row and column index is an odd number will be reduced
by 1 after every 2 step of calculation (if the weight is 1, it cannot reduce more). For instance, at the first and
second steps, the value of cell (1, 2) a.k.a edge (A, B) is 8, and when calculating at the third and fourth steps,
it will be 7 and will be further decreased to 6 when calculating fifth and sixth, . . .
A. 0,5,3,1,4,2,3 B. 0,4,3,1,4,1,2 C. 0,8,3,1,5,2,3 D. 0,3,2,1,3,1,2

11. (L.O.2.2) Can we remove an edge from H to create H1 so that H1 has an Euler circuit? If yes, what edge can
we remove?
A. Can, remove edge AF B. Can, remove edge BG
C. All the other choices are incorrect D. Cannot
12. (L.O.2.2) Apply BFS from B to find a spanning tree of H. What is the total weight of this spanning tree?
Note: When choosing between multiple vertices, choose according to the alphabet in ascending order.
A. 9 B. 22 C. 12 D. 16
13. (L.O.2.2) Find the minimum spanning tree of H with the root D, we follow the criteria:

• If a child is earlier than its parent in the alphabet, it is a left child, else it is a right child

• There can be more than 1 left child or more than 1 right child.

• When choosing between multiple edges, select the edge with the earliest alphabet in ascending order of
the alphabet list.

What is the in-order traverse of the obtained tree?


A. C F A D B G E B. A C F D B E G C. C F A B G E D D. F C A D G B E
14. (L.O.2.2) Given a set X consisting of sub-graphs S with 6 edges and a vertex A of degree 4. What is the
probability of choosing a graph from X and that is a spanning tree? know that the probability of choosing
the vertices is the same
A. 0.0063 B. 0.4222 C. 0.0066 D. 0.4444

Stu.ID: .......................................... Stu.Fullname: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Page: 2


15. (L.O.1.2) The degree sequence of a simple graph is the sequence of the degrees of the nodes in the graph in
decreasing order. Which of the following sequences can not be the degree sequence of any graph?
(I) 7,6,5,5,5,4,4,2,2; (II)7,6,6,6,4,4,2,2; (III) 8,7,7,6,4,2,2,1,1; (IV)9,9,6,6,6,6,5,4,3,2
A. II and III. B. I and IV. C. I only. D. II and IV.

16. (L.O.2.2) Consider a team chess match, knowing that each team has 5 players, and each player will have to
play games against every player from the opponent team. The team that has more wins in the match is the
winning team, and the probability of winning for each player is the same. What kind of graph represents the
match, and what is the probability of there being a winning team?
A. K5,5 , 0.589 B. All the others answers are incorrect
C. W5.5 , 0.422 D. K5,5 , 0.5

17. (L.O.1.2) How many arrangements of the letters in ABRACADABRA have no A adjacent to a B?
A. 3360 B. 5660 C. 5520 D. 5880
18. (L.O.3.2) Consider the weighted directed graph G

The total weights of the edges of the shortest paths from vertex A to vertices B, C, D, E, and F , respectively,
are
A. 3, 7, 4, 5, and 7. B. 3, 5, 2, 4, and 7.
C. 3, 7, 2, 4, and 7. D. The shortest paths do not exist.

19. (L.O.1.2) How many ways are there to select five bills from a cash box containing $1, $2, $5, $10, $20,
$50, and $100 bills? Assume that the order in which the bills are chosen does not matter; the bills of each
denomination are indistinguishable, and there are at least five bills of each type.
A. 792 B. 462 C. 330 D. 1287
20. (L.O.1.2) Given the following graph,

What is the shortest path (total weight) from A to the remaining vertices B, C, D, E, F:

A. −4, −4, −1, −2, 0. B. −4, −5, 1, −1, 0. C. −5, −4, −1, −3, 0. D. Another answer.

21. (L.O.2.2) A building has a ground floor G and other four floors marked 1,2,3,4. Seven people get in the
elevator at G. How many ways can they get out of the elevator on the remaining floors if

(a) every floor has at least one person get out and,

(b) the order of the people coming out on the same floors does not matter

A. 4800. B. 8400. C. 1319. D. 1913.


22. (L.O.2.2) How many binary strings of length 8 do not contain at least six consecutive 1s?
A. 250. B. 248. C. 249. D. 246.

Stu.ID: .......................................... Stu.Fullname: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Page: 3


23. (L.O.3.1) How many internal vertices are in a full 5-ary tree with 101 leaves?
A. 28 B. 33 C. 25 D. 30
24. (L.O.3.2) Consider the weighted undirected graph G

What is the total weight of the minimum spanning tree rooted at A obtained using Prim’s algorithm?
A. 15 B. 18 C. 12 D. 30
25. (L.O.1.2) Let’s consider an undirected graph given by the following adjacency list.

Vertex Adjacent vertices


a b, d, f
b a, c, e
c b, d, h
d a, c, g
e b, f, h
f a, e, g
g d, f, h
h c, e, g
Which of the following assessments is correct?
A. The graph has no Euler circuit. B. The graph is bipartite.
C. The graph has a Hamilton circuit. D. All answers are correct.

Stu.ID: .......................................... Stu.Fullname: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Page: 4


Solution 2228
1. A. 8. A. 14. B. 21. B.
2. D. 9. B. 15. A.
22. B.
3. B. 16. B.
4. B. 10. B. 17. D. 23. C.
5. D. 11. B. 18. B.
24. A.
6. B. 12. B. 19. B.
7. D. 13. B. 20. C. 25. D.

Stu.ID: .......................................... Stu.Fullname: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Page: 1

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy