Discrete Structure, Past Papers, UOS Main Campus

Discrete Structure Past Paper 2015 – BSIT 2nd Term UOS (CMP-2111)

ProgramBSIT
Term2nd
Year2015
Course codeCMP-2111
AnswersSolved ✓

University of Sargodha Discrete Structure (CMP-2111) paper for BS IT 2nd term, 2015 exam (80 marks, 2:30 hours). The paper has been retyped with its graphs, and solved answers are given below for all 16 short questions and all six long questions. Counting results and set answers were checked by computer.

Solved answers

Q1 – Short answers (16 × 2)

1. Truth table for (p ↔ q) ⊕ (p ↔ ~p): p ↔ ~p is always false, so the XOR simply copies p ↔ q.

pqp ↔ q~pp ↔ ~p(p ↔ q) ⊕ (p ↔ ~p)
TTTFFT
TFFFFF
FTFTFF
FFTTFT

2. Pigeonhole principle: If k + 1 or more objects are placed into k boxes, at least one box contains two or more objects. Generalised: N objects in k boxes → some box has at least ⌈N/k⌉ objects.

3. ~(p → q) → p is a tautology: ~(p → q) ≡ p ∧ ~q. So the statement is (p ∧ ~q) → p ≡ ~(p ∧ ~q) ∨ p ≡ ~p ∨ q ∨ p ≡ T ∨ q ≡ T. It is true for every truth value of p and q.

4. ∃x P(x, 3) with x ∈ {0, 1, 2}: P(0, 3) ∨ P(1, 3) ∨ P(2, 3). (An existential quantifier over a finite domain becomes a disjunction; a universal one would become a conjunction, e.g. ∀x P(x, 3) ≡ P(0, 3) ∧ P(1, 3) ∧ P(2, 3).)

5. Bound vs free variable: A variable is bound when it is inside the scope of a quantifier, and free when it is not. In ∃x (x + y = 1), x is bound and y is free, so the expression is not a proposition until y is given a value.

6. Truth value of ∀n (2n ≥ 3n) over integers: False. Counterexample n = 1: 2 ≥ 3 is false. (It holds only for n ≤ 0.)

7. Negation of ∀w ∃a ∃f (P(w, f) ∧ Q(f, a)): ∃w ∀a ∀f ¬(P(w, f) ∧ Q(f, a)) ≡ ∃w ∀a ∀f (¬P(w, f) ∨ ¬Q(f, a)).

8. Simplification rule: From p ∧ q we may conclude p. Form: (p ∧ q) → p, i.e. p ∧ q ∴ p.

9. Fallacies: Invalid arguments that look like valid rules of inference, e.g. affirming the conclusion ((p → q) ∧ q) → p and denying the hypothesis ((p → q) ∧ ¬p) → ¬q. They are not tautologies.

10. Disjoint sets: Two sets with no common element: A ∩ B = ∅. Example: {1, 3, 5} and {2, 4, 6}.

11. Is f(x) = x² from ℤ to ℤ onto? No. Negative integers and non-squares such as −1 or 2 are never outputs, so the range is not all of ℤ. (It is not one-to-one either, since f(−2) = f(2).)

12. Inclusion–exclusion: |A ∪ B| = |A| + |B| − |A ∩ B|; for three sets |A ∪ B ∪ C| = |A| + |B| + |C| − |A ∩ B| − |A ∩ C| − |B ∩ C| + |A ∩ B ∩ C|.

13. Isolated vertex: A vertex of degree 0, i.e. not joined to any other vertex by an edge.

14. Preorder traversal: Visit the root first, then traverse each subtree from left to right in preorder (Root – Left – Right for binary trees).

15. Average case of linear search: If the item is equally likely to be at any of the n positions, about (n + 1)/2 comparisons are needed, so the average case is Θ(n).

16. Three graph models: Social networks (acquaintanceship graph), communication networks (computer/telephone network), and information networks such as the web graph; other examples are road maps and the precedence graph.

Q2 – Degrees and bipartite test

Edges: ab, bc, cd, da (outer square), ef, fh, hg, ge (inner square) and ae, bf, dg, ch (spokes) – 12 edges in total.

Vertexabcdefgh
Degree33333333

Check: sum of degrees = 8 × 3 = 24 = 2 × 12 edges (handshaking theorem).

Bipartite? Yes. Put V1 = {a, c, f, g} and V2 = {b, d, e, h}. Every edge joins V1 to V2: ab, bc, cd, da, fe, fh, gh, ge, ae, bf, dg, ch. No edge joins two vertices of the same set, so the graph is bipartite (it is the cube graph Q3, which has no odd cycle).

Q3 – Counting

(a) Each of the 25 states has 3 choices (the governor or one of the two senators). By the product rule the number of committees is 325 = 847,288,609,443.

(b) Three letters + three digits: 263 × 103 = 17,576,000. Four letters + two digits: 264 × 102 = 45,697,600. The two cases are disjoint, so by the sum rule: 17,576,000 + 45,697,600 = 63,273,600 plates.

Q4 – Sets

A = {a, b, c, d}, B = {1, 2, a, 3, c}, C = {2, a, 1}.

  • C − B = elements of C not in B. 2, a and 1 are all in B, so C − B = ∅.
  • A ∪ B = {a, b, c, d, 1, 2, 3}, so |A ∪ B| = 7 (check: |A| + |B| − |A ∩ B| = 4 + 5 − 2 = 7).
  • P(C) = {∅, {1}, {2}, {a}, {1, 2}, {1, a}, {2, a}, {1, 2, a}} – 23 = 8 subsets.

Q5 – Induction and functions

(a) Let P(n): 12 + 22 + … + n2 = n(n + 1)(2n + 1)/6.

  • Basis (n = 1): LHS = 1, RHS = 1·2·3/6 = 1. True.
  • Inductive step: assume P(k): 12 + … + k2 = k(k + 1)(2k + 1)/6. Then 12 + … + k2 + (k + 1)2 = k(k + 1)(2k + 1)/6 + (k + 1)2 = (k + 1)[k(2k + 1) + 6(k + 1)]/6 = (k + 1)(2k2 + 7k + 6)/6 = (k + 1)(k + 2)(2k + 3)/6, which is P(k + 1).
  • By mathematical induction P(n) is true for every natural number n.

(b) f: 1→d, 2→c, 3→a, 4→b. g: a→2, b→1, c→3, d→2.

  • One-to-one: f is one-to-one (all four images different). g is not, because g(a) = g(d) = 2.
  • Onto: f is onto (every element of {a, b, c, d} is an image). g is not onto, because 4 is never an image.
  • Inverse: only f, being a bijection, has an inverse: f−1(a) = 3, f−1(b) = 4, f−1(c) = 2, f−1(d) = 1. g has no inverse.

Q6 – Union of graphs and trees

G1 = ({a, b, c, d}, {ab, ad, bc, bd}) and G2 = ({a, e, f, g, h}, {ae, af, ah, hg, fg}). The union takes all vertices and all edges of both graphs:

G1 ∪ G2 = ({a, b, c, d, e, f, g, h}, {ab, ad, bc, bd, ae, af, ah, hg, fg}) – 8 vertices and 9 edges.

abehcdfg
Union of the two simple graphs

(ii) A complete binary tree of height 3 has every internal vertex with 2 children and all leaves at level 3: 1 + 2 + 4 + 8 = 15 vertices, 8 leaves. A complete 3-ary tree of height 2 has 1 + 3 + 9 = 13 vertices, 9 leaves.

Complete binary tree of height 3 (15 vertices)
Complete 3-ary tree of height 2 (13 vertices)

Q7 – Relations on A = {1, 2, 3, 4}

R = {(a, b) | a + b = 4} = {(1, 3), (2, 2), (3, 1)}.

S = {(a, b) | a divides b} = {(1, 1), (1, 2), (1, 3), (1, 4), (2, 2), (2, 4), (3, 3), (4, 4)}.

S − R = {(1, 1), (1, 2), (1, 4), (2, 4), (3, 3), (4, 4)} (remove (1, 3) and (2, 2), which are in R).

R ∪ S = {(1, 1), (1, 2), (1, 3), (1, 4), (2, 2), (2, 4), (3, 1), (3, 3), (4, 4)} – 9 pairs.

  • Reflexive: yes – (1, 1), (2, 2), (3, 3), (4, 4) are all in S.
  • Symmetric: no – (1, 2) ∈ S but (2, 1) ∉ S.
  • Antisymmetric: yes – if a | b and b | a for positive integers then a = b.
  • Transitive: yes – if a | b and b | c then a | c (e.g. 1 | 2 and 2 | 4 give 1 | 4).

So S is a partial order on A.

Save this paper for offline studyDownload the question paper, or save the paper together with all solved answers as a PDF.
↓ Download Paper (JPG)

About Saif R

An educator and technology enthusiast passionate about empowering students through quality education and digital learning. Dedicated to making academic resources and opportunities accessible to everyone.