Cuoiki
Cuoiki
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
• 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.
(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
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:
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
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.
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
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
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.
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
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):
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.
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.
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:
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
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.
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:
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
(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
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
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.
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):
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.
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
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
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):
• 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.
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
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.
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
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
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.
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
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
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
• 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.
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
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):
• 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.
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
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.
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 .
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
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
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.
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:
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
For questions 7–11, consider the following adjacency matrix for the simple undirected graph H (the weight 0
means no connection):
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 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.
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 .
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.
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
2. C. 8. A. 15. C.
22. C.
3. A. 9. A. 16. B.
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:
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.
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.
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
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.