Chapter 1
Discrete Structures
TU BSc CSIT past exam questions
Past questions and answers
75 questions set from this chapter; 6 are most repeated (set, or a close variant set, in 3 or more exams). Most repeated first.
- Most repeated · 3 of 7 exams
- 2075 · 5 marks
Solve the recurrence relation a_n = 5a_n-1 – 6a_n-2 with initial conditions a_0 = 1 and a_1 = 2.
Similar questions: Solve the recurrence relation a_n = 5a_n-1 (2078) · Solve the recurrence relation a_n = a_n−1 (2081)
Answer
The recurrence is , a linear homogeneous recurrence of order 2.
Characteristic equation
The roots are distinct, so the general solution is
Using the initial conditions
From the first, . Substituting: , so .
Check: and .
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- Most repeated · 3 of 7 exams
- 2075 · 5 marks
Find the value of x such that x = 1 (mod 5) and x = 2 (mod 7) using Chinese remainder theorem.
Similar questions: Find the value of x such that (2076) · Use Chinese Remainder Theorem to find the (2079)
Answer
We solve and . The moduli 5 and 7 are coprime, so the Chinese remainder theorem applies.
Step 1. , , .
Step 2. Inverses
- with : , and , so .
- with : , so .
Step 3. Combine
Check: and .
Hence (the general solution is , ).
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- Most repeated · 3 of 7 exams
- 2076 · 10 marks
Find the value of x such that x = 1 (mod 3), x = 1 (mod 4), x = 1 (mod 5) and x = 0 (mod 7) using Chinese remainder theorem.
Similar questions: Find the value of x such that (2075) · Use Chinese Remainder Theorem to find the (2079)
Answer
We solve
The moduli are pairwise coprime, so the Chinese remainder theorem applies.
.
| inverse of | |||
|---|---|---|---|
| 3 | 1 | 140 | , , so |
| 4 | 1 | 105 | , so |
| 5 | 1 | 84 | , , so |
| 7 | 0 | 60 | not needed since |
Check: , , , .
So (general solution ).
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- Most repeated · 3 of 7 exams
- 2078 · 5 marks
Solve the recurrence relation a_n = 5a_n-1 – 6a_n-2 with initial conditions a_0 = 1, a_1 = 4.
Similar questions: Solve the recurrence relation a_n = 5a_n-1 (2075) · Solve the recurrence relation a_n = a_n−1 (2081)
Answer
The recurrence is linear, homogeneous, with constant coefficients.
Characteristic equation:
The roots are distinct, so the general solution is
Using the initial conditions:
- :
- :
Subtracting twice the first equation from the second gives , so .
Check: . From the recurrence , and the formula gives . ✓
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- Most repeated · 3 of 7 exams
- 2079 · 5 marks
Use Chinese Remainder Theorem to find the value of x such that x = 0 ( MOD 2) , x = 2 (MOD 3) and x = 3 (MOD 5).
Similar questions: Find the value of x such that (2075) · Find the value of x such that (2076)
Answer
Solve , , .
The moduli 2, 3, 5 are pairwise coprime, so the Chinese Remainder Theorem applies.
For each modulus let and find with .
| (inverse of mod ) | ||||
|---|---|---|---|---|
| 1 | 0 | 2 | 15 | |
| 2 | 2 | 3 | 10 | |
| 3 | 3 | 5 | 6 |
Check: , , . ✓
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- Most repeated · 3 of 7 exams
- 2081 · 5 marks
Solve the recurrence relation a_n = a_n−1 + 2a_n−2 with initial conditions a_0 = 2 and a_1 = 7.
Similar questions: Solve the recurrence relation a_n = 5a_n-1 (2075) · Solve the recurrence relation a_n = 5a_n-1 (2078)
Answer
Recurrence: , , .
This is a linear homogeneous recurrence with constant coefficients. The characteristic equation is
The general solution is
Use the initial conditions:
Adding: , so and .
Check: , and the formula gives . ✓
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2076 · 10 marks
State pigeonhole principle. Solve the recurrence relation a_n = 3a_n-1 – 3a_n-2 + a_n-3 with initial conditions a_0=1 ,a_1 = 3, a_2=7.
Similar questions: State pigeonhole principle. Solve the recurrence relation (2080)
Answer
Pigeonhole principle
If or more objects are placed into boxes, then at least one box contains two or more objects.
Generalised form: if objects are placed into boxes, some box contains at least objects. Example: among any 13 people, at least two were born in the same month (13 objects, 12 boxes).
Solving the recurrence
Characteristic equation: so is a root of multiplicity 3. The general solution is
Initial conditions:
- : .
- : .
- : .
Subtracting gives , then .
Check: and .
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2079 · 5 marks
Find the GCD of 24 and 32 using Extended Euclidean algorithm.
Similar questions: Find the GCD of 12 and 16 (2081)
Answer
Find and express it as a linear combination of 24 and 32.
Euclidean algorithm (forward):
The last non-zero remainder is 8, so .
Back substitution: from the first line,
So (coefficient of 24) and (coefficient of 32) satisfy .
Check: . ✓
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2080 · 10 marks
State pigeonhole principle. Solve the recurrence relation a_n = 5a_n-1 – 6a_n-2 with initial conditions a_0 = 1 and a_1 = 3.
Similar questions: State pigeonhole principle. Solve the recurrence relation (2076)
Answer
(a) Pigeonhole principle. If or more objects (pigeons) are placed into boxes (pigeonholes), then at least one box contains at least two objects.
Generalised form: if objects are placed into boxes, then some box contains at least objects.
Example: among any 13 people, at least two were born in the same month, because .
(b) Recurrence , , .
Characteristic equation:
General solution: .
- : .
- : .
From the first, , so and .
Check: . ✓
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2081 · 5 marks
Find the GCD of 12 and 16 using Extended Euclidean Algorithm.
Similar questions: Find the GCD of 24 and 32 (2079)
Answer
GCD of 12 and 16 by the Extended Euclidean Algorithm.
Euclidean steps:
The last non-zero remainder is 4, so .
Back-substitution: from the first line,
So with .
Check: . ✓
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2075 · 10 marks
Consider a set U = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}. What will be the computer representation for set containing the numbers which are multiple of 3 not exceeding 6? Describe injective, Surjective and bijective function with example.
Answer
Computer representation of the set
The universal set is . A subset is stored as a bit string of length 10, where bit is 1 if element belongs to the set and 0 otherwise.
The multiples of 3 not exceeding 6 are and , so .
| Element | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
|---|---|---|---|---|---|---|---|---|---|---|
| Bit | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 |
With this representation union is bitwise OR, intersection is bitwise AND and complement is bitwise NOT.
Types of functions (let )
Injective (one-to-one): different elements of have different images, i.e. . Example: , . If then . It is not onto, because even numbers are never obtained.
Surjective (onto): every element of is the image of at least one element of , i.e. range = codomain. Example: , is onto, since every equals . It is not injective because .
Bijective: the function is both injective and surjective, so each element of has exactly one pre-image. Example: , . For any , is the unique pre-image. A bijection has an inverse function, here .
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2075 · 10 marks
Compute the following values.
a. 3 mod 4 b. 7 mod 5 c. -5 mod 3 d. 11 mod 5 e. -8 mod 6
Write down the recursive algorithm to find the value of b^n and prove its correctness using induction.
Answer
(a) Values of mod
The remainder in always satisfies .
- , since .
- , since .
- , since .
- , since .
- , since .
(b) Recursive algorithm for
procedure power(b, n) // b real, n non-negative integer
if n = 0 then
return 1
else
return b * power(b, n - 1)
Proof of correctness by induction on
Claim: for all .
Basis (): the algorithm returns .
Inductive step: assume for some (inductive hypothesis). For the algorithm returns
So the claim holds for . By mathematical induction the algorithm correctly computes for every . It makes multiplications, so it runs in time.
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2075 · 5 marks
Prove that 5^n-1 is divisible by 4 using mathematical induction.
Answer
Claim: is divisible by 4 for every integer .
Basis step (): , which is divisible by 4. So is true.
Inductive step: assume is true for some , i.e. for some integer . Then , and
Since is an integer, is divisible by 4, so is true.
By the principle of mathematical induction, is divisible by 4 for all .
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2075 · 5 marks
Let A = “Aldo is Italian” and B = “Bob is English”. Formalize the following sentences in proposition.
- Aldo isn’t Italian.
- Aldo is Italian while Bob is English.
- If Aldo is Italian then Bob Bob is not English.
- Aldo is Italian or if Aldo isn’t Italian then Bob is English.
- Either Aldo is Italian and Bob is English, or neither Aldo is Italian nor Bob is English.
Answer
Let = "Aldo is Italian" and = "Bob is English".
- Aldo isn't Italian:
- Aldo is Italian while Bob is English ("while" means "and"):
- If Aldo is Italian then Bob is not English:
- Aldo is Italian or, if Aldo isn't Italian, then Bob is English: This simplifies to .
- Either Aldo is Italian and Bob is English, or neither is: This is equivalent to the biconditional .
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2075 · 5 marks
Define Eular path and Hamilton path with examples. Draw the Hasse diagram for the divisible relation on the set { 1, 2, 5, 8, 16, 32} and find the maximal, minimal, greatest and least element if exist.
Answer
Euler path: a path in a graph that uses every edge exactly once. If it starts and ends at the same vertex it is an Euler circuit. A connected graph has an Euler circuit iff every vertex has even degree, and an Euler path (not circuit) iff exactly two vertices have odd degree. Example: the "envelope" graph, or a triangle ---, which has the Euler circuit . For the graph with edges , the degrees are , so exactly two odd vertices (, ), and is an Euler path.
Hamilton path: a path that visits every vertex exactly once. If it returns to the start it is a Hamilton circuit. Example: in the square (cycle ) with vertices and edges , the path is a Hamilton path and is a Hamilton circuit.
Hasse diagram of divisibility on
Divisibility relations: divides everything; ; ; ; divides only itself and nothing else in the set. The covering pairs are .
32
|
16
|
8
|
2 5
\ /
1
- Maximal elements: and (nothing above them).
- Minimal element: .
- Greatest element: none, because and are not comparable, so no single element is above all.
- Least element: , since divides every element.
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2075 · 5 marks
What does primality testing means? Describe how Fermat’s Little Theorem tests for a prime number with suitable example.
Answer
Primality testing means deciding whether a given integer is prime (has no divisors other than 1 and ) or composite. For large (as in RSA key generation) trial division is too slow, so fast tests such as Fermat's test are used.
Fermat's Little Theorem: if is prime and is an integer not divisible by , then
Test: to test , pick a base with and , and compute by fast modular exponentiation.
- If the result is not 1, then is definitely composite.
- If the result is 1, then is probably prime. Repeat with other bases to raise confidence.
Example 1 (, ): , so . This is not 1, so 15 is composite.
Example 2 (, ): , so . It passes, and 11 is indeed prime.
Limitation: the converse of the theorem is false. Composite numbers that pass the test for a base are pseudoprimes (e.g. for ), and Carmichael numbers such as pass for every base coprime to them. So a pass shows only "probably prime".
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2075 · 5 marks
List any two applications of conditional probability. You have 9 families you would like to invite to a wedding. Unfortunately, you can only invite 6 families. How many different sets of invitations could you write?
Answer
Two applications of conditional probability
- Medical diagnosis: the probability that a patient has a disease given a positive test result, , is found using Bayes' theorem, which is built on conditional probability.
- Spam filtering: the probability that an email is spam given that it contains certain words, (naive Bayes classifier).
(Others: quality control in manufacturing, weather forecasting, risk assessment in insurance.)
Number of invitation sets
Choosing which 6 of the 9 families to invite is a combination (order does not matter):
So 84 different sets of invitations can be written.
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2075 · 5 marks
Define spanning tree and minimum spanning tree. Mention the conditions for two graphs for being isomorphic with an example.
Answer
Spanning tree: for a connected graph , a spanning tree is a subgraph that contains all the vertices of , is connected, and has no cycles (so it is a tree). A graph with vertices has a spanning tree with exactly edges.
Minimum spanning tree (MST): for a connected weighted graph, the spanning tree whose total edge weight is the smallest among all spanning trees. It is found by Kruskal's or Prim's algorithm.
Isomorphic graphs: and are isomorphic if there is a bijection such that are adjacent in iff are adjacent in .
Necessary conditions (if any fails, the graphs are not isomorphic):
- The same number of vertices.
- The same number of edges.
- The same degree sequence.
- The same number of cycles of each length and the same connectivity.
These conditions are necessary but not sufficient, so finally an explicit adjacency-preserving bijection must be exhibited.
Example: has edges and has edges . Both have 4 vertices, 4 edges and all degrees 2. The map sends , so every edge maps to an edge. Hence (both are the cycle ).
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2075 · 5 marks
Prove that the product xy is odd if and only if both x and y are odd integers .
Answer
Claim: for integers , the product is odd if and only if both and are odd.
() If is odd then and are both odd. We prove the contrapositive: if or is even, then is even. Suppose is even, . Then , which is even. The case even is the same by symmetry. So if is odd, neither can be even, so both are odd.
() If and are both odd then is odd. Let and . Then which has the form , so is odd.
Both directions hold, so is odd iff both and are odd.
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2076 · 5 marks
Prove that for every positive integer n ≥ 1, n^2+n is even integer using mathematical induction.
Answer
Claim: is even for every integer .
Basis (): , which is even.
Inductive step: assume is even for some , say . Then which is even.
By mathematical induction, is even for all .
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2076 · 5 marks
All over smart people are stupid. Children of stupid people are naughty. John is a children of Jane. Jane is over smart. Represent these statements in FOPL and prove that John is naughty.
Answer
Predicates: : is over smart; : is stupid; : is a child of ; : is naughty.
Statements in FOPL
- All over smart people are stupid:
- Children of stupid people are naughty:
- John is a child of Jane:
- Jane is over smart:
Proof that
| Step | Statement | Reason |
|---|---|---|
| 1 | Premise | |
| 2 | Universal instantiation of 1 with | |
| 3 | Premise | |
| 4 | Modus ponens on 2, 3 | |
| 5 | Premise | |
| 6 | Universal instantiation of 5 | |
| 7 | Premise | |
| 8 | Conjunction of 7, 4 | |
| 9 | Modus ponens on 6, 8 |
Hence John is naughty.
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2076 · 5 marks
Which of the following are possets?
- (Z, =)
- (Z, ≠)
- (Z, ⊆)
Answer
A poset needs to be reflexive, antisymmetric and transitive on .
: reflexive (), antisymmetric ( and imply ) and transitive. It is a poset.
: not reflexive, since is false. It is also not antisymmetric: and both hold, yet . It is not a poset.
: the relation is defined between sets, and integers are not sets, so is not a relation on and the structure is not a poset. (If the intended structure were the power set , it would be a poset, since is reflexive, antisymmetric and transitive.)
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2076 · 5 marks
Define reflexive closure and symmetric closure. Find the remainder when 4x^2 – x + 3 is divided by x + 2 using remainder theorem.
Answer
Reflexive closure: the reflexive closure of a relation on a set is the smallest reflexive relation containing : Example: , . The reflexive closure is .
Symmetric closure: the smallest symmetric relation containing : For the same , the symmetric closure is .
Remainder theorem: when a polynomial is divided by , the remainder is .
Here and the divisor is , so :
The remainder is .
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2076 · 5 marks
Define Euler path and Hamilton path. Give examples of both Euler and Hamilton path.
Answer
Euler path: a path that uses every edge of the graph exactly once. If it begins and ends at the same vertex it is an Euler circuit. A connected graph has an Euler circuit iff all vertices have even degree, and an Euler path that is not a circuit iff exactly two vertices have odd degree.
Example: the graph with vertices and edges has degrees . Exactly two vertices are odd, so it has an Euler path: (all four edges used once). A triangle has the Euler circuit .
Hamilton path: a path that visits every vertex exactly once (edges may be left unused). If it returns to its start it is a Hamilton circuit.
Example: in the cycle with vertices and edges , the path is a Hamilton path, and adding the edge gives a Hamilton circuit. In the graph above, is a Hamilton path.
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2076 · 5 marks
How many 3 digits numbers can be formed from the digits 1,2,3,4 and 5 assuming that:
- Repetitions of digits are allowed
- Repetitions of digits are not allowed
Answer
We form 3-digit numbers from the digits (5 digits), using the multiplication principle on the three positions.
(a) Repetition allowed: each of the 3 positions can be filled in 5 ways.
(b) Repetition not allowed: the first position has 5 choices, the second 4, the third 3.
So there are 125 numbers with repetition and 60 without.
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2076 · 5 marks
What is minimum spanning tree? Explain Kruskal’s algorithm for finding minimum spanning tree.
Answer
Minimum spanning tree (MST): for a connected, weighted, undirected graph, a spanning tree (connected, acyclic, containing all vertices) whose total edge weight is minimum among all spanning trees.
Kruskal's algorithm (greedy, edge-based)
- Sort all edges in non-decreasing order of weight.
- Start with an empty forest (each vertex is its own component).
- Take the next smallest edge. If it joins two different components (adding it creates no cycle), add it to ; otherwise discard it.
- Stop when has edges (for vertices).
KRUSKAL(G):
T = empty set
sort edges of G by weight
for each edge (u, v) in sorted order:
if find(u) != find(v): // different components
T = T + {(u, v)}
union(u, v)
return T
Cycle detection is done efficiently with the union-find structure. Time complexity is , dominated by sorting.
Example: vertices ; edges .
- : accept.
- : accept.
- : rejected, forms the cycle .
- : accept.
- : rejected, forms a cycle.
- : accept. Now 4 edges , so stop.
MST edges: with total weight .
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2076 · 5 marks
List any two applications of graph coloring theorem. Prove that “A tree with n vertices has n-1 edges”
Answer
Two applications of graph colouring
- Scheduling / timetabling: vertices are exams (or classes), an edge joins two that share a student, and colours are time slots. The chromatic number is the minimum number of slots needed.
- Register allocation in compilers: vertices are variables, an edge joins variables live at the same time, and colours are CPU registers.
(Others: map colouring, frequency assignment for radio/mobile towers, Sudoku.)
Theorem: a tree with vertices has edges.
Proof by induction on .
Basis: . A tree with one vertex has edges.
Inductive step: assume every tree with vertices has edges, and let be a tree with vertices. A tree with at least 2 vertices has a leaf (take a longest path; its end vertex has degree 1, otherwise the path could be extended or a cycle would exist). Remove a leaf and its one edge. The result is still connected and acyclic, so it is a tree with vertices, and by the hypothesis it has edges. Adding and its edge back gives edges for .
By induction, every tree with vertices has edges.
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2076 · 5 marks
Define ceiling and floor function. Why do we need Inclusion – Exclusion principle? Make it clear with suitable example.
Answer
Floor and ceiling functions
- The floor is the greatest integer less than or equal to . Example: , .
- The ceiling is the least integer greater than or equal to . Example: , .
Why we need the inclusion-exclusion principle
When counting the elements in a union of sets that overlap, simply adding the sizes counts the common elements more than once. Inclusion-exclusion corrects for this:
Example: how many integers from 1 to 100 are divisible by 2 or 5?
- (divisible by 2)
- (divisible by 5)
- (divisible by 10)
Adding without the correction would give 70, wrongly counting the 10 multiples of 10 twice.
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2078 · 10 marks
Prove that for all integers x and y, if x^2 + y^2 is even then x + y is even. Using induction prove that 1^3 + 2^3 + 3^3 + ………………. + n^3 = n^2(n + 1)^2 / 4
Answer
(a) If is even then is even
Proof by contrapositive. Suppose is odd. Then one of is even and the other is odd; say and . Then which is odd. So if is odd then is odd. By the contrapositive, if is even then is even.
(b) by induction
Basis (): LHS , RHS . True.
Inductive step: assume it holds for : Then for , since . This is the formula for .
By mathematical induction the formula holds for all .
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2078 · 10 marks
State division and remainder algorithm. Suppose that the domain of the propositional function P(x) consists of the integer 0, 1, 2, 3 and 4. Write out each of the following propositions using disjunctions, conjunctions and negations.
- ∃x P(x)
- ∀x P(x)
- ∃x ¬P(x)
- ∀x ¬P(x)
- ¬∃x P(x)
- ¬∀x P(x)
Answer
Division algorithm: if is an integer and is a positive integer, there exist unique integers (quotient) and (remainder) such that Here and . Example: .
Expansions over the domain
- :
- :
- :
- :
- :
- :
By De Morgan's laws, and .
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2078 · 5 marks
What is the coefficient of x^2 in (1 + x)^11? Describe how relation can be represented using matrix.
Answer
Coefficient of in
By the binomial theorem, , so the coefficient of is
Representing a relation by a matrix
Let be a relation from to . Its zero-one matrix is with
Example: , :
Properties read from the matrix:
- is reflexive if all diagonal entries are 1.
- is symmetric if .
- is antisymmetric if with forces .
- Union and intersection correspond to entry-wise OR and AND: , .
- The composite relation is the Boolean product: .
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2078 · 5 marks
Prove that if n is positive integer, then n is odd if and only if 5n + 6 is odd.
Answer
Claim: for a positive integer , is odd is odd. We prove both directions.
(a) If is odd, then is odd (direct proof). Let for some integer . Then
which is of the form , so is odd.
(b) If is odd, then is odd (proof by contrapositive). The contrapositive is: if is even, then is even. Let . Then
which is even. The contrapositive is true, so the original statement is true.
From (a) and (b), is odd if and only if is odd.
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2078 · 5 marks
Define preposition. Consider the argument “John, a student in this class knows how to write program in C. Everyone who knows how to write program in C can get a high paying job. Therefore, someone in this class can get high paying job”. Now, explain which rules of inferences are sed for each step.
Answer
Proposition: a proposition (statement) is a declarative sentence that is either true or false, but not both. For example, "Kathmandu is the capital of Nepal" is a proposition (true). "Close the door" and "What is your name?" are not propositions.
Argument. Let
- : is a student in this class
- : knows how to write a program in C
- : can get a high paying job
Premises: and . Conclusion: .
| Step | Statement | Reason (rule of inference) |
|---|---|---|
| 1 | Premise | |
| 2 | Simplification, from 1 | |
| 3 | Premise | |
| 4 | Universal instantiation, from 3 | |
| 5 | Modus ponens, from 2 and 4 | |
| 6 | Simplification, from 1 | |
| 7 | Conjunction, from 5 and 6 | |
| 8 | Existential generalization, from 7 |
Hence someone in this class can get a high paying job, and the argument is valid.
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2078 · 5 marks
Show that if there are 30 students in a class, then at least two have same names that begin with the same letter. Explain the pascal’s triangle.
Answer
(a) Names beginning with the same letter. Treat the 26 letters of the English alphabet as the pigeonholes (boxes) and the 30 students as the pigeons. Each student is placed in the box for the first letter of his or her name.
Since , the pigeonhole principle says at least one box contains at least students. So at least two students have names beginning with the same letter.
(b) Pascal's triangle. Pascal's triangle is a triangular array in which row (starting from row 0) lists the binomial coefficients . Each entry is the sum of the two entries just above it:
The edges of the triangle are all 1.
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
1 5 10 10 5 1
Properties:
- Row gives the coefficients in the expansion of . For example, .
- The entries of row sum to .
- The triangle is symmetric: .
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2078 · 5 marks
Illustrate the Dijkstra’s Algorithm to find the shortest path from source node to destination node with an example.
Answer
Dijkstra's algorithm finds the shortest path from a source vertex to every other vertex in a weighted graph with non-negative edge weights. It is a greedy algorithm.
Algorithm
- Set and for every other vertex . Mark all vertices unvisited.
- Choose the unvisited vertex with the smallest and mark it visited.
- For each unvisited neighbour of , if , update and record as the predecessor of .
- Repeat from step 2 until the destination is visited (or all vertices are visited).
Example. Edges: , , , , , , , , . Source , destination .
| Visited vertex | |||||
|---|---|---|---|---|---|
| start ( = 0) | |||||
| (0) | 7 | 9 | 14 | ||
| (7) | 7 | 9 | 22 | 14 | |
| (9) | 7 | 9 | 20 | 11 | |
| (11) | 7 | 9 | 20 | 20 | 11 |
| (20) | 7 | 9 | 20 | 20 | 11 |
Vertex is reached with distance 20 through , and was reached through , which was reached from .
Shortest path from to : , with length .
The other shortest distances are , , , (path ).
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2078 · 5 marks
What are the significance of Minimum Spanning Tree? Describe how Kruskal’s algorithm can be used to find the MST.
Answer
Minimum spanning tree (MST). A spanning tree of a connected weighted graph is a subgraph that includes all vertices, is connected and has no cycle (so it has edges for vertices). The MST is the spanning tree with the least total edge weight.
Significance
- It gives the cheapest way to connect all nodes, for example laying cable, roads, pipelines or electric lines between towns.
- It is used in designing computer and telecommunication networks with minimum wiring cost.
- It is used in clustering, image segmentation and as a step in approximation algorithms (for example the travelling salesman problem).
- It helps remove redundant links while keeping the network connected.
Kruskal's algorithm (greedy, edge-based)
- Sort all edges in non-decreasing order of weight.
- Start with an empty set of edges.
- Take the next smallest edge. If adding it to does not create a cycle, add it; otherwise discard it.
- Stop when has edges.
Cycle detection is done with a disjoint-set (union-find) structure. Running time is .
Example. Edges: , , , , , , , , (6 vertices, so 5 edges are needed).
| Edge | Weight | Decision |
|---|---|---|
| 2 | accept | |
| 6 | accept | |
| 7 | accept | |
| 9 | accept (joins and ) | |
| 9 | accept (joins and ) |
Five edges have been chosen, so the algorithm stops. The remaining edges would create cycles.
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2078 · 5 marks
Define zero-one matrix. Explain the types of function.
Answer
Zero-one matrix. A zero-one (Boolean) matrix is a matrix whose every entry is either 0 or 1. Such matrices are used to represent relations and graphs. For example,
is a zero-one matrix. Operations on them include join (entrywise OR), meet (entrywise AND) and the Boolean product .
Types of functions. Let .
- One-to-one (injective): different elements of have different images, so . Example: on .
- Onto (surjective): every element of is the image of at least one element of , so the range equals . Example: from to .
- One-to-one correspondence (bijective): both injective and surjective. Only a bijective function has an inverse .
- Constant function: for all .
- Identity function: for all .
- Inverse function: for a bijection , iff .
- Composite function: .
- Into function: a function that is not onto.
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2078 · 5 marks
Represent any three set operations using Venn-diagram. Give a recursive defined function to find the factorial of any given positive integer.
Answer
(a) Set operations using Venn diagrams. Let be the universal set (the rectangle) and , two overlapping circles inside it.
- Union : the elements in , or in , or in both. Shade both circles completely.
- Intersection : the elements in both and . Shade only the lens-shaped overlap of the two circles.
- Difference : the elements in but not in . Shade the part of circle outside the overlap.
- Complement : the elements of not in . Shade everything in the rectangle outside circle .
+---------------------------+
| U |
| ( A (////) B ) | //// = A ∩ B (shaded)
| |
+---------------------------+
(b) Recursively defined factorial.
The first line is the basis step and the second is the recursive step. For example, .
As a function in C:
long factorial(int n) {
if (n == 0) /* basis */
return 1;
return n * factorial(n - 1); /* recursive step */
}
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2079 · 10 marks
How do you plot the function on graph? Determine whether the function f(x) = x^2 is injective, surjective or bijective with reasons. Solve the recurrence relation a_n = 6a_n-1 – 9a_n-2 with initial conditions a_0 = 1 and a_1 = 6.
Answer
(a) Plotting a function on a graph.
- Choose the domain and make a table of values of and .
- Treat each pair as a point on the Cartesian plane.
- Plot the points and join them by a smooth curve (for a continuous function on ), or leave them as separate dots (for a function on integers).
For :
| 9 | 4 | 1 | 0 | 1 | 4 | 9 |
Plotting these gives a U-shaped parabola with its vertex at the origin, symmetric about the -axis.
(b) with .
- Injective? No. but .
- Surjective? No. There is no real with , so negative numbers are not in the range .
- Bijective? No, because it is neither injective nor surjective.
(Restricting to makes it bijective.)
(c) Recurrence , , .
Characteristic equation: , giving a repeated root . The general solution is
- : .
- : .
Check: and the formula gives . ✓
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2079 · 10 marks
A group of 8 scientist is composed of 5 chemist and 3 biologist. In how many ways can a committe of 5 be formed that has 3 chemist and 2 biologist? Using mathematical induction prove that 1^3 + 2^3 + 3^3 + ……………….. + n^3 = n^2(n + 1)^2 / 4) for n ≥ 1.
Answer
(a) Committee selection. Choose 3 chemists from 5 and 2 biologists from 3:
There are 30 ways.
(b) Prove by induction that for .
Basis step (): LHS , RHS . True.
Inductive hypothesis: assume for some
Inductive step: we show it for . Adding to both sides:
which is the formula with .
By the principle of mathematical induction, the formula holds for all .
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2079 · 5 marks
List any one example of tautology. Represent the following sentences into predicate logic.
- Not all employees are loyal
- All students having good attitude are lovable.
Answer
Example of a tautology. A tautology is a compound proposition that is true for every assignment of truth values. An example is :
| T | F | T |
| F | T | T |
Predicate logic.
(a) Not all employees are loyal. Let : is an employee and : is loyal.
(b) All students having good attitude are lovable. Let : is a student, : has good attitude, : is lovable.
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2079 · 5 marks
Prove that “If the product of two integers a and b are even then either a is even or b is even”, using the contradiction method.
Answer
Claim: if the product of two integers is even, then is even or is even.
Proof by contradiction. Suppose, for contradiction, that is even but neither nor is even, that is, both and are odd.
Write and for integers . Then
which is odd. This contradicts the assumption that is even.
So the supposition is false, and at least one of , must be even.
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2079 · 5 marks
Define bipartile graph with example. State the necessary conditions for the graphs to be isomorphic.
Answer
Bipartite graph. A graph is bipartite if its vertex set can be split into two disjoint sets and such that every edge joins a vertex in to a vertex in . No edge joins two vertices of the same set. Equivalently, the graph has no odd-length cycle, and its vertices can be coloured with two colours so that adjacent vertices differ.
Example. Take , and edges . Every edge goes between and , so the graph is bipartite. The complete bipartite graph has every vertex of joined to every vertex of .
Conditions for two graphs and to be isomorphic. There must be a one-to-one correspondence between their vertices that preserves adjacency. The following are necessary conditions (if any fails, the graphs are not isomorphic):
- The same number of vertices.
- The same number of edges.
- The same degree sequence (the same number of vertices of each degree).
- The same number of cycles of each length (for example both have a triangle, or neither does).
- If one is connected, the other is connected; they have the same number of components.
- The same invariants such as the circuit/path structure, and bipartiteness.
These conditions are necessary but not sufficient, so to prove isomorphism an explicit adjacency-preserving mapping must be given.
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2079 · 5 marks
Given the premises “If it rains or strike holds then the exam will be cancelled. If the doesn’t rain then it will be sunny day. The exam was not cancelled. show that it is sunny day”.
Answer
Let
- : it rains
- : the strike holds
- : the exam is cancelled
- : it is a sunny day
Premises:
Conclusion: .
| Step | Statement | Reason |
|---|---|---|
| 1 | Premise | |
| 2 | Premise | |
| 3 | Modus tollens, from 1 and 2 | |
| 4 | De Morgan's law, from 3 | |
| 5 | Simplification, from 4 | |
| 6 | Premise | |
| 7 | Modus ponens, from 5 and 6 |
Hence it is a sunny day.
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2079 · 5 marks
Find the value of -2 MOD 3 and 3^1^5 MOD 5. Illustrate an example to show the join operation between any two boolean matrixes.
Answer
(a) . Write with . So
(b) . , , , . Since ,
So .
(c) Join of two Boolean matrices. The join is the entrywise OR: (1 if either entry is 1). Both matrices must have the same size.
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2079 · 5 marks
Given an example of fallacy. State the necessary and sufficient conditions for a graph to have Euler path and Euler circuit.
Answer
Fallacy. A fallacy is an incorrect argument that looks like valid reasoning. Example of the fallacy of affirming the conclusion:
"If it rains, the ground is wet. The ground is wet. Therefore it rained."
In symbols, is not a tautology (take false, true). The ground may be wet because of a sprinkler. Another common fallacy is denying the hypothesis: .
Euler path and Euler circuit. An Euler circuit is a closed walk that uses every edge exactly once; an Euler path is a walk that uses every edge exactly once and need not return to the start. For a graph with edges, the graph must be connected (ignoring isolated vertices).
- Euler circuit exists if and only if is connected and every vertex has even degree.
- Euler path (not a circuit) exists if and only if is connected and has exactly two vertices of odd degree. The path must start at one odd vertex and end at the other.
For directed graphs: an Euler circuit exists iff the graph is (weakly) connected and for every vertex in-degree equals out-degree.
Example. The 4-cycle has all vertices of degree 2, so it has an Euler circuit. A path graph on 3 vertices has two odd (degree 1) vertices, so it has an Euler path but no circuit.
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2080 · 10 marks
Explain strong induction in detail. What is recursively defined function? Use mathematical induction to prove 7^n+2 + 8^2^n+1 is divisible by 57.
Answer
(a) Strong induction. Strong (complete) induction proves a statement for all integers in two steps.
- Basis step: prove (sometimes several base cases are needed).
- Inductive step: assume are all true (the strong hypothesis), and prove .
In ordinary induction only is assumed. Both are equivalent in power, but strong induction is convenient when depends on several earlier cases, not just the previous one. Examples: every integer is a product of primes; every postage amount of 12 Rs or more can be made with 4 Rs and 5 Rs stamps.
(b) Recursively defined function. A function is recursively defined if its value at is given in terms of its values at smaller arguments, with some initial values stated explicitly.
- Basis: specify (or the first few values).
- Recursive step: a rule to compute from
Example: , defines . The Fibonacci function , , is another.
(c) Prove is divisible by 57 for all .
Basis (): . True.
Hypothesis: assume is divisible by 57 for some .
Step:
The first term is divisible by 57 by the hypothesis, and the second term clearly is. So is divisible by 57.
By mathematical induction the statement holds for all .
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2080 · 5 marks
Explain the principle of inclusion and exclusion. How many integers from 1 to 30 are multiples of 2 or 3?
Answer
Principle of inclusion and exclusion. To count the elements in a union of sets, add the sizes of the sets and then correct for the overlaps counted more than once.
For two sets:
For three sets:
In general, sizes of intersections of an odd number of sets are added and those of an even number are subtracted.
Multiples of 2 or 3 from 1 to 30. Let be the multiples of 2 and the multiples of 3.
- = multiples of 6
There are 20 such integers.
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2080 · 5 marks
Give the example of ceiling, floor and boolean function. How do you plot the graph of the function?
Answer
Floor function. is the greatest integer less than or equal to . Example: , .
Ceiling function. is the smallest integer greater than or equal to . Example: , .
Boolean function. A function . Example: , with values
| 0 | 0 | 1 |
| 0 | 1 | 1 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
Plotting the graph of a function.
- Fix the domain and make a table of and values.
- Draw the -axis and -axis with a suitable scale.
- Plot each point .
- Join the points: with a smooth curve if the function is continuous, but for a step function such as the floor function, draw horizontal segments with a filled dot at the left end and an open dot at the right end.
For example, :
| 0 | 1 | 2 |
The graph is a staircase of unit-length horizontal steps, rising by 1 at each integer. For a Boolean function the graph consists of isolated points.
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2080 · 5 marks
Using Chinese remainder theorem solve the following congruences.
x = 1 (MOD 3)
x = 3 (MOD 5)
x = 6 (MOD 7)
Answer
Solve , , .
The moduli are pairwise coprime, so apply the Chinese Remainder Theorem.
| with | ||||
|---|---|---|---|---|
| 1 | 1 | 3 | 35 | , and , so |
| 2 | 3 | 5 | 21 | , so |
| 3 | 6 | 7 | 15 | , so |
Check: , , . ✓
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2080 · 5 marks
Find the multiplicative inverse of 4 in Z_11 using extended euclidean algorithm.
Answer
Find in , that is, with . Since the inverse exists.
Euclidean algorithm:
Back substitution:
Taking this modulo 11: .
Check: . ✓
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2080 · 5 marks
Express the following sentences using quantifier.
a. Not all people are loyal.
b. Everybody loves somebody.
c. Someone has passed the exam.
d. Aquatic animals can’t live without water.
e. Some subjects are not interesting.
Answer
(a) Not all people are loyal. Let : is loyal (domain: people).
(b) Everybody loves somebody. Let : loves (domain: people).
(c) Someone has passed the exam. Let : has passed the exam.
(d) Aquatic animals can't live without water. Let : is an aquatic animal and : can live without water.
(e) Some subjects are not interesting. Let : is a subject and : is interesting.
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2080 · 5 marks
What is proof by contradiction? Give a proof by contradiction to show that if 3n+2 is odd then n is odd.
Answer
Proof by contradiction. To prove a statement , we assume that is false (that is, holds) and reason logically until we reach a contradiction, either with a known fact or with the assumption itself. Since the assumption leads to an impossible situation, must be false and so is true. For an implication we assume is true and is false, and derive a contradiction.
Claim: If is odd, then is odd.
Proof. Suppose is odd but is not odd, that is, is even. Then for some integer , and
which is even. This contradicts the hypothesis that is odd. So our assumption that is even is false, and therefore is odd.
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2080 · 5 marks
State the necessary conditions for two graphs to be isomorphic. How many different words from “MANAGER” can be generated with or without meaning?
Answer
Necessary conditions for two graphs and to be isomorphic. If , then there is a one-to-one, onto mapping of vertices that preserves adjacency, so the following isomorphism invariants must be equal in both graphs:
- The same number of vertices.
- The same number of edges.
- The same degree sequence (the same number of vertices of each degree).
- The same number of connected components.
- Corresponding subgraph structure is preserved, for example the same number of cycles of each length, and a circuit or a simple cycle of a given length exists in both.
These conditions are necessary but not sufficient: if any one of them fails the graphs are not isomorphic, but if all hold the graphs may still be non-isomorphic.
Number of words from MANAGER. The word has 7 letters, in which A occurs twice and every other letter (M, N, G, E, R) once. The number of different arrangements (with or without meaning) is
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2080 · 5 marks
Define symmetric closure. What is the symmetric closure of the relation R = {(1,1), (1,2), (2,2), (2,3), (3,1), (3,2)} on the set A = {1,2,3}?
Answer
Symmetric closure. The symmetric closure of a relation on a set is the smallest symmetric relation on that contains . It is obtained by adding to every pair for which , that is,
Given: on .
The inverse relation is
Hence
Check: ; ; all occur together, and are self-paired, so the relation is symmetric.
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2081 · 10 marks
list any four rules of inference. Using direct and indirect proof show that, for any real number x, if x^3 – 7x^2 + x – 7 = 0, then x = 7.
Answer
Rules of inference (any four).
| Rule | Form |
|---|---|
| Modus ponens | |
| Modus tollens | |
| Hypothetical syllogism | |
| Disjunctive syllogism | |
| Addition | |
| Simplification |
Claim: For real , if then .
First factor the polynomial:
Direct proof. Assume . Then . For real , , so and . Dividing by gives , so .
Indirect proof (contrapositive). We prove: if then . Let . Then , and . The product of two non-zero real numbers is non-zero, so
that is, . The contrapositive is true, so the original statement is true.
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2081 · 10 marks
What are the necessary and sufficient conditions for graphs to have Euler path only and Euler circuit? Let R be a relation defined on set of natural numbers N, such that a,b∈N,aRb ⟺ ab=2k, where k ∈ {0,1,2,…}. Show that R is a partial ordering relation on N.
Answer
Euler path and Euler circuit. Let be a connected graph (ignoring isolated vertices).
- Euler circuit exists if and only if is connected and every vertex has even degree.
- Euler path only (a path that is not a circuit) exists if and only if is connected and has exactly two vertices of odd degree. The path must start at one odd vertex and end at the other.
(For a directed graph: a circuit needs in-degree equal to out-degree at every vertex; a path needs this at all but two vertices, one with out-degree in-degree and one with in-degree out-degree .)
Partial order. The relation is for some (that is, ), on the set .
Reflexive. For any , , so .
Antisymmetric. Let and . Then and with . Multiplying, , so . Since , , hence and .
Transitive. Let and . Then and , so
so .
The relation is reflexive, antisymmetric and transitive, so is a partial ordering on .
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2081 · 10 marks
Determine whether the function f(x) = x-1, from set of integers to the set of integers is injective, surjective or bijective. Write the type of Fuzzy set operations with their defination. Give the floor and ceiling value of 1.2 and -1.2.
Answer
Function from to .
- Injective: if then , so . Hence is one-to-one.
- Surjective: for any , take . Then . Hence is onto.
Since it is both, is bijective, with inverse .
Fuzzy set operations. For fuzzy sets and with membership functions and , for every in the universe:
- Union:
- Intersection:
- Complement:
- Equality: if for all .
- Subset: if for all .
Floor and ceiling. The floor is the greatest integer ; the ceiling is the least integer .
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2081 · 5 marks
Using mathematical induction show that
Answer
To prove: for all .
Basis step (). LHS . RHS . So is true.
Inductive step. Assume is true for some :
Add the next term to both sides:
Since ,
which is . By the principle of mathematical induction, holds for all .
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2081 · 5 marks
State sum rule and product rule. If 26 integers are chosen from the set of consecutive integers {1,2,3,…,50}, prove that there are sure to be two numbers so that one is multiple of the other.
Answer
Sum rule. If a task can be done in one of ways or in one of ways, and no way in the first set is also in the second, then the task can be done in ways.
Product rule. If a task is made of two successive steps, the first done in ways and the second (for each way of the first) in ways, then the whole task can be done in ways.
Proof of the claim (pigeonhole principle). Every integer in can be written as with and odd. The odd part lies in , which has 25 elements. These 25 odd numbers are the pigeonholes.
We choose 26 integers, so two of them, say and with , have the same odd part :
Then is an integer, so divides ; that is, one is a multiple of the other.
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2081 · 5 marks
Discuss about meet and join operation between Boolean matrices. What are the values of 5 mod 75 and −5 mod 7?
Answer
Meet and join of Boolean matrices. Let and be zero-one matrices.
- Join : the entry is 1 if or , otherwise 0 (entrywise OR, equivalent to max).
- Meet : the entry is 1 only if both and , otherwise 0 (entrywise AND, equivalent to min).
Example: for and ,
Modular values.
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2081 · 5 marks
Define chromatic number. How does Kruskal’s algorithm find Minimum Spanning Tree?
Answer
Chromatic number. The chromatic number of a graph is the smallest number of colours needed to colour its vertices so that no two adjacent vertices get the same colour. For example, , and for a non-empty bipartite graph.
Kruskal's algorithm for a Minimum Spanning Tree (MST). It is a greedy algorithm that grows a forest of edges.
- Sort all edges of the connected weighted graph in non-decreasing order of weight.
- Start with an empty edge set (each vertex is its own component).
- Take the next edge in sorted order. If adding it to does not create a cycle (its end points lie in different components), add it to ; otherwise discard it.
- Repeat step 3 until has edges ( = number of vertices).
The resulting is a spanning tree of minimum total weight. Cycle detection is done with a disjoint-set (union-find) structure, and the running time is .
Example: edges . Take , take , reject (cycle --), take . The MST has weight .
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2081 · 5 marks
What is network flow? Give an example of saturated edge, unsaturated edge, and slack.
Answer
Network flow. A flow network is a directed graph with a source , a sink , and a capacity on every edge . A flow assigns to each edge a value such that for every vertex other than and , the flow entering equals the flow leaving (conservation). The value of the flow is the net flow leaving (equal to that entering ). The aim is usually to find the maximum flow.
Saturated edge: an edge with , so no more flow can pass through it.
Unsaturated edge: an edge with .
Slack: the unused capacity of an edge, (zero for a saturated edge).
Example. Take edges with capacity 5, and with capacity 3. Send a flow of 3 along .
- : , so it is saturated (slack ).
- : , so it is unsaturated, with slack .
The maximum flow is 3, limited by the saturated edge .
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2081 · 5 marks
When do we use permutation rather than combination? How many 5-digit numbers can be generated using the digits 0 to 9, if each number starts with 98 and no digit appears more than once?
Answer
Permutation versus combination. We use a permutation when the order (arrangement) of the chosen objects matters, for example forming numbers, words or seating arrangements, where . We use a combination when only the selection matters and order does not, for example choosing a committee.
5-digit numbers starting with 98 with no repeated digit. The first two digits are fixed as 9 and 8. The remaining three positions must be filled from the 8 unused digits , with no repetition and with order mattering (0 is allowed, as the number already begins with 9):
So 336 such numbers can be formed.
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2081 · 5 marks
Define subset and power set. How do you prove correctness of recursive algorithm using Induction? Illustrate with an example.
Answer
Subset. A set is a subset of , written , if every element of is also an element of , that is, .
Power set. The power set of a set is the set of all subsets of (including and ). If then . Example: gives .
Proving a recursive algorithm correct by induction. A recursive algorithm has base cases and recursive calls on smaller inputs. We prove correctness by induction on the input size :
- Basis step: show the algorithm gives the correct output for the base case(s).
- Inductive step: assume (inductive hypothesis) the algorithm is correct for all inputs smaller than (or for ). Show that the recursive call returns a correct result for the smaller input, and that the extra work done in the call then gives the correct result for input (or ).
- By induction, the algorithm is correct for all valid inputs. Termination follows because each call reduces the input size towards a base case.
Example. Recursive factorial:
procedure fact(n) // n is a non-negative integer
if n = 0 then return 1
else return n * fact(n - 1)
Claim: for all .
- Basis: .
- Step: assume . Then .
So the algorithm is correct for all .
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2082 · 10 marks
State inclusion-exclusion principle. For which number x is true that ?Let f and g be functions from {1, 2, 3, 4} to {a, b, c, d}, and from {a, b, c, d} to {1, 2, 3, 4}, respectively with f(1) = d, f(2) = c, f(3) = a, and f(4) = b, and g(a) = 2, g(b) = 1, g(c) = 3 and g(d) = 2.
- a. If f and g one-to-one?
- b. If f and g on-to?
- c. Does either f or g have an inverse? If so find this inverse.
Answer
Inclusion-exclusion principle. For finite sets,
In general, add the sizes of single sets, subtract the sizes of pairwise intersections, add triple intersections, and so on alternately.
Floor equal to ceiling. holds exactly when is an integer. For a non-integer , .
Functions. with . with .
(a) One-to-one.
- takes four different values on four different inputs, so is one-to-one.
- with , so is not one-to-one.
(b) Onto.
- The range of is , so is onto.
- The range of is ; the element 4 is not hit, so is not onto.
(c) Inverses. A function has an inverse only if it is bijective. is one-to-one and onto, so it has an inverse:
is neither one-to-one nor onto, so has no inverse.
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2082 · 10 marks
How many ways are there to assign 24 students to five faculty advisors?
\vspace{0.5cm}
Find the solution of the recurrence relation
if
Answer
Assigning 24 students to five faculty advisors. Each of the 24 students can be assigned to any one of the 5 advisors, independently of the others. By the product rule, the number of ways is
(If each advisor were required to have a particular number of students, a multinomial coefficient would be used; with no restriction the answer is .)
Recurrence: , with .
The characteristic equation is
so is a root of multiplicity 3. The general solution is
Initial conditions:
From : , so and .
Check: , and the formula gives . ✓
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2082 · 5 marks
Find the solution to the system of congruences
using the Chinese Remainder Theorem.
Answer
System: .
The moduli are pairwise coprime, so the Chinese Remainder Theorem applies. Let
Compute and the inverse of modulo :
- : , and , so .
- : , and , so .
- : , and , so .
Then
Check: , , . ✓
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2082 · 5 marks
Suppose that on an island there are three types of people, knights, knaves, and normals. Knights always tell the truth, knaves always lie, and normals sometimes lie and sometimes tell the truth. Detectives questioned three inhabitants of the island — Amy, Brenda, and Claire — as part of the investigation of a crime. The detectives knew that one of the three committed the crime, but not which one. They also knew that the criminal was a knight, and that the other two were not. Additionally, the detectives recorded these statements: Amy: “I am innocent.” Brenda: “What Amy says is true.” Claire: “Brenda is not a normal.” After analyzing their information, the detectives positively identified the guilty party. Who was it?
Answer
Answer: Brenda is guilty.
Known: exactly one of the three is the criminal, and that person is a knight; the other two are not knights (each is a knave or a normal).
Amy: "I am innocent." If Amy were the criminal she would be a knight and could not lie, but her statement would then be false. So Amy is innocent, her statement is true, and she is not a knight.
So the criminal is Brenda or Claire.
Suppose Claire is the criminal (a knight). Her statement "Brenda is not a normal" is true, so Brenda is not a normal. Brenda is not a knight (Claire is the only one), so Brenda is a knave. But Brenda said "What Amy says is true", and Amy's statement is true, so Brenda told the truth, which a knave never does. Contradiction. So Claire is not guilty.
Suppose Brenda is the criminal (a knight). Then Amy and Claire are non-knights. Brenda's statement is true (Amy is innocent). Claire's statement "Brenda is not a normal" is true, since Brenda is a knight. Claire therefore told the truth, so she is not a knave; she is a normal. Amy's statement is also true, so Amy is also a normal. Everything is consistent.
Hence the guilty party is Brenda.
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2082 · 5 marks
Use mathematical induction to prove that
Answer
To prove: for all .
Basis step (). LHS . RHS . So is true.
Inductive step. Assume is true:
Add to both sides:
Since ,
which is exactly . By mathematical induction, is true for all .
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2082 · 5 marks
Suppose that R is the relation on the set of strings of English letters such that aRb if and only if L(a) = L(b), where L(x) is the length of the string x. Is R an equivalence relation?
Answer
Yes, is an equivalence relation. Here iff , where is the length of string . We check the three properties.
Reflexive. For any string , , so .
Symmetric. If then , hence , so .
Transitive. If and then and , so , hence .
The relation is reflexive, symmetric and transitive, so it is an equivalence relation. Its equivalence classes are the sets of all strings having the same length.
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2082 · 5 marks
What is the negation of “This is a boring course”? Give a direct proof for the statement: “If n is even, then n + 4 is even.”
Answer
Negation. The negation of "This is a boring course" is "This is not a boring course" (equivalently, "It is not the case that this is a boring course").
Direct proof. Claim: if is even, then is even.
Assume is even. Then for some integer . So
and is an integer. Hence is twice an integer, so is even.
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2082 · 5 marks
Define well ordering property. Find the multiplicative inverse of 7 modulo 19 using Extended Euclidean Algorithm.
Answer
Well-ordering property. Every non-empty set of non-negative integers (equivalently, of positive integers) has a least element. It is equivalent to the principle of mathematical induction and is used, for example, to justify the division algorithm and proofs by minimal counterexample.
Multiplicative inverse of 7 modulo 19. Since 19 is prime, and the inverse exists.
Euclidean algorithm:
Back-substitution:
So , and .
Check: . ✓
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2082 · 5 marks
What are the necessary conditions for a graph to be isomorphic? List and illustrate with an example.
Answer
Isomorphism. Graphs and are isomorphic if there is a bijection such that are adjacent in if and only if are adjacent in . Properties that must be preserved (isomorphism invariants), and so are necessary conditions, are:
- Same number of vertices.
- Same number of edges.
- Same degree sequence: the multiset of vertex degrees is the same.
- Same number of connected components.
- Same cycle structure: for example, the same number of simple cycles of each length, and if one graph has a triangle so must the other. (A vertex of degree must map to a vertex of degree , with its neighbours' degrees also matching.)
If any one fails, the graphs are not isomorphic. Passing all of them does not guarantee isomorphism.
Example 1 (not isomorphic). : a 4-cycle on (4 vertices, 4 edges, degrees ). : a triangle with a pendant vertex attached to (4 vertices, 4 edges, degrees ). The degree sequences differ, so they are not isomorphic.
Example 2 (isomorphic). : 4-cycle . : 4-cycle . Both have 4 vertices, 4 edges and degrees all 2. The map preserves every edge, so .
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2082 · 5 marks
Solve the recurrence relationwith$$
a_0 = 2 \quad \text{and} \quad a_1 = 7.
Answer
Recurrence: , with .
The characteristic equation is
The general solution is .
From the initial conditions:
Adding gives , so and .
Check: , and . ✓
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
Questions from TU BSc CSIT 2075 Second Semester Discrete Structures (TU IOST board exam, 2075), TU BSc CSIT 2076 Second Semester Discrete Structures (TU IOST board exam, 2076), TU BSc CSIT 2078 Second Semester Discrete Structures (TU IOST board exam, 2078), TU BSc CSIT 2079 Second Semester Discrete Structures (TU IOST board exam, 2079), TU BSc CSIT 2080 Second Semester Discrete Structures (TU IOST board exam, 2080), TU BSc CSIT 2081 Second Semester Discrete Structures (TU IOST board exam, 2081), TU BSc CSIT 2082 Second Semester Discrete Structures (TU IOST board exam, 2082), TU BSc CSIT 2075 Second Semester Mathematics II (TU IOST board exam, 2075), TU BSc CSIT 2076 Second Semester Mathematics II (TU IOST board exam, 2076), TU BSc CSIT 2078 Second Semester Mathematics II (TU IOST board exam, 2078), TU BSc CSIT 2079 Second Semester Mathematics II (TU IOST board exam, 2079), TU BSc CSIT 2080 Second Semester Mathematics II (TU IOST board exam, 2080), TU BSc CSIT 2081 Second Semester Mathematics II (TU IOST board exam, 2081), TU BSc CSIT 2082 Second Semester Mathematics II (TU IOST board exam, 2082), TU BSc CSIT 2075 Second Semester Microprocessor (TU IOST board exam, 2075), TU BSc CSIT 2076 Second Semester Microprocessor (TU IOST board exam, 2076), TU BSc CSIT 2078 Second Semester Microprocessor (TU IOST board exam, 2078), TU BSc CSIT 2079 Second Semester Microprocessor (TU IOST board exam, 2079), TU BSc CSIT 2080 Second Semester Microprocessor (TU IOST board exam, 2080), TU BSc CSIT 2081 Second Semester Microprocessor (TU IOST board exam, 2081), TU BSc CSIT 2082 Second Semester Microprocessor (TU IOST board exam, 2082), TU BSc CSIT 2075 Second Semester Object Oriented Programming (C++) (TU IOST board exam, 2075), TU BSc CSIT 2076 Second Semester Object Oriented Programming (C++) (TU IOST board exam, 2076), TU BSc CSIT 2078 Second Semester Object Oriented Programming (C++) (TU IOST board exam, 2078), TU BSc CSIT 2079 Second Semester Object Oriented Programming (C++) (TU IOST board exam, 2079), TU BSc CSIT 2080 Second Semester Object Oriented Programming (C++) (TU IOST board exam, 2080), TU BSc CSIT 2081 Second Semester Object Oriented Programming (C++) (TU IOST board exam, 2081), TU BSc CSIT 2082 Second Semester Object Oriented Programming (C++) (TU IOST board exam, 2082), TU BSc CSIT 2075 Second Semester Statistics I (TU IOST board exam, 2075), TU BSc CSIT 2076 Second Semester Statistics I (TU IOST board exam, 2076), TU BSc CSIT 2078 Second Semester Statistics I (TU IOST board exam, 2078), TU BSc CSIT 2079 Second Semester Statistics I (TU IOST board exam, 2079), TU BSc CSIT 2080 Second Semester Statistics I (TU IOST board exam, 2080), TU BSc CSIT 2081 Second Semester Statistics I (TU IOST board exam, 2081) and TU BSc CSIT 2082 Second Semester Statistics I (TU IOST board exam, 2082). Answers are written for this site; check them against your class notes.