Skip to main content

Chapter 2

Mathematical Foundation for Computer Science

PU BCA past exam questions

Past questions and answers

57 questions set from this chapter, 3 of them more than once. Most repeated first.

  • Asked 2 times
  • 2025 Spring · 8 marks
  • 2024 Fall · 8 marks

Define planar and Euler Graph. A connected planar graph has nine vertices having degrees 2, 2, 2, 3, 3, 3, 4, 4 and 5. How many edges and faces are there?

Answer

Planar graph. A graph is planar if it can be drawn in the plane so that no two edges cross except at their end vertices. Such a drawing divides the plane into regions called faces.

Euler graph. A connected graph is an Euler graph if it has an Euler circuit, that is, a closed walk that uses every edge exactly once. A connected graph is Eulerian if and only if every vertex has even degree.

Numerical part. The degrees are 2,2,2,3,3,3,4,4,52, 2, 2, 3, 3, 3, 4, 4, 5 and v=9v = 9.

Sum of degrees:

2+2+2+3+3+3+4+4+5=282+2+2+3+3+3+4+4+5 = 28

By the handshaking theorem, 2e=282e = 28, so

e=14e = 14

By Euler's formula for a connected planar graph, v−e+f=2v - e + f = 2:

9−14+f=2  ⇒  f=79 - 14 + f = 2 \;\Rightarrow\; f = 7

Number of edges = 14 and number of faces = 7.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • Asked 2 times
  • 2025 Spring · 7 marks
  • 2023 Spring · 8 marks

Solve the recurrence relation an=2an−1−an−2a_n = 2a_{n-1} - a_{n-2} for n≥2n \ge 2 and a0=3a_0 = 3, a1=6a_1 = 6.

Answer

an=2an−1−an−2,a0=3, a1=6a_n = 2a_{n-1} - a_{n-2},\qquad a_0 = 3,\ a_1 = 6

Characteristic equation:

r2−2r+1=0  ⇒  (r−1)2=0  ⇒  r=1 (repeated root)r^2 - 2r + 1 = 0 \;\Rightarrow\; (r-1)^2 = 0 \;\Rightarrow\; r = 1 \text{ (repeated root)}

General solution:

an=(A+Bn) 1n=A+Bna_n = (A + Bn)\,1^n = A + Bn

Using the initial conditions:

  • a0=A=3a_0 = A = 3.
  • a1=A+B=6⇒B=3a_1 = A + B = 6 \Rightarrow B = 3.

Solution:

an=3+3n=3(n+1)a_n = 3 + 3n = 3(n+1)

Check: a2=2(6)−3=9=3(3)a_2 = 2(6) - 3 = 9 = 3(3).

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • Asked 2 times
  • 2024 Fall · 5 marks
  • 2023 Spring · 5 marks

Write short notes on: Hamilton Graph

Answer

Hamiltonian path and circuit. A Hamiltonian path in a graph is a simple path that visits every vertex exactly once. A Hamiltonian circuit (cycle) is a simple cycle that passes through every vertex exactly once and returns to the starting vertex. A graph that has a Hamiltonian circuit is called a Hamilton (Hamiltonian) graph. The idea is named after Sir William Rowan Hamilton, who introduced it through the "icosian game".

Examples. The cycle CnC_n, the complete graph KnK_n (n≥3n \ge 3) and the cube Q3Q_3 are Hamiltonian. The complete bipartite graph K2,3K_{2,3} is not.

Sufficient conditions (a graph with n≥3n \ge 3 vertices):

  • Dirac's theorem: if deg⁡(v)≥n/2\deg(v) \ge n/2 for every vertex vv, the graph is Hamiltonian.
  • Ore's theorem: if deg⁡(u)+deg⁡(v)≥n\deg(u) + \deg(v) \ge n for every pair of non-adjacent vertices u,vu, v, the graph is Hamiltonian.

Necessary conditions: every vertex must have degree at least 2, and the graph must be connected with no cut vertex. If a vertex of degree 2 exists, both its edges must be in the circuit.

Comparison with Euler circuit. An Euler circuit uses every edge once and has a simple degree test (all degrees even). For a Hamiltonian circuit, which uses every vertex once, no simple necessary and sufficient test is known; deciding it is NP-complete.

Application: the travelling salesman problem asks for the cheapest Hamiltonian circuit in a weighted graph.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2025 Spring · 8 marks

Find the solution of the recurrence relation: an=5an−1−6an−2+42⋅4na_n = 5a_{n-1} - 6a_{n-2} + 42 \cdot 4^n; with initial condition a0=56a_0 = 56, a1=278a_1 = 278.

Similar questions: Recurrence an - 6a(n-1) + 8a(n-2) = 3 (2024 Fall)

Answer

an=5an−1−6an−2+42⋅4n,a0=56, a1=278a_n = 5a_{n-1} - 6a_{n-2} + 42\cdot 4^n,\qquad a_0 = 56,\ a_1 = 278

Homogeneous part. r2−5r+6=0⇒(r−2)(r−3)=0r^2 - 5r + 6 = 0 \Rightarrow (r-2)(r-3) = 0, so r=2,3r = 2, 3 and

an(h)=A 2n+B 3na_n^{(h)} = A\,2^n + B\,3^n

Particular solution. Since 44 is not a characteristic root, try an(p)=C⋅4na_n^{(p)} = C\cdot 4^n. Substituting:

C4n=5C4n−1−6C4n−2+42⋅4nC4^n = 5C4^{n-1} - 6C4^{n-2} + 42\cdot 4^n

Divide by 4n−24^{n-2}:

16C=20C−6C+42⋅16  ⇒  16C=14C+672  ⇒  C=33616C = 20C - 6C + 42\cdot 16 \;\Rightarrow\; 16C = 14C + 672 \;\Rightarrow\; C = 336

General solution:

an=A 2n+B 3n+336⋅4na_n = A\,2^n + B\,3^n + 336\cdot 4^n

Initial conditions:

  • n=0n=0: A+B+336=56⇒A+B=−280A + B + 336 = 56 \Rightarrow A + B = -280.
  • n=1n=1: 2A+3B+1344=278⇒2A+3B=−10662A + 3B + 1344 = 278 \Rightarrow 2A + 3B = -1066.

Subtracting twice the first equation from the second: B=−1066+560=−506B = -1066 + 560 = -506, so A=−280+506=226A = -280 + 506 = 226.

Solution:

an=226⋅2n−506⋅3n+336⋅4na_n = 226\cdot 2^n - 506\cdot 3^n + 336\cdot 4^n

Check: a1=452−1518+1344=278a_1 = 452 - 1518 + 1344 = 278. ✓

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2025 Spring · 7 marks

What do you mean by DFA? Design a DFA for the language L={w∈{a,b}∗:w starts with abb}L = \{w \in \{a,b\}^* : w \text{ starts with } abb\}

Similar questions: DFA for strings ending with bb (2024 Fall)

Answer

DFA. A Deterministic Finite Automaton is a 5-tuple M=(Q,Σ,δ,q0,F)M = (Q, \Sigma, \delta, q_0, F) where QQ is a finite set of states, Σ\Sigma the input alphabet, δ:Q×Σ→Q\delta : Q \times \Sigma \to Q the transition function (exactly one next state for every state and symbol), q0∈Qq_0 \in Q the start state, and F⊆QF \subseteq Q the set of accepting (final) states.

DFA for L={w∈{a,b}∗:w starts with abb}L = \{w \in \{a,b\}^* : w \text{ starts with } abb\}.

States: Q={q0,q1,q2,q3,qd}Q = \{q_0, q_1, q_2, q_3, q_d\}, start state q0q_0, final state F={q3}F = \{q_3\}, qdq_d a dead (trap) state.

Stateon aaon bb
→q0\to q_0q1q_1qdq_d
q1q_1 (read aa)qdq_dq2q_2
q2q_2 (read abab)qdq_dq3q_3
∗q3*q_3 (read abbabb)q3q_3q3q_3
qdq_dqdq_dqdq_d

Working: q0→aq1→bq2→bq3q_0 \xrightarrow{a} q_1 \xrightarrow{b} q_2 \xrightarrow{b} q_3; once abbabb has been read the machine stays in q3q_3 whatever follows. Any other beginning (for example b…b\ldots, aa…aa\ldots, aba…aba\ldots) goes to the dead state, which is never accepted.

Example: abbababbab ends in q3q_3 (accepted); abababab ends in qdq_d (rejected).

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2024 Fall · 8 marks

Find the solution of the recurrence relation: an−6an−1+8an−2=3a_n - 6a_{n-1} + 8a_{n-2} = 3; with initial condition a0=10a_0 = 10, a1=25a_1 = 25

Similar questions: Recurrence with 42.4^n (2025 Spring)

Answer

an−6an−1+8an−2=3,a0=10, a1=25a_n - 6a_{n-1} + 8a_{n-2} = 3,\qquad a_0 = 10,\ a_1 = 25

Homogeneous part. r2−6r+8=0⇒(r−2)(r−4)=0r^2 - 6r + 8 = 0 \Rightarrow (r-2)(r-4) = 0, so

an(h)=A 2n+B 4na_n^{(h)} = A\,2^n + B\,4^n

Particular solution. The right-hand side is a constant and 11 is not a characteristic root, so try an(p)=Ca_n^{(p)} = C:

C−6C+8C=3  ⇒  3C=3  ⇒  C=1C - 6C + 8C = 3 \;\Rightarrow\; 3C = 3 \;\Rightarrow\; C = 1

General solution:

an=A 2n+B 4n+1a_n = A\,2^n + B\,4^n + 1

Initial conditions:

  • n=0n=0: A+B+1=10⇒A+B=9A + B + 1 = 10 \Rightarrow A + B = 9.
  • n=1n=1: 2A+4B+1=25⇒A+2B=122A + 4B + 1 = 25 \Rightarrow A + 2B = 12.

Subtracting: B=3B = 3, then A=6A = 6.

Solution:

an=6⋅2n+3⋅4n+1a_n = 6\cdot 2^n + 3\cdot 4^n + 1

Check: a1=12+12+1=25a_1 = 12 + 12 + 1 = 25 and a2=24+48+1=73=6(25)−8(10)+3a_2 = 24 + 48 + 1 = 73 = 6(25) - 8(10) + 3. ✓

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2024 Fall · 8 marks

What do you mean by DFA? Design a DFA for the language L={w∈{a,b}∗:w ends with bb}L = \{w \in \{a,b\}^* : w \text{ ends with } bb\}

Similar questions: DFA for strings starting with abb (2025 Spring)

Answer

DFA. A Deterministic Finite Automaton is a 5-tuple M=(Q,Σ,δ,q0,F)M = (Q, \Sigma, \delta, q_0, F): QQ a finite set of states, Σ\Sigma the input alphabet, δ:Q×Σ→Q\delta : Q \times \Sigma \to Q the transition function (exactly one move for each state and symbol), q0q_0 the start state and F⊆QF \subseteq Q the set of final (accepting) states. A string is accepted if the DFA is in a final state after reading it completely.

DFA for L={w∈{a,b}∗:w ends with bb}L = \{w \in \{a,b\}^* : w \text{ ends with } bb\}.

States: q0q_0 (start; the last symbol is not bb, or nothing read), q1q_1 (the string ends in exactly one bb), q2q_2 (the string ends in bbbb; the final state).

Stateon aaon bb
→q0\to q_0q0q_0q1q_1
q1q_1q0q_0q2q_2
∗q2*q_2q0q_0q2q_2

Formally, Q={q0,q1,q2}Q = \{q_0, q_1, q_2\}, Σ={a,b}\Sigma = \{a, b\}, F={q2}F = \{q_2\}.

Working: an aa always breaks a run of bbs and returns to q0q_0; one bb moves q0→q1q_0 \to q_1; a second consecutive bb moves q1→q2q_1 \to q_2; further bbs keep the machine in q2q_2.

Example: abbabb goes q0→q0→q1→q2q_0 \to q_0 \to q_1 \to q_2 (accepted); abbaabba goes back to q0q_0 (rejected); babbab ends in q1q_1 (rejected).

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2024 Spring · 8 marks

How regular expression is converted into DFA? Explain it with suitable example.

Similar questions: Regular expression, applications, DFA to regex (2023 Spring)

Answer

A regular expression (RE) is converted to a DFA in two stages: RE →\to ε\varepsilon-NFA (Thompson's construction), then ε\varepsilon-NFA →\to DFA (subset construction).

Step 1: RE to ε\varepsilon-NFA (Thompson's construction). Build small NFAs for the basic parts and combine them:

  • Symbol aa: two states s→afs \xrightarrow{a} f. The empty string ε\varepsilon: s→εfs \xrightarrow{\varepsilon} f.
  • Union R1+R2R_1 + R_2: a new start state with ε\varepsilon-moves to the starts of both NFAs, and ε\varepsilon-moves from both finals to a new final state.
  • Concatenation R1R2R_1R_2: an ε\varepsilon-move from the final state of R1R_1 to the start state of R2R_2.
  • Closure R∗R^*: a new start and final state, with ε\varepsilon-moves start →\to start of RR, final of RR →\to final of RR-NFA's new final, final of RR →\to start of RR (repeat), and start →\to new final (zero repetitions).

Step 2: ε\varepsilon-NFA to DFA (subset construction).

  1. Compute the ε\varepsilon-closure of the NFA start state; this is the DFA start state.
  2. For each DFA state SS (a set of NFA states) and each input symbol aa, compute ε-closure(δ(S,a))\varepsilon\text{-closure}(\delta(S,a)); this set is a DFA state.
  3. Repeat until no new sets appear.
  4. Any DFA state that contains an NFA final state is a final state.

Example: a(a+b)∗ba(a+b)^*b. Thompson's construction gives an ε\varepsilon-NFA; after removing the ε\varepsilon-moves it reduces to the following NFA:

NFA: q0→aq1q_0 \xrightarrow{a} q_1; q1→a,bq1q_1 \xrightarrow{a,b} q_1; q1→bq2q_1 \xrightarrow{b} q_2, final state q2q_2.

Subset construction:

DFA stateon aaon bb
A={q0}A=\{q_0\}B={q1}B=\{q_1\}∅\emptyset (dead)
B={q1}B=\{q_1\}BBC={q1,q2}C=\{q_1,q_2\}
∗C={q1,q2}*C=\{q_1,q_2\}BBCC

Start state AA, final state CC. The resulting DFA accepts exactly the strings that start with aa and end with bb, which is the language of a(a+b)∗ba(a+b)^*b. If needed, the DFA can be minimised by merging equivalent states.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2023 Spring · 7 marks

What is regular expression? List and explain its application. Explain how DFA is converted into regular expression?

Similar questions: Converting regular expression to DFA (2024 Spring)

Answer

Regular expression (RE). A regular expression is an algebraic notation describing a regular language, built from symbols of Σ\Sigma, ε\varepsilon and ∅\emptyset using union (++ or ∣|), concatenation, and Kleene closure (∗*). For example, (a+b)∗abb(a+b)^*abb describes all strings over {a,b}\{a,b\} ending in abbabb.

Applications.

  • Lexical analysis: compilers use REs to define tokens (identifiers, numbers, keywords), which are converted into DFAs by tools such as Lex/Flex.
  • Pattern matching and search: grep, sed, text editors and IDEs find and replace text patterns.
  • Input validation: checking email addresses, phone numbers, passwords and dates in forms.
  • Data extraction and web scraping: pulling structured fields from logs and documents.
  • Network and security tools: intrusion detection and packet filtering match patterns in traffic.
  • Specification of protocols and hardware: describing the language accepted by simple controllers and finite-state machines.

Converting a DFA to a regular expression (state elimination method).

  1. Add a new start state with an ε\varepsilon-edge to the old start state, and a new single final state with ε\varepsilon-edges from every old final state.
  2. Label every edge with an RE (merge parallel edges with ++).
  3. Eliminate the remaining states one at a time. To remove state ss, for every pair of states pp and qq with edges p→R1sp\xrightarrow{R_1}s, s→R2qs\xrightarrow{R_2}q, and a self-loop s→Sss\xrightarrow{S}s, add the edge p→R1S∗R2qp\xrightarrow{R_1S^*R_2}q (union it with any existing p→qp\to q edge).
  4. When only the new start and final states remain, the label on the edge between them is the RE of the DFA.

Example. DFA with states q0q_0 (start), q1q_1 (final): q0→aq1q_0\xrightarrow{a}q_1, q0→bq0q_0\xrightarrow{b}q_0, q1→aq1q_1\xrightarrow{a}q_1, q1→bq0q_1\xrightarrow{b}q_0. Eliminating q1q_1 (loop aa, in-edge aa, out-edge bb to q0q_0) gives a loop on q0q_0 labelled b+aa∗bb + aa^*b, and the path to the final state is a a∗a\,a^*. Hence

R=(b+aa∗b)∗ aa∗,R=(b+aa^*b)^*\,aa^*,

which is equivalent to (a+b)∗a(a+b)^*a: all strings ending in aa.

Another method is Arden's theorem: write state equations qi=∑qja+εq_i = \sum q_j a + \varepsilon (for the start) and solve using R=Q+RP⇒R=QP∗R = Q + RP \Rightarrow R = QP^*.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2025 Spring · 7 marks

What is graph theory? Explain the application of graph theory in computer science.

Answer

Graph theory is the branch of mathematics that studies graphs. A graph G=(V,E)G = (V, E) consists of a non-empty set VV of vertices (nodes) and a set EE of edges joining pairs of vertices. Graphs model pairwise relations between objects, and graph theory studies their properties such as paths, cycles, connectivity, colouring, trees and planarity.

Applications in computer science:

  1. Computer networks. Computers or routers are vertices and links are edges. Shortest-path algorithms (Dijkstra, Bellman-Ford) are used for routing, and spanning trees (Prim, Kruskal) for cheap network design and loop-free switching.
  2. World Wide Web and search engines. Web pages are vertices and hyperlinks are directed edges. Crawlers traverse this graph by BFS/DFS, and PageRank ranks pages using the link structure.
  3. Social networks. People are vertices and friendships are edges. Graph algorithms find communities, influencers and friend suggestions.
  4. Compiler design and operating systems. Control-flow graphs and data-flow graphs are used in optimisation. Register allocation is done by graph colouring. Directed graphs of resource allocation are used to detect deadlock (cycles).
  5. Databases and data structures. Trees, heaps and tries are special graphs. Entity relationships and dependency graphs are modelled with graphs.
  6. Scheduling and resource allocation. Graph colouring is used for timetabling and frequency assignment, and topological sorting for ordering tasks with dependencies.
  7. Artificial intelligence. State-space search (BFS, DFS, A*), decision trees and Bayesian networks use graphs.
  8. Circuit design (VLSI). Planar graphs are used to lay out circuits without crossing wires.
  9. Software engineering. Call graphs, module dependency graphs and finite-state machines.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2025 Spring · 7 marks

Write Dijkestra's Algorithm. Use Dijkestra's Algorithm to find the length of the shortest path from vertex A to E. (Weighted graph given in the paper.)

Answer

Dijkstra's algorithm finds the shortest path from a source vertex to all other vertices in a weighted graph with non-negative edge weights.

  1. Set d(source)=0d(\text{source}) = 0 and d(v)=∞d(v) = \infty for every other vertex. Let S=∅S = \emptyset (the set of finished vertices).
  2. Pick the vertex u∉Su \notin S with the smallest d(u)d(u) and add it to SS.
  3. For every neighbour vv of uu with v∉Sv \notin S: if d(u)+w(u,v)<d(v)d(u) + w(u,v) < d(v), set d(v)=d(u)+w(u,v)d(v) = d(u) + w(u,v) and record uu as the predecessor of vv.
  4. Repeat steps 2 and 3 until the destination is in SS (or all vertices are in SS).
  5. Trace the predecessors back from the destination to get the path.

Worked example. Consider the weighted graph with edges A-B=4A\text{-}B = 4, A-C=2A\text{-}C = 2, B-C=1B\text{-}C = 1, B-D=5B\text{-}D = 5, C-D=8C\text{-}D = 8, C-E=10C\text{-}E = 10, D-E=2D\text{-}E = 2.

StepVertex fixedABCDE
00∞\infty∞\infty∞\infty∞\infty
1A (0)042∞\infty∞\infty
2C (2)0321012
3B (3)032812
4D (8)032810
5E (10)032810

Shortest path: A→C→B→D→EA \to C \to B \to D \to E, with length 2+1+5+2=102 + 1 + 5 + 2 = 10.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2025 Spring · 8 marks

Differentiate between Hamiltonian circuit and Euler circuit. Give an example of graph with 5 vertices which is Hamiltonian but not eulerian.

Answer

BasisEuler circuitHamiltonian circuit
DefinitionA closed walk that uses every edge exactly onceA cycle that visits every vertex exactly once (returning to the start)
RepeatsVertices may repeat; edges may notNeither vertices nor edges repeat (except the start/end vertex)
ConditionExists iff the graph is connected and every vertex has even degreeNo simple necessary and sufficient condition is known
Sufficient testsThe degree test above is exactDirac: deg⁡(v)≥n/2\deg(v) \ge n/2 for all vv (with n≥3n \ge 3); Ore: deg⁡(u)+deg⁡(v)≥n\deg(u)+\deg(v)\ge n for non-adjacent u,vu,v
DifficultyEasy to testNP-complete to decide
Named afterLeonhard Euler (Königsberg bridges)W. R. Hamilton (icosian game)

Example: Hamiltonian but not Eulerian (5 vertices). Take the 5-cycle v1v2v3v4v5v_1v_2v_3v_4v_5 and add the chord v1v3v_1v_3.

  • Hamiltonian: v1→v2→v3→v4→v5→v1v_1 \to v_2 \to v_3 \to v_4 \to v_5 \to v_1 visits all five vertices once.
  • Not Eulerian: deg⁡(v1)=3\deg(v_1) = 3 and deg⁡(v3)=3\deg(v_3) = 3 are odd, so no Euler circuit exists.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2025 Spring · 7 marks

Define Tautology, Contradiction and Logical Equivalence. Prove that implication and its contraposition are logically equivalent.

Answer

Tautology. A compound proposition that is true for every assignment of truth values to its variables, for example p∨∼pp \vee \sim p.

Contradiction. A compound proposition that is false for every assignment of truth values, for example p∧∼pp \wedge \sim p.

Logical equivalence. Two propositions AA and BB are logically equivalent, written A≡BA \equiv B, if A↔BA \leftrightarrow B is a tautology, i.e. they have the same truth value in every row of the truth table.

Claim. p→q≡∼q→∼pp \to q \equiv \sim q \to \sim p.

ppqq∼p\sim p∼q\sim qp→qp \to q∼q→∼p\sim q \to \sim p
TTFFTT
TFFTFF
FTTFTT
FFTTTT

The last two columns are identical in every row, so p→q≡∼q→∼pp \to q \equiv \sim q \to \sim p: an implication and its contrapositive are logically equivalent.

Algebraic check. ∼q→∼p≡∼(∼q)∨∼p≡q∨∼p≡∼p∨q≡p→q\sim q \to \sim p \equiv \sim(\sim q) \vee \sim p \equiv q \vee \sim p \equiv \sim p \vee q \equiv p \to q.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2025 Spring · 8 marks

State the principle of mathematical induction. Using mathematical induction, prove that: 1+3+5+⋯+(2n−1)=n21 + 3 + 5 + \cdots + (2n-1) = n^2 for all n≥1n \ge 1.

Answer

Principle of mathematical induction. Let P(n)P(n) be a statement about the integer n≥n0n \ge n_0. If

  1. Basis step: P(n0)P(n_0) is true, and
  2. Inductive step: for every k≥n0k \ge n_0, P(k)⇒P(k+1)P(k) \Rightarrow P(k+1),

then P(n)P(n) is true for all integers n≥n0n \ge n_0.

Proof. Let P(n)P(n): 1+3+5+⋯+(2n−1)=n21 + 3 + 5 + \cdots + (2n-1) = n^2.

Basis step (n=1n = 1). LHS =1= 1 and RHS =12=1= 1^2 = 1. So P(1)P(1) is true.

Inductive step. Assume P(k)P(k) is true for some k≥1k \ge 1:

1+3+5+⋯+(2k−1)=k21 + 3 + 5 + \cdots + (2k-1) = k^2

Add the next term 2(k+1)−1=2k+12(k+1) - 1 = 2k+1 to both sides:

1+3+⋯+(2k−1)+(2k+1)=k2+2k+1=(k+1)21 + 3 + \cdots + (2k-1) + (2k+1) = k^2 + 2k + 1 = (k+1)^2

This is exactly P(k+1)P(k+1). Hence P(k)⇒P(k+1)P(k) \Rightarrow P(k+1).

By the principle of mathematical induction, 1+3+5+⋯+(2n−1)=n21 + 3 + 5 + \cdots + (2n-1) = n^2 for all n≥1n \ge 1. ■\blacksquare

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2025 Spring · 7 marks

Verify following argument is valid using the rules of inference: If it rains, then the ground will be wet. If it does not rain, then the picnic will be held. If the picnic is held, then I will have a good time. Therefore, if the ground is not wet, then I will have a good time.

Answer

Let pp: it rains; ww: the ground is wet; qq: the picnic is held; hh: I have a good time.

Premises: p→wp \to w,  ∼p→q\ \sim p \to q,  q→h\ q \to h.

Conclusion: ∼w→h\sim w \to h.

StepStatementReason
1p→wp \to wPremise
2∼w→∼p\sim w \to \sim pContrapositive of 1
3∼p→q\sim p \to qPremise
4∼w→q\sim w \to qHypothetical syllogism (2, 3)
5q→hq \to hPremise
6∼w→h\sim w \to hHypothetical syllogism (4, 5)

The conclusion follows from the premises by valid rules of inference, so the argument is valid.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2025 Spring · 8 marks

Differentiate between Direct and Indirect proof. Prove that 2\sqrt{2} is an irrational number.

Answer

Difference between direct and indirect proof

Direct proofIndirect proof
To prove p→qp \to q, assume pp is true and deduce qq through a chain of valid steps.To prove p→qp \to q, do not argue from pp to qq directly.
Starts from the hypothesis and moves straight to the conclusion.Either (a) contrapositive: assume ∼q\sim q and prove ∼p\sim p; or (b) contradiction: assume p∧∼qp \wedge \sim q and derive a contradiction.
Used when the path from pp to qq is obvious.Used when the direct route is hard, or when the conclusion is a negative statement such as "is irrational".
Example: if nn is even, then n2n^2 is even.Example: 2\sqrt{2} is irrational.

Theorem. 2\sqrt{2} is irrational.

Proof (by contradiction). Suppose 2\sqrt{2} is rational. Then 2=ab\sqrt{2} = \dfrac{a}{b} with integers a,ba, b, b≠0b \ne 0, and a,ba, b have no common factor (the fraction is in lowest terms).

Squaring gives 2=a2b22 = \dfrac{a^2}{b^2}, so

a2=2b2a^2 = 2b^2

Thus a2a^2 is even, which means aa is even (if aa were odd, a2a^2 would be odd). Write a=2ka = 2k. Then

4k2=2b2  ⇒  b2=2k24k^2 = 2b^2 \;\Rightarrow\; b^2 = 2k^2

So b2b^2 is even, and hence bb is even.

Now both aa and bb are even, so they have the common factor 22. This contradicts the assumption that ab\dfrac{a}{b} is in lowest terms.

Therefore the assumption is false, and 2\sqrt{2} is irrational. ■\blacksquare

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2025 Spring · 8 marks

Explain the concept of Finite State Machine with examples.

Answer

Finite State Machine (FSM). A finite state machine is an abstract model of computation with a finite number of states. At any time it is in exactly one state, and it moves from state to state on input symbols according to a transition function. It is used to model digital circuits, protocols, lexical analysers and control systems.

Types:

  1. FSM with output (Mealy/Moore machine). M=(S,I,O,f,g,s0)M = (S, I, O, f, g, s_0): SS states, II input alphabet, OO output alphabet, f:S×I→Sf: S \times I \to S the next-state function, gg the output function (depending on state and input for Mealy, on state only for Moore), and s0s_0 the initial state.
  2. FSM without output (finite automaton, DFA/NFA). M=(Q,Σ,δ,q0,F)M = (Q, \Sigma, \delta, q_0, F) with a set FF of final states. It accepts a string if it ends in a final state. The accepted strings form a regular language.

Example 1 (Mealy machine: parity / unit delay). A machine with states s0,s1s_0, s_1 that outputs 11 when the input bit differs from the previous one.

StateInput 0Input 1
s0s_0s0s_0, out 0s1s_1, out 1
s1s_1s0s_0, out 1s1s_1, out 0

For input 01100110 from s0s_0, the output is 0 1 0 10\,1\,0\,1.

Example 2 (DFA). A DFA accepting binary strings with an even number of 1s: states EE (start and final) and OO; on 00 stay in the same state, on 11 switch between EE and OO.

Example 3 (vending machine). States record the amount inserted (0, 5, 10); inputs are coins; the output is "release item" once the total reaches 15.

An FSM is drawn as a state diagram (circles for states, labelled arrows for transitions) or written as a state table.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2025 Spring · 5 marks

Write short notes on: Grammar

Answer

Grammar. A formal grammar describes how to generate the strings of a language. It is defined as a 4-tuple

G=(V,T,P,S)G = (V, T, P, S)

  • VV: finite set of variables (non-terminals).
  • TT: finite set of terminals (the alphabet of the language), with V∩T=∅V \cap T = \emptyset.
  • PP: finite set of production rules of the form α→β\alpha \to \beta.
  • S∈VS \in V: the start symbol.

The language generated is L(G)={w∈T∗:S⇒∗w}L(G) = \{w \in T^* : S \Rightarrow^* w\}, the set of terminal strings derivable from SS.

Example. G=({S},{a,b},P,S)G = (\{S\}, \{a, b\}, P, S) with P:S→aSb∣abP: S \to aSb \mid ab generates {anbn:n≥1}\{a^n b^n : n \ge 1\}. A derivation is S⇒aSb⇒aabbS \Rightarrow aSb \Rightarrow aabb.

Chomsky hierarchy:

TypeGrammarProductionsAccepted by
0Unrestricted (phrase structure)α→β\alpha \to \betaTuring machine
1Context-sensitiveα→β\alpha \to \beta with ∣α∣≤∣β∣\lvert\alpha\rvert \le \lvert\beta\rvertLinear bounded automaton
2Context-freeA→γA \to \gammaPushdown automaton
3RegularA→aBA \to aB or A→aA \to aFinite automaton

Each type is a proper subset of the one above it. Grammars are used to define programming-language syntax and in compiler design.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2025 Spring · 5 marks

Write short notes on: Predicate and Quantifiers

Answer

Predicate. A predicate is a statement containing one or more variables that becomes a proposition when values are assigned to the variables, for example P(x)P(x): "x>3x > 3". P(5)P(5) is true and P(1)P(1) is false. The set of values allowed for xx is the domain (universe of discourse).

Quantifiers. Quantifiers state for how many values of the variable the predicate holds.

  1. Universal quantifier ∀\forall ("for all"). ∀x P(x)\forall x\, P(x) is true if P(x)P(x) is true for every xx in the domain, and false if there is at least one counterexample.
  2. Existential quantifier ∃\exists ("there exists"). ∃x P(x)\exists x\, P(x) is true if P(x)P(x) is true for at least one xx in the domain, and false if P(x)P(x) is false for every xx.

Negation (generalised De Morgan laws):

∼∀x P(x)≡∃x ∼P(x),∼∃x P(x)≡∀x ∼P(x)\sim\forall x\, P(x) \equiv \exists x\, \sim P(x),\qquad \sim\exists x\, P(x) \equiv \forall x\, \sim P(x)

Examples. Domain: real numbers. ∀x (x2≥0)\forall x\,(x^2 \ge 0) is true. ∃x (x2=2)\exists x\,(x^2 = 2) is true. ∀x (x>0)\forall x\,(x > 0) is false.

Translation. "All students are clever" is ∀x (S(x)→C(x))\forall x\,(S(x) \to C(x)); "Some student is clever" is ∃x (S(x)∧C(x))\exists x\,(S(x) \wedge C(x)).

Quantified predicates are the basis of predicate logic, used in specifications, databases (SQL) and automated reasoning.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2025 Spring · 5 marks

Write short notes on: Path matrix

Answer

Path matrix (reachability matrix). For a directed graph GG with nn vertices v1,…,vnv_1, \dots, v_n, the path matrix P=[pij]P = [p_{ij}] is the n×nn \times n Boolean matrix with

pij={1if there is a path from vi to vj0otherwisep_{ij} = \begin{cases} 1 & \text{if there is a path from } v_i \text{ to } v_j \\ 0 & \text{otherwise} \end{cases}

It tells which vertices can be reached from which, whatever the path length.

Computing from the adjacency matrix AA. A path in an nn-vertex graph has length at most nn, so

Bn=A+A2+A3+⋯+AnB_n = A + A^2 + A^3 + \cdots + A^n

and pij=1p_{ij} = 1 if the entry (Bn)ij≠0(B_n)_{ij} \ne 0, else 00. Equivalently, P=A∨A(2)∨⋯∨A(n)P = A \vee A^{(2)} \vee \cdots \vee A^{(n)} using Boolean matrix products.

Warshall's algorithm computes it more efficiently. Start with P(0)=AP^{(0)} = A and for k=1,…,nk = 1, \dots, n set

pij(k)=pij(k−1)∨(pik(k−1)∧pkj(k−1))p^{(k)}_{ij} = p^{(k-1)}_{ij} \vee \left(p^{(k-1)}_{ik} \wedge p^{(k-1)}_{kj}\right)

The final matrix P(n)P^{(n)} is the path matrix. It takes O(n3)O(n^3) time.

Uses. Testing whether a graph is strongly connected (all entries of PP are 1), finding the transitive closure of a relation, and detecting cycles (some pii=1p_{ii} = 1).

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2024 Fall · 7 marks

Define pseudograph, directed graph, wheel and tree with example. Show that for n vertices for a complete graph the number of edges is n(n−1)/2n(n-1)/2.

Answer

Pseudograph. A graph in which both multiple edges (parallel edges) and loops (an edge joining a vertex to itself) are allowed. Example: vertices a,ba, b with two edges between aa and bb and a loop at aa.

Directed graph (digraph). A graph G=(V,E)G = (V, E) in which each edge is an ordered pair (u,v)(u, v) of vertices, drawn as an arrow from uu (initial vertex) to vv (terminal vertex). Example: V={1,2,3}V = \{1, 2, 3\}, E={(1,2),(2,3),(3,1)}E = \{(1,2), (2,3), (3,1)\} is a directed triangle.

Wheel WnW_n. Take the cycle CnC_n and add one new vertex (the hub) joined to every vertex of the cycle. Example: W4W_4 has 5 vertices (a 4-cycle plus a hub) and 4+4=84 + 4 = 8 edges.

Tree. A connected undirected graph with no cycles. A tree with nn vertices has exactly n−1n-1 edges, and there is a unique path between any two vertices. Example: a path a−b−c−da - b - c - d, or a star with one centre joined to three leaves.

Number of edges of KnK_n. In the complete graph KnK_n every pair of distinct vertices is joined by exactly one edge, so the number of edges equals the number of ways to choose 2 vertices from nn:

∣E∣=(n2)=n(n−1)2|E| = \binom{n}{2} = \frac{n(n-1)}{2}

Alternatively, each vertex has degree n−1n-1, so by the handshaking theorem 2∣E∣=n(n−1)2|E| = n(n-1), giving ∣E∣=n(n−1)2|E| = \dfrac{n(n-1)}{2}. ■\blacksquare

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2024 Fall · 7 marks

Derive the adjacency and incidence matrix representation forms for the following graph. (Graph with vertices V1 to V5 and edges e1 to e8 given in the paper.)

Answer

Take the graph with vertices V1,…,V5V_1, \dots, V_5 and edges e1=V1V2, e2=V1V3, e3=V2V3, e4=V2V4, e5=V3V4, e6=V3V5, e7=V4V5, e8=V1V5e_1 = V_1V_2,\ e_2 = V_1V_3,\ e_3 = V_2V_3,\ e_4 = V_2V_4,\ e_5 = V_3V_4,\ e_6 = V_3V_5,\ e_7 = V_4V_5,\ e_8 = V_1V_5.

Adjacency matrix. A=[aij]A = [a_{ij}] is 5×55 \times 5 with aij=1a_{ij} = 1 if ViV_i and VjV_j are joined by an edge (the count of edges if parallel edges exist), else 00. For an undirected graph it is symmetric.

A=V1V2V3V4V5V101101V210110V311011V401101V510110A = \begin{array}{c|ccccc} & V_1 & V_2 & V_3 & V_4 & V_5 \\ \hline V_1 & 0 & 1 & 1 & 0 & 1 \\ V_2 & 1 & 0 & 1 & 1 & 0 \\ V_3 & 1 & 1 & 0 & 1 & 1 \\ V_4 & 0 & 1 & 1 & 0 & 1 \\ V_5 & 1 & 0 & 1 & 1 & 0 \end{array}

Row sums give the degrees: 3,3,4,3,33, 3, 4, 3, 3.

Incidence matrix. B=[bij]B = [b_{ij}] is 5×85 \times 8 (vertices by edges) with bij=1b_{ij} = 1 if vertex ViV_i is an end of edge eje_j, else 00.

B=e1e2e3e4e5e6e7e8V111000001V210110000V301101100V400011010V500000111B = \begin{array}{c|cccccccc} & e_1 & e_2 & e_3 & e_4 & e_5 & e_6 & e_7 & e_8 \\ \hline V_1 & 1 & 1 & 0 & 0 & 0 & 0 & 0 & 1 \\ V_2 & 1 & 0 & 1 & 1 & 0 & 0 & 0 & 0 \\ V_3 & 0 & 1 & 1 & 0 & 1 & 1 & 0 & 0 \\ V_4 & 0 & 0 & 0 & 1 & 1 & 0 & 1 & 0 \\ V_5 & 0 & 0 & 0 & 0 & 0 & 1 & 1 & 1 \end{array}

Each column has exactly two 1s (every edge has two end vertices), and each row sum equals the degree of the vertex.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2024 Fall · 8 marks

Use Dijkstra's algorithm to find the length of shortest path from 'a' to 'z' in the following weighted graph. Also highlight the shortest path in the graph.

Answer

Consider the weighted graph with edges ab=4, ac=2, bc=1, bd=5, cd=8, ce=10, de=2, dz=6, ez=3ab = 4,\ ac = 2,\ bc = 1,\ bd = 5,\ cd = 8,\ ce = 10,\ de = 2,\ dz = 6,\ ez = 3.

Dijkstra's algorithm. Set d(a)=0d(a) = 0 and all other labels ∞\infty. Repeatedly fix the unfixed vertex with the smallest label and relax the labels of its neighbours.

StepFixedbcdez
0a (0)42∞\infty∞\infty∞\infty
1c (2)321012∞\infty
2b (3)32812∞\infty
3d (8)3281014
4e (10)3281013
5z (13)13

Labels at each step: after fixing cc, b=min⁡(4,2+1)=3b = \min(4, 2+1) = 3, d=2+8=10d = 2+8 = 10, e=2+10=12e = 2+10 = 12; after fixing bb, d=min⁡(10,3+5)=8d = \min(10, 3+5) = 8; after fixing dd, e=min⁡(12,8+2)=10e = \min(12, 8+2) = 10 and z=8+6=14z = 8+6 = 14; after fixing ee, z=min⁡(14,10+3)=13z = \min(14, 10+3) = 13.

Tracing predecessors back from zz: z←e←d←b←c←az \leftarrow e \leftarrow d \leftarrow b \leftarrow c \leftarrow a.

Shortest path: a→c→b→d→e→za \to c \to b \to d \to e \to z, of length 2+1+5+2+3=132 + 1 + 5 + 2 + 3 = 13. These edges are the ones highlighted in the graph.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2024 Fall · 7 marks

Verify following argument is valid using the rules of inference: "If I work hard, then I will get job" and "If I get job then I'll be happy." "I will not be happy." Therefore, "Either I will not get job or I will not work hard".

Answer

Let pp: I work hard; qq: I get a job; rr: I will be happy.

Premises: p→qp \to q,  q→r\ q \to r,  ∼r\ \sim r.

Conclusion: ∼q∨∼p\sim q \vee \sim p.

StepStatementReason
1p→qp \to qPremise
2q→rq \to rPremise
3p→rp \to rHypothetical syllogism (1, 2)
4∼r\sim rPremise
5∼p\sim pModus tollens (3, 4)
6∼p∨∼q\sim p \vee \sim qAddition (5)
7∼q∨∼p\sim q \vee \sim pCommutative law (6)

Hence the argument is valid.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2024 Fall · 8 marks

Express above statement using quantifiers where domain consist of all animals
i. No tigers are herbivorous. ii. All herbivorous animals are prey. iii. No prey is a tiger. iv. Some tigers are omnivorous.

Answer

Let the domain be all animals, with predicates T(x)T(x): xx is a tiger; H(x)H(x): xx is herbivorous; P(x)P(x): xx is prey; O(x)O(x): xx is omnivorous.

(i) No tigers are herbivorous.

∀x (T(x)→∼H(x))(equivalently ∼∃x (T(x)∧H(x)))\forall x\,\big(T(x) \to \sim H(x)\big) \quad\text{(equivalently } \sim\exists x\,(T(x) \wedge H(x))\text{)}

(ii) All herbivorous animals are prey.

∀x (H(x)→P(x))\forall x\,\big(H(x) \to P(x)\big)

(iii) No prey is a tiger.

∀x (P(x)→∼T(x))(equivalently ∼∃x (P(x)∧T(x)))\forall x\,\big(P(x) \to \sim T(x)\big) \quad\text{(equivalently } \sim\exists x\,(P(x) \wedge T(x))\text{)}

(iv) Some tigers are omnivorous.

∃x (T(x)∧O(x))\exists x\,\big(T(x) \wedge O(x)\big)

A universal statement uses →\to and an existential statement uses ∧\wedge.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2024 Fall · 7 marks

Define indirect proof. Prove that if n is an integer and n2+5n^2 + 5 is odd, then n is even using indirect proof.

Answer

Indirect proof. A proof of p→qp \to q that does not start from pp and reach qq directly. Two forms are used: proof by contrapositive (prove ∼q→∼p\sim q \to \sim p, which is equivalent to p→qp \to q) and proof by contradiction (assume p∧∼qp \wedge \sim q and derive a contradiction).

Claim. If nn is an integer and n2+5n^2 + 5 is odd, then nn is even.

Proof (contrapositive). We prove: if nn is odd, then n2+5n^2 + 5 is even.

Let nn be odd, so n=2k+1n = 2k + 1 for some integer kk. Then

n2+5=(2k+1)2+5=4k2+4k+1+5=4k2+4k+6=2(2k2+2k+3)n^2 + 5 = (2k+1)^2 + 5 = 4k^2 + 4k + 1 + 5 = 4k^2 + 4k + 6 = 2(2k^2 + 2k + 3)

Since 2k2+2k+32k^2 + 2k + 3 is an integer, n2+5n^2 + 5 is even.

So the contrapositive is true, and therefore the original statement is true: if n2+5n^2 + 5 is odd, then nn is even. ■\blacksquare

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2024 Fall · 8 marks

Using the truth table, prove the following logical equivalence
i. (given in the paper) ii. ∼p∨q≡∼(p∧∼q)\sim p \vee q \equiv \sim(p \wedge \sim q) iii. p∨p≡pp \vee p \equiv p

Answer

(i) De Morgan's law: ∼(p∨q)≡∼p∧∼q\sim(p \vee q) \equiv \sim p \wedge \sim q.

ppqqp∨qp \vee q∼(p∨q)\sim(p \vee q)∼p\sim p∼q\sim q∼p∧∼q\sim p \wedge \sim q
TTTFFFF
TFTFFTF
FTTFTFF
FFFTTTT

The columns for ∼(p∨q)\sim(p \vee q) and ∼p∧∼q\sim p \wedge \sim q are identical, so they are equivalent.

(ii) ∼p∨q≡∼(p∧∼q)\sim p \vee q \equiv \sim(p \wedge \sim q).

ppqq∼p\sim p∼q\sim q∼p∨q\sim p \vee qp∧∼qp \wedge \sim q∼(p∧∼q)\sim(p \wedge \sim q)
TTFFTFT
TFFTFTF
FTTFTFT
FFTTTFT

The columns for ∼p∨q\sim p \vee q and ∼(p∧∼q)\sim(p \wedge \sim q) are identical, so the equivalence holds.

(iii) p∨p≡pp \vee p \equiv p (idempotent law).

ppp∨pp \vee p
TT
FF

The column of p∨pp \vee p equals the column of pp, so p∨p≡pp \vee p \equiv p.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2024 Fall · 7 marks

A shareholder invested in the shares of a company listed on the stock market in 2020, with an initial investment of 100,000 NPR. Each year, the shareholder's investment grows by 12% of the value of the investment from the previous year. Prepare the following:
i. Set up a recurrence relation for the value of the investment after each year. ii. Find an explicit formula for the value of the investment after n years since 2020. iii. What will be the value of the investment in 2030?

Answer

Let ana_n be the value of the investment (in Rs) nn years after 2020.

(i) Recurrence relation. Each year the value grows by 12% of the previous year's value, so

an=an−1+0.12 an−1=1.12 an−1,a0=100000a_n = a_{n-1} + 0.12\,a_{n-1} = 1.12\,a_{n-1},\qquad a_0 = 100000

(ii) Explicit formula. This is a first-order linear homogeneous recurrence with characteristic root r=1.12r = 1.12, so an=C(1.12)na_n = C(1.12)^n. From a0=100000a_0 = 100000, C=100000C = 100000:

an=100000 (1.12)na_n = 100000\,(1.12)^n

(iii) Value in 2030. 2030 is n=10n = 10 years after 2020:

a10=100000 (1.12)10=100000×3.10585≈Rs 3,10,585a_{10} = 100000\,(1.12)^{10} = 100000 \times 3.10585 \approx \text{Rs } 3{,}10{,}585

The investment will be worth about Rs 3,10,585 (Rs 310,585) in 2030.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2024 Fall · 7 marks

Consider the following Grammar: S→ACaBS \to ACaB, Bc→acBBc \to acB, CB→DBCB \to DB, aD→DbaD \to Db. Determine whether the given grammar is Context-sensitive, Context Free, Regular or none of these.

Answer

Productions: S→ACaBS \to ACaB,  Bc→acB\ Bc \to acB,  CB→DB\ CB \to DB,  aD→Db\ aD \to Db.

Test for Context-Free / Regular. A context-free grammar needs every production to have a single non-terminal on the left. Here BcBc, CBCB and aDaD have two symbols on the left, so the grammar is not context-free, and hence not regular.

Test for Context-Sensitive. A context-sensitive (type 1) grammar needs ∣α∣≤∣β∣|\alpha| \le |\beta| for every production α→β\alpha \to \beta (non-contracting, with no rule shortening a string):

Production∣α∣\lvert\alpha\rvert∣β∣\lvert\beta\rvertNon-contracting?
S→ACaBS \to ACaB14Yes
Bc→acBBc \to acB23Yes
CB→DBCB \to DB22Yes
aD→DbaD \to Db22Yes

All productions satisfy ∣α∣≤∣β∣|\alpha| \le |\beta|.

Conclusion: the grammar is context-sensitive (type 1). It is neither context-free nor regular.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2024 Fall · 5 marks

Write short notes on: Regular expression

Answer

Regular expression (RE). A regular expression is an algebraic way of describing a language over an alphabet Σ\Sigma. It is defined recursively:

  1. ∅\emptyset (empty set), ε\varepsilon (empty string) and each symbol a∈Σa \in \Sigma are regular expressions.
  2. If RR and SS are regular expressions, so are:
    • R+SR + S (union, also written R∣SR \mid S): strings from RR or SS.
    • RSRS (concatenation): a string from RR followed by a string from SS.
    • R∗R^* (Kleene star): zero or more strings from RR concatenated.
  3. Nothing else is a regular expression.

Examples over Σ={a,b}\Sigma = \{a, b\}:

ExpressionLanguage
a∗a^*ε,a,aa,aaa,…\varepsilon, a, aa, aaa, \dots
(a+b)∗(a+b)^*all strings over {a,b}\{a, b\}
(a+b)∗abb(a+b)^*abbstrings ending with abbabb
a(a+b)∗ba(a+b)^*bstrings starting with aa and ending with bb
(ab)∗(ab)^*ε,ab,abab,…\varepsilon, ab, abab, \dots

Key results.

  • The languages described by regular expressions are exactly the regular languages, those accepted by DFAs/NFAs and generated by regular (type 3) grammars (Kleene's theorem).
  • Some algebraic laws: R+S=S+RR + S = S + R, R∅=∅R\emptyset = \emptyset, Rε=RR\varepsilon = R, (R∗)∗=R∗(R^*)^* = R^*, ε+RR∗=R∗\varepsilon + RR^* = R^*.

Uses: pattern matching in text editors and grep, lexical analysis in compilers, and input validation.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2024 Fall · 5 marks

Write short notes on: Tautology, contradiction, contingent

Answer

Tautology. A compound proposition that is true for all possible truth values of its component propositions. Example: p∨∼pp \vee \sim p.

Contradiction. A compound proposition that is false for all possible truth values of its components. Example: p∧∼pp \wedge \sim p.

Contingency. A compound proposition that is neither a tautology nor a contradiction, so it is true for some assignments and false for others. Example: p→qp \to q, or p∧qp \wedge q.

pp∼p\sim pp∨∼pp \vee \sim p (tautology)p∧∼pp \wedge \sim p (contradiction)pp (contingency)
TFTFT
FTTFF

Relations:

  • The negation of a tautology is a contradiction, and the negation of a contradiction is a tautology.
  • The negation of a contingency is a contingency.
  • A≡BA \equiv B exactly when A↔BA \leftrightarrow B is a tautology.

Whether a proposition is one of these three types is checked by a truth table or by logical laws.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2024 Spring · 7 marks

What is the degree sequence of KnK_n, where n is a positive integer? How many subgraphs with at least one vertex does K2K_2 have? Draw the structure of following graphs: K6K_6, K3,4K_{3,4}, W6W_6, C6C_6, Q3Q_3

Answer

Degree sequence of KnK_n. Every vertex of KnK_n is adjacent to the other n−1n-1 vertices, so every vertex has degree n−1n-1. The degree sequence is

(n−1, n−1, …, n−1⏟n times)(\underbrace{n-1,\ n-1,\ \dots,\ n-1}_{n \text{ times}})

and the number of edges is n(n−1)2\dfrac{n(n-1)}{2}.

Subgraphs of K2K_2 with at least one vertex. K2K_2 has vertices u,vu, v and one edge e=uve = uv. The subgraphs are:

  1. {u}\{u\} (one vertex, no edge)
  2. {v}\{v\}
  3. {u,v}\{u, v\} with no edge
  4. {u,v}\{u, v\} with edge ee (the whole graph)

So there are 4 subgraphs.

The graphs:

GraphStructureVerticesEdges
K6K_66 vertices placed on a hexagon, every pair joined (each vertex has degree 5)615
K3,4K_{3,4}Two sets {a1,a2,a3}\{a_1,a_2,a_3\} and {b1,…,b4}\{b_1,\dots,b_4\}; each aia_i joined to every bjb_j, no edge inside a set712
W6W_6A hexagon C6C_6 plus a hub vertex joined to all 6 corners712
C6C_6A single 6-cycle (hexagon)66
Q3Q_3The cube: vertices are the binary strings of length 3, edges join strings differing in one bit812

Drawing guide: for Q3Q_3, draw two squares (one inside the other, or one shifted) for strings starting with 00 and with 11, and join corresponding corners; each vertex has degree 3.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2024 Spring · 8 marks

Explain and prove Handshaking theorem. Is K3,3K_{3,3} planar graph? Explain with reason.

Answer

Handshaking theorem. In any undirected graph G=(V,E)G = (V, E),

∑v∈Vdeg⁡(v)=2∣E∣\sum_{v \in V} \deg(v) = 2|E|

That is, the sum of the degrees of all vertices is twice the number of edges. (A loop adds 2 to the degree of its vertex.)

Proof. Every edge has two end points, so it contributes exactly 1 to the degree of each of its two end vertices (or 2 to one vertex, for a loop). Summing the degrees over all vertices therefore counts each edge exactly twice. Hence ∑deg⁡(v)=2∣E∣\sum \deg(v) = 2|E|. ■\blacksquare

Corollary. The number of vertices of odd degree is even. Since ∑deg⁡(v)\sum \deg(v) is even and the even-degree vertices contribute an even amount, the odd-degree vertices must contribute an even total, which needs an even count of them.

Is K3,3K_{3,3} planar? No.

K3,3K_{3,3} has v=6v = 6 vertices and e=3×3=9e = 3 \times 3 = 9 edges. Suppose it were planar. Euler's formula gives v−e+f=2v - e + f = 2, so f=2−6+9=5f = 2 - 6 + 9 = 5 faces.

K3,3K_{3,3} is bipartite, so it has no odd cycles and in particular no triangle. Every face is therefore bounded by at least 4 edges. Each edge borders at most two faces, so

4f≤2e  ⇒  4(5)=20≤184f \le 2e \;\Rightarrow\; 4(5) = 20 \le 18

which is false. Equivalently, a simple bipartite planar graph satisfies e≤2v−4=8e \le 2v - 4 = 8, but e=9>8e = 9 > 8.

This contradiction shows that K3,3K_{3,3} is not planar (by Kuratowski's theorem it is one of the two basic non-planar graphs, together with K5K_5).

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2024 Spring · 7 marks

Find the shortest path between 'a' and 'g' using Dijkstra's algorithm for the following graph. (Weighted graph given in the paper.)

Answer

Consider the weighted graph with edges ab=2, ac=4, bc=1, bd=7, ce=3, de=2, dg=1, eg=6ab = 2,\ ac = 4,\ bc = 1,\ bd = 7,\ ce = 3,\ de = 2,\ dg = 1,\ eg = 6.

Dijkstra's algorithm. Label aa with 00 and all other vertices with ∞\infty. At each step fix the unfixed vertex with the smallest label and relax the labels of its neighbours.

StepFixedbcdeg
0a (0)24∞\infty∞\infty∞\infty
1b (2)239∞\infty∞\infty
2c (3)2396∞\infty
3e (6)238612
4d (8)23869
5g (9)9

Relaxations: from bb, c=min⁡(4,2+1)=3c = \min(4, 2+1) = 3 and d=2+7=9d = 2+7 = 9; from cc, e=3+3=6e = 3+3 = 6; from ee, d=min⁡(9,6+2)=8d = \min(9, 6+2) = 8 and g=6+6=12g = 6+6 = 12; from dd, g=min⁡(12,8+1)=9g = \min(12, 8+1) = 9.

Tracing predecessors from gg: g←d←e←c←b←ag \leftarrow d \leftarrow e \leftarrow c \leftarrow b \leftarrow a.

Shortest path: a→b→c→e→d→ga \to b \to c \to e \to d \to g, of length 2+1+3+2+1=92 + 1 + 3 + 2 + 1 = 9.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2024 Spring · 8 marks

Define the Euler circuit and Hamilton Circuit. Give an example of a connected graph with Euler circuit but no Hamiltonian circuit.

Answer

Euler circuit. A circuit (closed walk) in a graph that uses every edge exactly once. A connected graph has an Euler circuit if and only if every vertex has even degree.

Hamilton circuit. A simple cycle in a graph that passes through every vertex exactly once and returns to the starting vertex.

Example: connected graph with an Euler circuit but no Hamilton circuit. The "bowtie" (butterfly) graph: two triangles a b ca\,b\,c and c d ec\,d\,e sharing the common vertex cc. It has 5 vertices and 6 edges: ab,bc,ca,cd,de,ecab, bc, ca, cd, de, ec.

  • Euler circuit exists: deg⁡(c)=4\deg(c) = 4 and deg⁡(a)=deg⁡(b)=deg⁡(d)=deg⁡(e)=2\deg(a) = \deg(b) = \deg(d) = \deg(e) = 2, all even, and the graph is connected. The circuit is c→a→b→c→d→e→cc \to a \to b \to c \to d \to e \to c, which uses all 6 edges once.
  • No Hamilton circuit: the vertex cc is a cut vertex (removing it disconnects the graph). Any cycle through all vertices would have to pass through cc twice, once to go between the two triangles and again to come back, but a Hamilton circuit may visit each vertex only once. Hence no Hamilton circuit exists.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2024 Spring · 7 marks

What is logical Equivalence? Solve the following.
i. Show that (p∨q)∧[(∼p)∧(∼q)](p \vee q) \wedge [(\sim p) \wedge (\sim q)] is contradiction. ii. Prove the condition for contrapositive using truth table.

Answer

Logical equivalence. Two compound propositions AA and BB are logically equivalent, written A≡BA \equiv B, if they always have the same truth value, that is, if A↔BA \leftrightarrow B is a tautology. Example: p→q≡∼p∨qp \to q \equiv \sim p \vee q.

(i) Show that (p∨q)∧[(∼p)∧(∼q)](p \vee q) \wedge [(\sim p) \wedge (\sim q)] is a contradiction.

ppqqp∨qp \vee q∼p\sim p∼q\sim q∼p∧∼q\sim p \wedge \sim q(p∨q)∧(∼p∧∼q)(p \vee q) \wedge (\sim p \wedge \sim q)
TTTFFFF
TFTFTFF
FTTTFFF
FFFTTTF

The last column is false in every row, so the proposition is a contradiction.

(Algebraically, ∼p∧∼q≡∼(p∨q)\sim p \wedge \sim q \equiv \sim(p \vee q) by De Morgan's law, so the expression is X∧∼XX \wedge \sim X, which is always false.)

(ii) Contrapositive. The contrapositive of p→qp \to q is ∼q→∼p\sim q \to \sim p. We show p→q≡∼q→∼pp \to q \equiv \sim q \to \sim p.

ppqq∼p\sim p∼q\sim qp→qp \to q∼q→∼p\sim q \to \sim p
TTFFTT
TFFTFF
FTTFTT
FFTTTT

The last two columns are identical, so an implication is logically equivalent to its contrapositive.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2024 Spring · 8 marks

Show the hypothesis, "If it's sunny today, then we will have swimming today, if we do not have swimming today, then we will have swimming tomorrow. Therefore, if it's sunny today, then will we have swimming tomorrow.

Answer

Let ss: it is sunny today; ww: we have swimming today; tt: we have swimming tomorrow.

Hypotheses: s→ws \to w and ∼w→t\sim w \to t.

Conclusion to test: s→ts \to t.

Test. For the argument to be valid, the conclusion must be true whenever both hypotheses are true. Take s=Ts = T, w=Tw = T, t=Ft = F:

  • s→ws \to w is T→T=TT \to T = T.
  • ∼w→t\sim w \to t is F→F=TF \to F = T.
  • s→ts \to t is T→F=FT \to F = F.

Both hypotheses are true while the conclusion is false, so the argument is not valid as stated. In words, it is sunny and we swim today, which satisfies both premises, but nothing forces swimming tomorrow.

The two hypotheses chain in a valid way only if the second one is w→tw \to t, which gives, by hypothetical syllogism:

StepStatementReason
1s→ws \to wPremise
2w→tw \to tPremise
3s→ts \to tHypothetical syllogism (1, 2)

With the premise ∼w→t\sim w \to t as given, no such chain exists, since ∼w→t\sim w \to t does not connect to s→ws \to w.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2024 Spring · 7 marks

Explain proof by Contradiction. Solve that if m and n are odd (statement as given in the paper) using Contradiction approach.

Answer

Proof by contradiction. To prove a statement pp (or an implication p→qp \to q), assume the opposite, that is, assume ∼p\sim p (or p∧∼qp \wedge \sim q), and reason with valid steps until a contradiction is reached: either a statement of the form r∧∼rr \wedge \sim r or a result that contradicts a known fact or the hypotheses. Since valid reasoning from a true assumption cannot produce a falsehood, the assumption must be false, so the original statement is true.

Statement. If mm and nn are odd integers, then mnmn is odd (and m+nm + n is even).

Proof that mnmn is odd. Suppose mm and nn are odd but mnmn is not odd, i.e. mnmn is even.

Write m=2a+1m = 2a + 1 and n=2b+1n = 2b + 1 for integers a,ba, b. Then

mn=(2a+1)(2b+1)=4ab+2a+2b+1=2(2ab+a+b)+1mn = (2a+1)(2b+1) = 4ab + 2a + 2b + 1 = 2(2ab + a + b) + 1

which is of the form 2k+12k + 1 with k=2ab+a+bk = 2ab + a + b an integer, so mnmn is odd. This contradicts the assumption that mnmn is even. Hence mnmn is odd.

Proof that m+nm + n is even. Suppose instead that m+nm + n is odd. Then

m+n=(2a+1)+(2b+1)=2(a+b+1)m + n = (2a+1) + (2b+1) = 2(a + b + 1)

which is even, contradicting the assumption. Hence m+nm + n is even. ■\blacksquare

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2024 Spring · 8 marks

Use mathematical induction to prove that (3n+7n−2)(3^n + 7^n - 2) is divisible by 8, for n≥1n \ge 1.

Answer

Let P(n)P(n): 3n+7n−23^n + 7^n - 2 is divisible by 8.

Basis step (n=1n=1). 3+7−2=83 + 7 - 2 = 8, which is divisible by 8. So P(1)P(1) is true.

Inductive hypothesis. Assume P(k)P(k) is true for some k≥1k \ge 1, i.e. 3k+7k−2=8m3^k + 7^k - 2 = 8m for some integer mm.

Inductive step. We must show 3k+1+7k+1−23^{k+1} + 7^{k+1} - 2 is divisible by 8. Write

3k+1+7k+1−2=3⋅3k+7⋅7k−2=3 (3k+7k−2)+4⋅7k+4=3 (3k+7k−2)+4 (7k+1).3^{k+1} + 7^{k+1} - 2 = 3\cdot 3^k + 7\cdot 7^k - 2 = 3\,(3^k + 7^k - 2) + 4\cdot 7^k + 4 = 3\,(3^k+7^k-2) + 4\,(7^k + 1).

  • By the hypothesis, 3(3k+7k−2)=24m3(3^k + 7^k - 2) = 24m, divisible by 8.
  • 7k7^k is odd, so 7k+17^k + 1 is even, say 7k+1=2t7^k+1 = 2t. Then 4(7k+1)=8t4(7^k+1) = 8t, divisible by 8.

Hence 3k+1+7k+1−2=24m+8t=8(3m+t)3^{k+1} + 7^{k+1} - 2 = 24m + 8t = 8(3m + t) is divisible by 8, so P(k+1)P(k+1) is true.

By the principle of mathematical induction, 3n+7n−23^n + 7^n - 2 is divisible by 8 for all n≥1n \ge 1.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2024 Spring · 7 marks

Solve the recurrence relation an=2an−1+an−2−2an−3a_n = 2a_{n-1} + a_{n-2} - 2a_{n-3} for n≥3n \ge 3, a0=3a_0 = 3, a1=6a_1 = 6 and a2=9a_2 = 9.

Answer

Characteristic equation. For an=2an−1+an−2−2an−3a_n = 2a_{n-1} + a_{n-2} - 2a_{n-3} put an=rna_n = r^n:

r3−2r2−r+2=0  ⇒  r2(r−2)−(r−2)=0  ⇒  (r−2)(r−1)(r+1)=0.r^3 - 2r^2 - r + 2 = 0 \;\Rightarrow\; r^2(r-2) - (r-2) = 0 \;\Rightarrow\; (r-2)(r-1)(r+1) = 0.

The roots are r=2,1,−1r = 2, 1, -1 (distinct), so the general solution is

an=A 2n+B (1)n+C (−1)n.a_n = A\,2^n + B\,(1)^n + C\,(-1)^n .

Initial conditions.

  • n=0n=0: A+B+C=3A + B + C = 3
  • n=1n=1: 2A+B−C=62A + B - C = 6
  • n=2n=2: 4A+B+C=94A + B + C = 9

Subtracting the first from the third gives 3A=63A = 6, so A=2A = 2. Then B+C=1B + C = 1 and B−C=6−4=2B - C = 6 - 4 = 2, so B=32B = \tfrac32, C=−12C = -\tfrac12.

an=2n+1+32−12(−1)n\boxed{a_n = 2^{n+1} + \tfrac{3}{2} - \tfrac{1}{2}(-1)^n}

Check. a3=2a2+a1−2a0=18+6−6=18a_3 = 2a_2 + a_1 - 2a_0 = 18 + 6 - 6 = 18, and the formula gives 16+1.5+0.5=1816 + 1.5 + 0.5 = 18. ✓

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2024 Spring · 8 marks

An employee joined a company in 2019 with a starting salary of 520,000 Rs per year. Every year this employee receives a raise of 5% of the salary of the previous year.
i. Set up a recurrence relation for the salary of this employee. ii. Find an explicit formula for the salary of this employee n years after 2019. iii. What will the salary of this employee be in 2025?

Answer

Let SnS_n be the salary (in Rs) nn years after 2019, so S0=520,000S_0 = 520{,}000.

(i) Recurrence relation. Each year the salary is the previous salary plus 5% of it:

Sn=Sn−1+0.05 Sn−1=1.05 Sn−1,S0=520,000.S_n = S_{n-1} + 0.05\,S_{n-1} = 1.05\,S_{n-1}, \qquad S_0 = 520{,}000.

(ii) Explicit formula. This is a first-order linear homogeneous recurrence with root r=1.05r = 1.05, so Sn=c (1.05)nS_n = c\,(1.05)^n. Using S0=520,000S_0 = 520{,}000 gives c=520,000c = 520{,}000:

Sn=520,000 (1.05)n Rs.S_n = 520{,}000\,(1.05)^n \text{ Rs}.

(iii) Salary in 2025. 2025 is n=6n = 6 years after 2019.

S6=520,000 (1.05)6=520,000×1.340096≈Rs 696,850.S_6 = 520{,}000\,(1.05)^6 = 520{,}000 \times 1.340096 \approx \text{Rs } 696{,}850.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2024 Spring · 7 marks

Design DFA over Σ={0,1}\Sigma = \{0, 1\} which accepts:
i. The set of strings with even number of 1s and even number of 0s. ii. The set of strings that do not contain two consecutive 0s.

Answer

(i) Even number of 0s and even number of 1s.

Track the parity of 0s and of 1s. States (parity of 0s, parity of 1s): q0=q_0 = (even, even), q1=q_1 = (odd, even), q2=q_2 = (even, odd), q3=q_3 = (odd, odd).

M=(Q,Σ,δ,q0,F)M = (Q, \Sigma, \delta, q_0, F) with Q={q0,q1,q2,q3}Q=\{q_0,q_1,q_2,q_3\}, Σ={0,1}\Sigma=\{0,1\}, start state q0q_0, F={q0}F=\{q_0\}.

Stateon 0on 1
→∗q0\to *q_0q1q_1q2q_2
q1q_1q0q_0q3q_3
q2q_2q3q_3q0q_0
q3q_3q2q_2q1q_1

Reading a 0 flips the parity of 0s; reading a 1 flips the parity of 1s. The string is accepted exactly when both parities are even, i.e. it ends in q0q_0. The empty string is accepted.

(ii) Strings with no two consecutive 0s.

States: AA = start / last symbol was 1 (or nothing read), BB = last symbol was 0, DD = dead (two consecutive 0s seen). Final states: {A,B}\{A, B\}; start state AA.

Stateon 0on 1
→∗A\to *ABBAA
∗B*BDDAA
DDDDDD
        1                 1
      +---+     0       +---+
      v   |   ------>   |   |
 -->((A))---           ((B))
      ^        <------      \
      |   1   ----------     \ 0
      +--------              v
                              D (loops on 0,1)

That is: A→0BA \xrightarrow{0} B, A→1AA \xrightarrow{1} A, B→1AB \xrightarrow{1} A, B→0DB \xrightarrow{0} D, and DD loops on both 0 and 1. For example, 01010101 is accepted, while 10011001 ends in DD and is rejected.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2024 Spring · 5 marks

Write short notes on: Types of quantifiers

Answer

A quantifier states how many elements of the domain make a predicate P(x)P(x) true. The two basic types are:

1. Universal quantifier (∀\forall). ∀x P(x)\forall x\,P(x) means "P(x)P(x) is true for every xx in the domain". It is false if there is at least one counterexample. Example: ∀x (x2≥0)\forall x\,(x^2 \ge 0) over the real numbers.

2. Existential quantifier (∃\exists). ∃x P(x)\exists x\,P(x) means "there is at least one xx in the domain for which P(x)P(x) is true". It is false only when P(x)P(x) is false for every xx. Example: ∃x (x2=4)\exists x\,(x^2 = 4).

Related forms:

  • Uniqueness quantifier (∃!\exists!): ∃!x P(x)\exists!x\,P(x) means there is exactly one xx with P(x)P(x) true.
  • Negation (De Morgan for quantifiers):

¬∀x P(x)≡∃x ¬P(x),¬∃x P(x)≡∀x ¬P(x).\neg\forall x\,P(x) \equiv \exists x\,\neg P(x), \qquad \neg\exists x\,P(x) \equiv \forall x\,\neg P(x).

  • Nested quantifiers such as ∀x ∃y P(x,y)\forall x\,\exists y\,P(x,y) are order-sensitive: ∀x ∃y (x+y=0)\forall x\,\exists y\,(x+y=0) is true over the integers, but ∃y ∀x (x+y=0)\exists y\,\forall x\,(x+y=0) is false.

A variable bound by a quantifier is a bound variable; otherwise it is free.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2024 Spring · 5 marks

Write short notes on: Isomorphism Graph

Answer

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 is a bijection f:V1→V2f: V_1 \to V_2 such that vertices u,vu, v are adjacent in G1G_1 if and only if f(u),f(v)f(u), f(v) are adjacent in G2G_2. Isomorphic graphs have the same structure and differ only in how vertices are named or drawn.

Invariants (necessary conditions). If G1≅G2G_1 \cong G_2 then they must have:

  • the same number of vertices and the same number of edges,
  • the same degree sequence,
  • the same number of cycles of each length, the same connectivity, and the same number of components.

If any invariant differs, the graphs are not isomorphic. Equal invariants alone do not prove isomorphism; an explicit bijection must be exhibited.

Example. G1G_1: edges ab,bc,cd,daab, bc, cd, da (a 4-cycle). G2G_2: edges pq,qr,rs,sppq, qr, rs, sp. The map a→p, b→q, c→r, d→sa\to p,\ b\to q,\ c\to r,\ d\to s preserves adjacency, so G1≅G2G_1 \cong G_2.

Another way to test: two graphs are isomorphic iff their adjacency matrices differ only by a permutation of rows and columns. The general problem has no known fast algorithm, but it is easy for small graphs.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2024 Spring · 5 marks

Write short notes on: Steps for NFA to DFA

Answer

Every NFA has an equivalent DFA, obtained by the subset construction. Given NFA N=(QN,Σ,δN,q0,FN)N=(Q_N,\Sigma,\delta_N,q_0,F_N):

  1. Start state. The DFA start state is {q0}\{q_0\} (for an ε\varepsilon-NFA, use ε-closure(q0)\varepsilon\text{-closure}(q_0)).
  2. Transitions. For each DFA state S⊆QNS \subseteq Q_N and each symbol a∈Σa\in\Sigma compute δD(S,a)=⋃p∈SδN(p,a)\delta_D(S,a) = \bigcup_{p \in S}\delta_N(p,a) (with ε\varepsilon-closure applied to the result for an ε\varepsilon-NFA).
  3. New states. Each new subset obtained becomes a DFA state; repeat step 2 for it. The empty set acts as the dead state.
  4. Stop when no new subsets appear. At most 2∣QN∣2^{|Q_N|} states can result.
  5. Final states. A DFA state is final if it contains at least one NFA final state.
  6. Optionally minimise the DFA.

Example. NFA with δ(q0,0)={q0,q1}\delta(q_0,0)=\{q_0,q_1\}, δ(q0,1)={q0}\delta(q_0,1)=\{q_0\}, δ(q1,1)={q2}\delta(q_1,1)=\{q_2\}, final state q2q_2.

DFA stateon 0on 1
{q0}\{q_0\}{q0,q1}\{q_0,q_1\}{q0}\{q_0\}
{q0,q1}\{q_0,q_1\}{q0,q1}\{q_0,q_1\}{q0,q2}\{q_0,q_2\}
∗{q0,q2}*\{q_0,q_2\}{q0,q1}\{q_0,q_1\}{q0}\{q_0\}

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2023 Spring · 8 marks

Draw K5K_5, W5W_5, C6C_6 and K3,4K_{3,4} Graph (as given in the paper). What is the number of vertices in an undirected connected graph with 27 edges, 6 vertices of degree 2, 3 vertices of degree 4 and remaining vertices of degree 3.

Answer

Graphs.

  • K5K_5 (complete graph on 5 vertices): every pair of the 5 vertices is joined. Edges =(52)=10=\binom52=10, each vertex has degree 4. Drawn as a regular pentagon with all 5 sides and all 5 diagonals (the pentagram).
  • W5W_5 (wheel): a cycle C5C_5 on the rim plus a hub vertex joined to every rim vertex. It has 6 vertices and 5+5=105+5=10 edges; the hub has degree 5 and rim vertices have degree 3.
  • C6C_6 (cycle): 6 vertices v1,…,v6v_1,\dots,v_6 with edges vivi+1v_iv_{i+1} and v6v1v_6v_1; a hexagon with 6 edges, every vertex of degree 2.
  • K3,4K_{3,4} (complete bipartite): two sets {a1,a2,a3}\{a_1,a_2,a_3\} and {b1,b2,b3,b4}\{b_1,b_2,b_3,b_4\}, every aia_i joined to every bjb_j. It has 7 vertices and 3×4=123\times4=12 edges; the aia_i have degree 4, the bjb_j degree 3.
 K5: pentagon + all diagonals        W5: pentagon + hub joined to all 5
 C6: hexagon                          K3,4:  a1 a2 a3
                                             | X X |   (every a to every b)
                                             b1 b2 b3 b4

Number of vertices. By the handshaking theorem, the sum of degrees =2×27=54=2\times27=54.

Known degrees: 6×2+3×4=12+12=246\times2 + 3\times4 = 12+12 = 24. Let xx be the number of remaining vertices, each of degree 3:

24+3x=54⇒x=10.24 + 3x = 54 \Rightarrow x = 10.

Total vertices =6+3+10=19= 6 + 3 + 10 = \mathbf{19}.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2023 Spring · 7 marks

Define walk, path, circuit and trail with examples. What are the applications of graph theory?

Answer

Let GG be a graph.

  • Walk: an alternating sequence of vertices and edges v0,e1,v1,…,ek,vkv_0,e_1,v_1,\dots,e_k,v_k where each edge eie_i joins vi−1v_{i-1} and viv_i. Vertices and edges may repeat. The length is the number of edges.
  • Trail: a walk in which no edge is repeated (vertices may repeat).
  • Path: a walk in which no vertex is repeated (hence no edge is repeated either).
  • Circuit: a closed trail, i.e. it starts and ends at the same vertex (v0=vkv_0=v_k), with no repeated edge, of length at least 1. A closed path with no other repeated vertex is a cycle.

Example. Take edges ab,bc,cd,da,acab, bc, cd, da, ac.

  • Walk: a,b,c,b,aa,b,c,b,a (repeats edge abab and vertex bb).
  • Trail: a,b,c,a,da,b,c,a,d using ab,bc,ca,adab, bc, ca, ad (no repeated edge, vertex aa repeated).
  • Path: a,b,c,da,b,c,d (no repeated vertex).
  • Circuit: a,b,c,aa,b,c,a using ab,bc,caab,bc,ca (closed, no repeated edge); also a,b,c,d,aa,b,c,d,a.

Applications of graph theory.

  • Computer networks: modelling topology, routing and shortest paths (Dijkstra).
  • Transportation and maps: road networks, GPS navigation, airline routes (Euler/Hamilton circuits, travelling salesman).
  • Social networks: friendship graphs, community detection.
  • Scheduling and timetabling via graph colouring; frequency assignment.
  • Compilers and software: control-flow graphs, dependency graphs, register allocation.
  • Databases and web: link structure and ranking of web pages, search.
  • Chemistry and biology: molecular structures, food webs, circuit design (planar graphs).

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2023 Spring · 8 marks

What is single source shortest path algorithm? Explain Dijkstra Algorithm. Given the weighted graph use Dijkstra Algorithm to find the shortest path from vertex a to z.

Answer

Single-source shortest path problem. Given a weighted graph G=(V,E)G=(V,E) with non-negative edge weights and a source vertex ss, find the minimum-weight path from ss to every other vertex (or to a chosen target).

Dijkstra's algorithm.

  1. Set d(s)=0d(s)=0 and d(v)=∞d(v)=\infty for all other vertices; mark all vertices as unvisited.
  2. Pick the unvisited vertex uu with the smallest d(u)d(u) and mark it permanent (visited).
  3. For every neighbour vv of uu: if d(u)+w(u,v)<d(v)d(u)+w(u,v) < d(v), set d(v)=d(u)+w(u,v)d(v)=d(u)+w(u,v) and record uu as the predecessor of vv (relaxation).
  4. Repeat steps 2-3 until the target is visited (or all vertices are visited).
  5. Trace predecessors back from the target to read off the path.

It works because with non-negative weights, the smallest tentative distance is already final. With a binary heap its running time is O((V+E)log⁡V)O((V+E)\log V).

Worked example. Graph with edges: ab=4, ac=2, bc=1, bd=5, cd=8, ce=10, de=2, dz=6, ez=3ab=4,\ ac=2,\ bc=1,\ bd=5,\ cd=8,\ ce=10,\ de=2,\ dz=6,\ ez=3. Find the shortest path from aa to zz.

StepVisitedd(a)d(a)d(b)d(b)d(c)d(c)d(d)d(d)d(e)d(e)d(z)d(z)
0aa042∞\infty∞\infty∞\infty
1cc0321012∞\infty
2bb032812∞\infty
3dd03281014
4ee03281013
5zz03281013

Tracing predecessors: z←e←d←b←c←az \leftarrow e \leftarrow d \leftarrow b \leftarrow c \leftarrow a.

Shortest path: a→c→b→d→e→za \to c \to b \to d \to e \to z with length 2+1+5+2+3=132+1+5+2+3 = 13.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2023 Spring · 7 marks

Find the adjacency matrix and adjacency list of following graph. (Graph given in the paper.)

Answer

Consider the graph with vertices v1,…,v5v_1,\dots,v_5 and edges v1v2, v1v3, v2v3, v2v5, v3v4, v4v5v_1v_2,\ v_1v_3,\ v_2v_3,\ v_2v_5,\ v_3v_4,\ v_4v_5.

Adjacency matrix. A=[aij]A=[a_{ij}] where aij=1a_{ij}=1 if viv_i and vjv_j are adjacent, else 00 (for a loop-free undirected graph it is symmetric with zero diagonal).

A=(0110010101110100010101010)A=\begin{pmatrix} 0&1&1&0&0\\ 1&0&1&0&1\\ 1&1&0&1&0\\ 0&0&1&0&1\\ 0&1&0&1&0 \end{pmatrix}

Row sums give the degrees: 2,3,3,2,22,3,3,2,2 (total 12=2×612 = 2\times6 edges).

Adjacency list. Each vertex is stored with the list of its neighbours.

VertexAdjacent vertices
v1v_1v2,v3v_2, v_3
v2v_2v1,v3,v5v_1, v_3, v_5
v3v_3v1,v2,v4v_1, v_2, v_4
v4v_4v3,v5v_3, v_5
v5v_5v2,v4v_2, v_4

The matrix needs O(n2)O(n^2) space and tests adjacency in O(1)O(1); the list needs O(n+e)O(n+e) space and suits sparse graphs. For a directed graph, aij=1a_{ij}=1 only when there is an edge from viv_i to vjv_j, and the list stores out-neighbours.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2023 Spring · 8 marks

What is logical equivalence?
i. Prove that the converse and the inverse of a conditional statement are also equivalent ii. Show that the following statements are equivalent. Statement 1: Rich men are unhappy. Statement 2: Men are unhappy or poor.

Answer

Logical equivalence. Two compound propositions pp and qq are logically equivalent (p≡qp \equiv q) if they have the same truth value in every possible case, i.e. p↔qp \leftrightarrow q is a tautology.

(i) Converse and inverse of a conditional are equivalent.

For p→qp \to q: the converse is q→pq \to p, the inverse is ¬p→¬q\neg p \to \neg q.

q→p≡¬q∨p,¬p→¬q≡¬(¬p)∨¬q≡p∨¬q.q \to p \equiv \neg q \lor p, \qquad \neg p \to \neg q \equiv \neg(\neg p) \lor \neg q \equiv p \lor \neg q.

Since ¬q∨p≡p∨¬q\neg q \lor p \equiv p \lor \neg q (commutative law), the converse and inverse are equivalent. Truth table check:

ppqqq→pq\to p¬p→¬q\neg p\to\neg q
TTTT
TFTT
FTFF
FFTT

The last two columns are identical. (They are contrapositives of each other.)

(ii) "Rich men are unhappy" ≡\equiv "Men are unhappy or poor".

Let RR: the man is rich, UU: the man is unhappy, PP: the man is poor. "Not rich" is taken as poor, so P≡¬RP \equiv \neg R.

  • Statement 1: R→UR \to U.
  • Statement 2: U∨P≡U∨¬RU \lor P \equiv U \lor \neg R.

Using the conditional law R→U≡¬R∨UR \to U \equiv \neg R \lor U:

R→U≡¬R∨U≡U∨¬R≡U∨P.R \to U \equiv \neg R \lor U \equiv U \lor \neg R \equiv U \lor P.

Hence the two statements are logically equivalent.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2023 Spring · 7 marks

State the principle of Mathematical Induction? Use mathematical induction to show that 1+2+22+⋯+2n=2n+1−11 + 2 + 2^2 + \cdots + 2^n = 2^{n+1} - 1, for all nonnegative integers n.

Answer

Principle of mathematical induction. Let P(n)P(n) be a statement about non-negative integers. If

  1. (Basis step) P(n0)P(n_0) is true, and
  2. (Inductive step) for every k≥n0k \ge n_0, P(k)⇒P(k+1)P(k) \Rightarrow P(k+1),

then P(n)P(n) is true for all integers n≥n0n \ge n_0.

Claim. P(n)P(n): 1+2+22+⋯+2n=2n+1−11 + 2 + 2^2 + \cdots + 2^n = 2^{n+1} - 1 for all n≥0n \ge 0.

Basis step (n=0n=0). LHS =1=1, RHS =21−1=1=2^1-1=1. So P(0)P(0) holds.

Inductive hypothesis. Assume P(k)P(k): 1+2+⋯+2k=2k+1−11+2+\cdots+2^k = 2^{k+1}-1.

Inductive step. Then

1+2+⋯+2k+2k+1=(2k+1−1)+2k+1=2⋅2k+1−1=2k+2−1,1+2+\cdots+2^k+2^{k+1} = (2^{k+1}-1)+2^{k+1} = 2\cdot 2^{k+1} - 1 = 2^{k+2}-1,

which is P(k+1)P(k+1).

By induction, 1+2+22+⋯+2n=2n+1−11+2+2^2+\cdots+2^n = 2^{n+1}-1 for all non-negative integers nn.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2023 Spring · 8 marks

What do you mean by valid arguments. Construct an argument using rules of inference to show that the hypotheses "If it does not rain or if it is not foggy, then the sailing race will be held and the life saving demonstration will go on", "If the sailing race is held, then the trophy will be awarded", and "The trophy was not awarded" imply the conclusion "it rained".

Answer

Valid argument. An argument with hypotheses p1,p2,…,pnp_1, p_2, \dots, p_n and conclusion qq is valid if (p1∧p2∧⋯∧pn)→q(p_1 \land p_2 \land \cdots \land p_n) \to q is a tautology, i.e. whenever all the hypotheses are true, the conclusion is also true. It is shown valid using rules of inference.

Symbols. pp: it rains; qq: it is foggy; rr: the sailing race is held; ss: the life saving demonstration goes on; tt: the trophy is awarded.

Hypotheses.

  1. (¬p∨¬q)→(r∧s)(\neg p \lor \neg q) \to (r \land s)
  2. r→tr \to t
  3. ¬t\neg t

Conclusion: pp.

StepStatementReason
1r→tr \to tHypothesis 2
2¬t\neg tHypothesis 3
3¬r\neg rModus tollens (1, 2)
4¬r∨¬s\neg r \lor \neg sAddition (3)
5¬(r∧s)\neg(r \land s)De Morgan (4)
6(¬p∨¬q)→(r∧s)(\neg p \lor \neg q) \to (r \land s)Hypothesis 1
7¬(¬p∨¬q)\neg(\neg p \lor \neg q)Modus tollens (5, 6)
8p∧qp \land qDe Morgan (7)
9ppSimplification (8)

Hence "it rained" follows from the hypotheses, so the argument is valid.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2023 Spring · 7 marks

Show that 2\sqrt{2} is irrational using proof by contradiction.

Answer

Claim. 2\sqrt2 is irrational.

Proof by contradiction. Suppose 2\sqrt2 is rational. Then 2=ab\sqrt2 = \dfrac{a}{b} where a,ba, b are integers, b≠0b \ne 0, and gcd⁡(a,b)=1\gcd(a,b)=1 (the fraction is in lowest terms).

Squaring: 2=a2b22 = \dfrac{a^2}{b^2}, so

a2=2b2.a^2 = 2b^2 .

Thus a2a^2 is even, which forces aa to be even (the square of an odd number is odd). Write a=2ka = 2k for an integer kk. Then

4k2=2b2  ⇒  b2=2k2,4k^2 = 2b^2 \;\Rightarrow\; b^2 = 2k^2,

so b2b^2 is even and therefore bb is even.

Now both aa and bb are even, so 2 divides both, contradicting gcd⁡(a,b)=1\gcd(a,b)=1.

The assumption was false. Hence 2\sqrt2 cannot be written as a ratio of integers, i.e. 2\sqrt2 is irrational. ■\blacksquare

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2023 Spring · 7 marks

Solve the recurrence relation an=3an−1+2na_n = 3a_{n-1} + 2n, where a1=3a_1 = 3.

Answer

Solve an=3an−1+2na_n = 3a_{n-1} + 2n, a1=3a_1 = 3.

Homogeneous part. an(h)=A 3na_n^{(h)} = A\,3^n (root r=3r=3).

Particular solution. The non-homogeneous term is 2n2n (a polynomial of degree 1), and 1 is not a root, so try an(p)=cn+da_n^{(p)} = cn + d:

cn+d=3(c(n−1)+d)+2n=(3c+2)n+(3d−3c).cn + d = 3\big(c(n-1)+d\big) + 2n = (3c+2)n + (3d - 3c).

Comparing coefficients: c=3c+2⇒c=−1c = 3c + 2 \Rightarrow c = -1; d=3d−3c⇒2d=3c=−3⇒d=−32d = 3d - 3c \Rightarrow 2d = 3c = -3 \Rightarrow d = -\tfrac32.

So an(p)=−n−32a_n^{(p)} = -n - \tfrac32.

General solution. an=A 3n−n−32a_n = A\,3^n - n - \tfrac32.

Initial condition. a1=3a_1 = 3: 3A−1−32=3⇒3A=112⇒A=1163A - 1 - \tfrac32 = 3 \Rightarrow 3A = \tfrac{11}{2} \Rightarrow A = \tfrac{11}{6}.

an=116 3n−n−32=11⋅3n−12−n−32\boxed{a_n = \frac{11}{6}\,3^n - n - \frac32 = \frac{11\cdot 3^{n-1}}{2} - n - \frac32}

Check. a2=3(3)+4=13a_2 = 3(3)+4 = 13; formula: 11⋅32−2−32=16.5−3.5=13\tfrac{11\cdot3}{2} - 2 - \tfrac32 = 16.5 - 3.5 = 13. ✓

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2023 Spring · 8 marks

State tuples used in Finite Automata. Design a Finite State Automata with strings over {a, b} that containing ending with a. Your design should include proper Finite State Automata, transition table and transition Diagram.

Answer

Tuples of a finite automaton. A finite automaton is a 5-tuple M=(Q,Σ,δ,q0,F)M=(Q,\Sigma,\delta,q_0,F):

  • QQ: a finite set of states,
  • Σ\Sigma: a finite input alphabet,
  • δ\delta: the transition function (Q×Σ→QQ\times\Sigma\to Q for a DFA; Q×Σ→2QQ\times\Sigma\to 2^Q for an NFA),
  • q0∈Qq_0\in Q: the start state,
  • F⊆QF\subseteq Q: the set of final (accepting) states.

Design: strings over {a,b}\{a,b\} ending with aa.

M=({q0,q1},{a,b},δ,q0,{q1})M=(\{q_0,q_1\},\{a,b\},\delta,q_0,\{q_1\}), where q1q_1 means "the last symbol read was aa" and q0q_0 means "nothing read yet, or the last symbol was bb".

Transition table.

Stateaabb
→q0\to q_0q1q_1q0q_0
∗q1*q_1q1q_1q0q_0

Transition diagram.

        b                 a
      +---+            +---+
      v   |            v   |
 --> (q0)-----a------>((q1))
       ^                 |
       +--------b--------+

q0q_0 loops on bb, goes to q1q_1 on aa; q1q_1 loops on aa, returns to q0q_0 on bb. Example: babababa takes q0→q0→q1→q0→q1q_0\to q_0\to q_1\to q_0\to q_1 and is accepted; abab ends in q0q_0 and is rejected.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2023 Spring · 5 marks

Write short notes on: Quantification

Answer

Quantification is the process of turning a predicate (propositional function) P(x)P(x), which has no truth value until xx is given a value, into a proposition by specifying how many values of xx satisfy it.

The two main forms:

  • Universal quantification ∀x P(x)\forall x\,P(x): P(x)P(x) is true for all xx in the domain. It is false if a single counterexample exists.
  • Existential quantification ∃x P(x)\exists x\,P(x): P(x)P(x) is true for at least one xx in the domain. It is false if P(x)P(x) fails for every xx.

Examples (domain: real numbers): ∀x (x2≥0)\forall x\,(x^2\ge0) is true; ∃x (x2=−1)\exists x\,(x^2=-1) is false.

Negation rules:

¬∀x P(x)≡∃x ¬P(x),¬∃x P(x)≡∀x ¬P(x).\neg\forall x\,P(x)\equiv\exists x\,\neg P(x),\qquad \neg\exists x\,P(x)\equiv\forall x\,\neg P(x).

Translation: "All students are intelligent" is ∀x (S(x)→I(x))\forall x\,(S(x)\to I(x)); "Some students are intelligent" is ∃x (S(x)∧I(x))\exists x\,(S(x)\land I(x)).

The domain of discourse must be specified, quantified variables are bound, and with several quantifiers the order matters.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2023 Spring · 5 marks

Write short notes on: Context Free Grammar

Answer

A context-free grammar (CFG) is a 4-tuple G=(V,T,P,S)G=(V,T,P,S):

  • VV: a finite set of variables (non-terminals),
  • TT: a finite set of terminals, disjoint from VV,
  • PP: a finite set of productions of the form A→αA\to\alpha, where A∈VA\in V and α∈(V∪T)∗\alpha\in(V\cup T)^* (the left side is a single non-terminal, so the rule applies regardless of context),
  • S∈VS\in V: the start symbol.

The language generated is L(G)={w∈T∗:S⇒∗w}L(G)=\{w\in T^* : S\Rightarrow^* w\}. Languages generated by CFGs are called context-free languages (Type 2 in the Chomsky hierarchy) and are recognised by pushdown automata.

Example. G=({S},{a,b},P,S)G=(\{S\},\{a,b\},P,S) with P:S→aSb∣εP: S\to aSb\mid\varepsilon generates {anbn:n≥0}\{a^nb^n : n\ge0\}. Derivation of aabbaabb: S⇒aSb⇒aaSbb⇒aabbS\Rightarrow aSb\Rightarrow aaSbb\Rightarrow aabb.

Concepts. Derivations can be leftmost or rightmost; the parse (derivation) tree shows the structure of a derivation. A grammar is ambiguous if some string has two different parse trees.

Uses: specifying the syntax of programming languages (BNF), parsers in compilers, expression evaluation, and XML/HTML structure.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

Questions from PU BCA 2025 Spring Numerical Methods (Pokhara University BCA, Spring 2025), PU BCA 2024 Spring Numerical Methods (Pokhara University BCA, Spring 2024), PU BCA 2023 Spring Numerical Methods (Pokhara University BCA, Spring 2023), PU BCA 2025 Spring Mathematical Foundation of Computer Science (Pokhara University BCA, Spring 2025), PU BCA 2024 Fall Mathematical Foundation of Computer Science (Pokhara University BCA, Fall 2024), PU BCA 2024 Spring Mathematical Foundation of Computer Science (Pokhara University BCA, Spring 2024), PU BCA 2023 Spring Mathematical Foundation of Computer Science (Pokhara University BCA, Spring 2023) and PU BCA 2025 Spring Data Communication and Computer Network (Pokhara University BCA, Spring 2025). Answers are written for this site; check them against your class notes.