$30
CSC2047 – Assessment: Individual Coursework 1
Question Sheet
Total Marks: 100
1.
a. Let ๐ด, ๐ต and ๐ถ be sets. Show that ๐ด × (๐ต ∩ ๐ถ) = (๐ด × ๐ต) ∩ (๐ด × ๐ถ)
(4 marks)
b. Let ๐: โ → โ and ๐: โ → โ be functions such that
๐(๐ฅ) = 5๐ฅ − 2 and ๐(๐ฅ) = ๐ฅ
2 − 4.
Give a definition for the composite function ๐ โ ๐.
(4 marks)
c. A graph ๐บ = (๐, ๐ธ) is said to be isomorphic to a graph ๐ป = (๐
′
,๐ธ
′
) if there exists a
bijective function, ๐, from the vertices of ๐บ to the vertices of ๐ป such that for two
adjacent vertices in ๐บ, ๐ข and ๐ฃ, the corresponding vertices in ๐ป, ๐(๐ข) and ๐(๐ฃ), are
adjacent.
Given the two graphs
๐บ = ({1,2,3},{(1,2), (2,3)}) and ๐ป = ({−2,0,2},{(−2,0), (0,2)},
show that ๐บ is isomorphic to ๐ป.
(12 marks)
2.
a. Given the graph ๐บ, which can be illustrated as
Formally define the graph ๐บ′ which is the largest possible subgraph of ๐บ where every
vertex in ๐บ′ has degree 3.
(5 marks)
4
1
2
3
5
2
3
1
0 -2
2
CSC2047 – Assessment: Individual Coursework 1
b. Using appropriate propositional variables, construct a well-formed formula (WFF) for
the expression:
“If Paul and Jay go to the shops then Alex will not go to the shops.”
Make sure to clearly state how your propositional variables relate to the expression.
(7 marks)
c. Using the same propositional variables defined in (2b), construct a WFF for the
expression:
“Either Alex or Paul go to the shops with Jay, which is the same as saying, Alex and
Jay go to the shops and not Paul, or, Paul and Jay go to the shops and not Alex.”
(8 marks)
3. Let ๐ด be an array of 15 integers and ๐ต be an array of 10 integers. The arrays ๐ด and ๐ต are
indexed from 1 to 15 and 1 to 10 respectively. Construct predicates to assert that
a. The third element of ๐ด is larger than all elements of ๐ต.
(3 marks)
b. The elements of ๐ต form a consecutive sequence within ๐ด.
(3 marks)
c. If ๐ฅ is an element of ๐ด then – ๐ฅ is an element of ๐ต.
(7 marks)
d. The value 7 occurs only once in ๐ด.
(7 marks)
4.
a. Let ๐ฅ, ๐ฆ ∈ โค. Prove by construction that the sum of ๐ฅ + ๐ฆ is even when
i. ๐ฅ and ๐ฆ are both even,
(4 marks)
ii. ๐ฅ and ๐ฆ are both odd.
(4 marks)
b. Prove by construction, that for any ๐ ∈ โค that (๐
2 mod 2) = 0 or 1.
(12 marks)
5.
a. Give a recursive definition for the following sequence which is defined over the
natural numbers:
−2, 6, −18, 54, −162, 486, …
(3 marks)
b. Use the pseudo code below to formulate an equivalent recursive definition
Function f(n)
if n = 0:
return 1;
else:
return f(n-1)+3n+2;
end
end
(3 marks)
CSC2047 – Assessment: Individual Coursework 1
c. Using your recursive definition from (5b) compute ๐(3).
(1 mark)
d. Find a closed-form solution to the function
๐(๐) = {
0 ๐๐ ๐ = 0
๐(๐ − 1) + 2๐ ๐๐กโ๐๐๐ค๐๐ ๐
(5 marks)
e. Prove, by induction, that your closed-form solution in (5d) is correct.
(8 marks)