Browse papers
A

Section A: Long Answer Questions

Attempt any TWO questions.

3 questions·10 marks each
1long10 marks

Define logical equivalence. Using laws of logic (without truth table), show that (\neg(p \lor (\neg p \land q))) is logically equivalent to (\neg p \land \neg q).

Logical Equivalence

Two compound propositions PP and QQ are said to be logically equivalent if they have the same truth value for every possible assignment of truth values to their component propositions. Equivalently, PP and QQ are logically equivalent if and only if the biconditional PQP \leftrightarrow Q is a tautology. We write PQP \equiv Q.

Proof using Laws of Logic

We show ¬(p(¬pq))¬p¬q\neg(p \lor (\neg p \land q)) \equiv \neg p \land \neg q.

¬(p(¬pq))¬p¬(¬pq)(De Morgan’s law)¬p(¬(¬p)¬q)(De Morgan’s law)¬p(p¬q)(Double negation)(¬pp)(¬p¬q)(Distributive law)F(¬p¬q)(Negation law, ¬ppF)¬p¬q(Identity law, Frr)\begin{aligned} \neg\big(p \lor (\neg p \land q)\big) &\equiv \neg p \land \neg(\neg p \land q) && \text{(De Morgan's law)}\\ &\equiv \neg p \land (\neg(\neg p) \lor \neg q) && \text{(De Morgan's law)}\\ &\equiv \neg p \land (p \lor \neg q) && \text{(Double negation)}\\ &\equiv (\neg p \land p) \lor (\neg p \land \neg q) && \text{(Distributive law)}\\ &\equiv F \lor (\neg p \land \neg q) && \text{(Negation law, } \neg p \land p \equiv F)\\ &\equiv \neg p \land \neg q && \text{(Identity law, } F \lor r \equiv r) \end{aligned}

Hence ¬(p(¬pq))¬p¬q\neg(p \lor (\neg p \land q)) \equiv \neg p \land \neg q. Q.E.D.

logicequivalence
2long10 marks

What is a function? Explain one-to-one, onto and bijective functions with examples. When does the inverse of a function exist? Find the inverse of (f(x) = 2x + 3).

Function

A function ff from a set AA (the domain) to a set BB (the codomain), written f:ABf : A \to B, is a rule that assigns to each element xAx \in A exactly one element f(x)Bf(x) \in B.

Types of Functions

One-to-one (Injective)

A function f:ABf : A \to B is one-to-one if distinct elements of AA map to distinct elements of BB:

f(a1)=f(a2)    a1=a2.f(a_1) = f(a_2) \implies a_1 = a_2.

Example: f:RR,  f(x)=2x+1f : \mathbb{R} \to \mathbb{R},\; f(x) = 2x+1 is injective, since 2a1+1=2a2+1a1=a22a_1+1 = 2a_2+1 \Rightarrow a_1 = a_2.

Onto (Surjective)

A function f:ABf : A \to B is onto if every element of BB is the image of at least one element of AA: for all yBy \in B there exists xAx \in A with f(x)=yf(x) = y. Example: f:RR,  f(x)=x3f : \mathbb{R} \to \mathbb{R},\; f(x) = x^3 is surjective (every real has a real cube root).

Bijective

A function is bijective if it is both one-to-one and onto. Then each element of BB corresponds to exactly one element of AA. Example: f:RR,  f(x)=2x+3f : \mathbb{R} \to \mathbb{R},\; f(x) = 2x+3 is bijective.

Existence of the Inverse

The inverse function f1:BAf^{-1} : B \to A exists if and only if ff is bijective (one-to-one and onto). It is defined by f1(y)=x    f(x)=yf^{-1}(y) = x \iff f(x) = y.

Inverse of f(x)=2x+3f(x) = 2x + 3

Let y=2x+3y = 2x + 3. Solving for xx:

y3=2x    x=y32.y - 3 = 2x \implies x = \frac{y - 3}{2}.

Interchanging variables, the inverse is

f1(x)=x32.\boxed{f^{-1}(x) = \frac{x - 3}{2}.}

Check: f(f1(x))=2 ⁣(x32)+3=x.f(f^{-1}(x)) = 2\!\left(\dfrac{x-3}{2}\right) + 3 = x.

functionsinverse
3long10 marks

Explain Dijkstra's algorithm for finding the shortest path in a weighted graph. Apply it to find the shortest path from a source vertex to all other vertices in a given example graph.

Dijkstra's Algorithm

Dijkstra's algorithm finds the shortest (least-weight) path from a single source vertex to all other vertices in a weighted graph with non-negative edge weights. It maintains a set SS of vertices whose shortest distance from the source is finalized, and greedily adds the closest unprocessed vertex at each step.

Algorithm

Dijkstra(G, w, source):
    for each vertex v in G:
        dist[v] = infinity
        prev[v] = NULL
    dist[source] = 0
    Q = set of all vertices          // priority queue keyed by dist
    while Q is not empty:
        u = vertex in Q with minimum dist[u]
        remove u from Q
        for each neighbor v of u still in Q:
            alt = dist[u] + w(u, v)
            if alt < dist[v]:         // relaxation
                dist[v] = alt
                prev[v] = u
    return dist, prev

Time complexity: O(V2)O(V^2) with an array, or O((V+E)logV)O((V+E)\log V) with a binary heap.

Worked Example

Consider the weighted graph with source AA and edges: A ⁣ ⁣B=4,  A ⁣ ⁣C=1,  C ⁣ ⁣B=2,  C ⁣ ⁣D=5,  B ⁣ ⁣D=1,  D ⁣ ⁣E=3,  B ⁣ ⁣E=7.A\!-\!B = 4,\; A\!-\!C = 1,\; C\!-\!B = 2,\; C\!-\!D = 5,\; B\!-\!D = 1,\; D\!-\!E = 3,\; B\!-\!E = 7.

StepChosendist Adist Bdist Cdist Ddist E
Init0\infty\infty\infty\infty
1A041\infty\infty
2C0316\infty
3B031410
4D03147
5E03147

Final shortest distances from AA

d(A)=0,  d(C)=1,  d(B)=3,  d(D)=4,  d(E)=7.d(A)=0,\; d(C)=1,\; d(B)=3,\; d(D)=4,\; d(E)=7.

Following prev pointers, the shortest paths are: ACA\to C, ACBA\to C\to B, ACBDA\to C\to B\to D, ACBDEA\to C\to B\to D\to E.

graphshortest-path
B

Section B: Short Answer Questions

Attempt any EIGHT questions.

9 questions·5 marks each
4short5 marks

Define quantifiers with examples.

Quantifiers turn a predicate (open statement) into a proposition by specifying the extent over which the predicate variable ranges.

  • Universal quantifier \forall ("for all"): xP(x)\forall x\, P(x) is true when P(x)P(x) holds for every xx in the domain. Example: xR,  x20\forall x \in \mathbb{R},\; x^2 \ge 0 — "every real number has a non-negative square" (true).

  • Existential quantifier \exists ("there exists"): xP(x)\exists x\, P(x) is true when P(x)P(x) holds for at least one xx in the domain. Example: xZ,  x+3=0\exists x \in \mathbb{Z},\; x + 3 = 0 — "there is an integer satisfying x+3=0x+3=0" (true, x=3x=-3).

Negation interchanges them: ¬(xP(x))x¬P(x)\neg(\forall x\,P(x)) \equiv \exists x\,\neg P(x) and ¬(xP(x))x¬P(x)\neg(\exists x\,P(x)) \equiv \forall x\,\neg P(x).

quantifiers
5short5 marks

What is a recursive function? Give an example.

A recursive function is a function that is defined in terms of itself, i.e., its value for an input is expressed using its values at smaller inputs. A correct recursive definition has two parts:

  1. Base case(s): the value for the smallest input(s), given directly.
  2. Recursive (inductive) step: defines f(n)f(n) in terms of ff at smaller arguments.

Example — Factorial:

n!={1if n=0(base case)n(n1)!if n1(recursive step)n! = \begin{cases} 1 & \text{if } n = 0 \quad (\text{base case})\\ n \cdot (n-1)! & \text{if } n \ge 1 \quad (\text{recursive step}) \end{cases}
int factorial(int n) {
    if (n == 0) return 1;        // base case
    return n * factorial(n - 1); // recursive call
}

Thus 4!=43211=244! = 4 \cdot 3 \cdot 2 \cdot 1 \cdot 1 = 24. (Other examples: Fibonacci numbers, gcd\gcd via Euclid's algorithm.)

functions
6short5 marks

Define cardinality of a set. What are countable and uncountable sets?

Cardinality

The cardinality of a set AA, written A|A|, is the number of elements it contains. For finite sets it is a non-negative integer; e.g. {a,b,c}=3|\{a,b,c\}| = 3. Two sets AA and BB have the same cardinality if there exists a bijection f:ABf : A \to B.

Countable Sets

A set is countable if it is finite, or if it has the same cardinality as the set of natural numbers N\mathbb{N} (i.e. its elements can be listed in a sequence a1,a2,a3,a_1, a_2, a_3, \dots). Such infinite sets are countably infinite, with cardinality 0\aleph_0. Examples: N\mathbb{N}, the integers Z\mathbb{Z}, and the rationals Q\mathbb{Q} are all countable.

Uncountable Sets

A set is uncountable if it is infinite but not countable — no bijection with N\mathbb{N} exists, so its elements cannot be enumerated in a list. Example: The set of real numbers R\mathbb{R} (and the interval (0,1)(0,1)) is uncountable, as shown by Cantor's diagonal argument.

sets
7short5 marks

State and explain the addition and multiplication rules of counting.

Sum (Addition) Rule

If a task can be done in one of two disjoint ways, where the first way can be performed in mm ways and the second in nn ways, and no way is common to both, then the task can be done in m+nm + n ways. (For mutually disjoint sets A,BA,B: AB=A+B|A \cup B| = |A| + |B|.) Example: A student can pick one book — either from 55 maths books or from 33 physics books — in 5+3=85 + 3 = 8 ways.

Product (Multiplication) Rule

If a task consists of a sequence of two independent subtasks, where the first can be done in mm ways and, for each, the second in nn ways, then the whole task can be done in m×nm \times n ways. (For a Cartesian product: A×B=AB|A \times B| = |A|\cdot|B|.) Example: Choosing one maths book and then one physics book can be done in 5×3=155 \times 3 = 15 ways.

Key distinction: use the sum rule for an OR of mutually exclusive choices, and the product rule for an AND of successive independent choices.

counting
8short5 marks

Define isomorphic graphs with an example.

Isomorphic Graphs

Two simple graphs G1=(V1,E1)G_1 = (V_1, E_1) and G2=(V2,E2)G_2 = (V_2, E_2) are isomorphic if there exists a bijection f:V1V2f : V_1 \to V_2 that preserves adjacency:

{u,v}E1    {f(u),f(v)}E2.\{u, v\} \in E_1 \iff \{f(u), f(v)\} \in E_2.

Intuitively, the two graphs are structurally identical and differ only in the labelling/drawing of vertices.

Necessary conditions (invariants) — isomorphic graphs must have: the same number of vertices, the same number of edges, the same degree sequence, and the same number of components/cycles.

Example

Let G1G_1 have vertices {a,b,c,d}\{a,b,c,d\} with edges a ⁣ ⁣b,  b ⁣ ⁣c,  c ⁣ ⁣d,  d ⁣ ⁣aa\!-\!b,\; b\!-\!c,\; c\!-\!d,\; d\!-\!a (a 4-cycle), and G2G_2 have vertices {1,2,3,4}\{1,2,3,4\} with edges 1 ⁣ ⁣2,  2 ⁣ ⁣3,  3 ⁣ ⁣4,  4 ⁣ ⁣11\!-\!2,\; 2\!-\!3,\; 3\!-\!4,\; 4\!-\!1 (also a 4-cycle).

Define f(a)=1,  f(b)=2,  f(c)=3,  f(d)=4f(a)=1,\; f(b)=2,\; f(c)=3,\; f(d)=4. Every edge of G1G_1 maps to an edge of G2G_2 and vice versa, so ff is an isomorphism and G1G2G_1 \cong G_2. Both have 4 vertices, 4 edges, and degree sequence (2,2,2,2)(2,2,2,2).

graph
9short5 marks

What is a binary search tree? Give an example.

Binary Search Tree (BST)

A binary search tree is a binary tree in which each node stores a key, and for every node:

  • all keys in its left subtree are less than the node's key, and
  • all keys in its right subtree are greater than the node's key.

This ordering property holds recursively for every subtree, so an in-order traversal of a BST visits the keys in sorted (ascending) order. It supports search, insertion, and deletion in O(h)O(h) time, where hh is the height (O(logn)O(\log n) when balanced).

Example

Inserting the keys 50,30,70,20,40,60,8050, 30, 70, 20, 40, 60, 80 in order gives:

          50
         /  \
       30    70
      /  \   /  \
    20   40 60   80

Here every left child is smaller and every right child is larger than its parent. Searching for 4040: compare with 5050 (go left), then 3030 (go right), then find 4040 — only 3 comparisons. In-order traversal yields 20,30,40,50,60,70,8020, 30, 40, 50, 60, 70, 80 (sorted).

tree
10short5 marks

Prove that the sum of degrees of all vertices in a graph is even.

Handshaking Theorem

Statement. In any undirected graph G=(V,E)G = (V, E), the sum of the degrees of all vertices equals twice the number of edges:

vVdeg(v)=2E.\sum_{v \in V} \deg(v) = 2|E|.

Consequently, the sum of degrees is always even.

Proof

Consider the total vVdeg(v)\displaystyle \sum_{v \in V} \deg(v). The degree deg(v)\deg(v) counts the number of edge-endpoints incident on vertex vv. Each edge e={u,w}e = \{u, w\} has exactly two endpoints — one at uu and one at ww — and therefore contributes exactly 22 to the total degree sum (it adds 11 to deg(u)\deg(u) and 11 to deg(w)\deg(w)).

Summing this contribution over all E|E| edges,

vVdeg(v)=2E.\sum_{v \in V} \deg(v) = 2|E|.

Since E|E| is a non-negative integer, 2E2|E| is even. Hence the sum of the degrees of all vertices in a graph is even. Q.E.D.

Corollary: the number of vertices of odd degree must be even.

graph
11short5 marks

Define modular arithmetic. Compute (17 \bmod 5) and (-7 \bmod 3).

Modular Arithmetic

Modular arithmetic is arithmetic of integers with respect to a fixed positive integer mm called the modulus. For amodma \bmod m we take the remainder rr when aa is divided by mm, where the remainder is chosen so that 0r<m0 \le r < m (i.e. a=qm+ra = qm + r with integer qq). Two integers aa and bb are congruent modulo mm, written ab(modm)a \equiv b \pmod{m}, if m(ab)m \mid (a - b).

Computations

1. 17mod517 \bmod 5:

17=3×5+2,02<5    17mod5=2.17 = 3 \times 5 + 2, \quad 0 \le 2 < 5 \implies 17 \bmod 5 = 2.

2. 7mod3-7 \bmod 3: We need rr with 0r<30 \le r < 3 and 7=3q+r-7 = 3q + r. Taking q=3q = -3:

7=3×(3)+2=9+2,02<3    7mod3=2.-7 = 3 \times (-3) + 2 = -9 + 2, \quad 0 \le 2 < 3 \implies -7 \bmod 3 = 2.

Answers: 17mod5=217 \bmod 5 = 2 and 7mod3=2-7 \bmod 3 = 2.

number-theory
12short5 marks

State the rules of inference: modus ponens and modus tollens.

Rules of inference are valid argument forms used to derive conclusions from premises in propositional logic.

Modus Ponens (Law of Detachment)

If a conditional and its hypothesis are both true, the conclusion is true.

pqp  q\begin{array}{l} p \rightarrow q \\ p \\ \hline \therefore\; q \end{array}

The form ((pq)p)q\big((p \rightarrow q) \land p\big) \rightarrow q is a tautology. Example: "If it rains, the ground is wet. It is raining. \therefore The ground is wet."

Modus Tollens

If a conditional is true and its conclusion is false, then its hypothesis is false.

pq¬q  ¬p\begin{array}{l} p \rightarrow q \\ \neg q \\ \hline \therefore\; \neg p \end{array}

The form ((pq)¬q)¬p\big((p \rightarrow q) \land \neg q\big) \rightarrow \neg p is a tautology. Example: "If it rains, the ground is wet. The ground is not wet. \therefore It is not raining."

inference

Frequently asked questions

Where can I find the BSc CSIT (TU) Discrete Structure (BSc CSIT, CSC160) question paper 2078?
The full BSc CSIT (TU) Discrete Structure (BSc CSIT, CSC160) 2078 (regular) question paper is available free on Kekkei. You can read every question online and attempt the paper under timed exam conditions.
Does the Discrete Structure (BSc CSIT, CSC160) 2078 paper come with solutions?
Yes. Every question on this Discrete Structure (BSc CSIT, CSC160) past paper includes a step-by-step solution, plus instant AI feedback when you attempt it on Kekkei.
How many marks is the BSc CSIT (TU) Discrete Structure (BSc CSIT, CSC160) 2078 paper?
The BSc CSIT (TU) Discrete Structure (BSc CSIT, CSC160) 2078 paper carries 60 full marks and is meant to be completed in 180 minutes, across 12 questions.
Is practising this Discrete Structure (BSc CSIT, CSC160) past paper free?
Yes — reading and attempting this Discrete Structure (BSc CSIT, CSC160) past paper on Kekkei is completely free.