Sample Exam Paper
Sample Exam Paper
CM1020
BSc EXAMINATION
COMPUTER SCIENCE
T
Time allowed: 2 hours
AF
DO NOT TURN OVER UNTIL TOLD TO BEGIN
INSTRUCTIONS TO CANDIDATES:
This examination paper is in two parts: Part A and Part B. You should answer
ALL of question 1 in Part A and TWO questions from Part B. Part A carries 40
R
marks, and each question from Part B carries 30 marks. If you answer more
than TWO questions from Part B only your first TWO answers will be marked.
All answers must be written in the answer books, answers written on the question
paper will not be marked. You may write notes in your answer book. Any notes
or additional answers in the answer book(s) should be crossed out.
D
The marks for each part of a question are indicated at the end of the part in [.]
brackets. There are 100 marks available on this paper.
Graph Paper is provided at the end of this question paper. If used, it must be
detached and fastened securely inside the answer book.
A handheld calculator may be used when answering questions on this paper
but it must not be pre-programmed or able to display graphics, text or algebraic
equations. The make and type of machine must be stated clearly on the front
cover of the answer book.
UL19/0827 page 1 of 14
© University of London 2020
T
AF
R
D
UL19/0827 page 2 of 14
PART A
T
AF
R
D
UL19/0827 page 3 of 14
Question 1
(a) Let A be a set with 5 elements. What is the number of subsets which can
be formed from A?
i. 10
ii. 25
iii. 32
T
iv. 64
(b) Given the following Venn diagram representing two sets A and B, which
are subsets of the universal set U :
AF
R
Which one of the following sets represents (A ∩ B)?
i. {1, 2, 5, 6, 7, 8, 9, 10}
ii. {3, 4, 8, 9, 10}
iii. {8, 9, 10}
iv. none of the other options is correct
UL19/0827 page 4 of 14
(c) The following graph shows the curves of three functions, f1 , f2 and f3 :
T
Choose ONE option.
AF
Which of these functions are not invertible?
[4]
i. f3
ii. f1 and f3
iii. f2 and f3
iv. f1 and f2
R
D
UL19/0827 page 5 of 14
(d) Let p and q be the following propositions concerning a positive integer
n where p means ’n is less than or equal to 7 ’ and q means ’n cannot
be represented using 3 binary digits’ . Which one of the following logical
expressions is equivalent to a correct formalisation of the sentence below?
’ if n is less than or equal to 7 then n can be represented using 3 binary
digits’
Choose ONE option. [4]
i. p ∧ ¬q
ii. p ∨ ¬q
iii. p → ¬q
T
iv. p → q
(e) Given the statement S(x): ’ x2 + 1 = 5’, select the correct statement from
the following.
Choose ONE option. [4]
AF
i. S can be expressed using propositional logic
ii. S is not a proposition, as its truth value is a function depending on x
iii. The truth value of S(2) is False
iv. The truth value of S(3) is True
(f) The number of ways k objects can be selected from n objects where the
ordering of the outputs is not important can be calculated using which one
R
of the following formulations?
Choose ONE option. [4]
n!
i. k!(n−k)!
n!
ii. (n−k)!
D
n!
iii. k!
iv. n(n − k)
UL19/0827 page 6 of 14
(g) Which one of the following degree sequences cannot represent a simple
graph? [4]
i. 5, 3, 3, 2, 2
ii. 4, 2, 2, 2, 2
iii. 2, 2, 2, 2, 2
iv. 4, 3, 3, 2, 2
(h) Which one the following is a correct definition of a Hamiltonian path? [4]
T
ii. A Hamiltonian path in graph G is a path that visits each vertex in G
exactly once
iii. A Hamiltonian path is a trail in which neither vertices nor edges are
repeated
AF
iv. A Hamiltonian path is a walk in which no edge is repeated
UL19/0827 page 7 of 14
ii. R is NOT reflexive, is NOT symmetric, and is transitive.
iii. R is NOT reflexive, is symmetric, and is NOT transitive.
iv. R is reflexive, is symmetric, and is transitive.
T
AF
R
D
UL19/0827 page 8 of 14
PART B
T
AF
R
D
UL19/0827 page 9 of 14
Question 2
(a) i. Rewrite the following three sets using the listing method:
• A = {n2 + (−1)n : n ∈ Z and 0 ≤ n < 5}
• B = {n + n1 : n ∈ Z+ and n < 6}
• C = {(−2)−n : n ∈ Z+ and n < 5}
[3]
ii. Given the following Venn diagram representing three sets A, B and C
intersecting in the most general way. Three binary digits are used to
refer to each one of the 8 region in this diagram. In terms of A, B and
C, Write the set representing the area comprising the regions 011, 101
and 111. The answer must be written in its simplest
T
AF
[3]
iii. Given three sets A, B and C. Using set identities, prove that the
expression (A − B) − (B − C) is equivalent to A − B. [4]
(b) i. Let p and q be two propositions. Assume that p is false and q is true.
Determine the truth value of for each of the following: p → q; ¬p ∨ q;
R
q ⊕ ¬p and ¬q → p. [4]
ii. Let p, q and r denote the following statements:
p : ’I finish my home work’
q : ’I will go to the gym’
D
r : ’ it’s raining ’
1. Write the following the following statements into their corresponding
symbolic forms.
• if i finish my homework and it is raining then i will go to the gym.
• i will go to the gym or finish my homework but not both.
[4]
2. Write in words the contrapositive of the the following statement:
’if i finish my homework and it is raining then i will go to the gym.’ [2]
UL19/0827 page 10 of 14
(c) Let A be the set of all students, p(x) be the proposition: ’x is enrolled in
Discrete Mathematics module’ and S(x) is the set of all students in the
same year as x’ where x is an element of A. Use rules of inference with
quantifiers to formalise the three following statements:
i. None of the students are enrolled in the Discrete Mathematics module. [2]
T
(d) Suppose that a salesman has to visit eight different cities. He must begin
his trip in a specified city, but can visit the other seven cities in any order
he wishes. How many possible orders can the salesman use when visiting
these cities?
AF [4]
Question 3
(a) Given the following logical circuit with three inputs a, b and c:
R
D
UL19/0827 page 11 of 14
iii. Consider the following function invertible f : R → R+ with f (x) = 2x+1 .
Find its inverse function, f −1 . [2]
iv. . Plot the curve of f and f −1 in the graph. [4]
T
[5]
AF
R
D
UL19/0827 page 12 of 14
Question 4
• a1 : a2 , a5
• a2 : a1 , a3 , a4 , a5
• a3 : a2 , a4 , a5
T
• a4 : a2 , a3 , a5
• a5 : a1 , a2 , a3 , a4
and
AF
• b1 : b2 , b3 , b4 , b5
• b2 : b1 , b5
• b3 : b1 , b4 , b5
• b4 : b1 , b3 , b5
• b5 : b1 , b2 , b3 , b4
[2]
1. Write down the degree sequence for each graph above. [2]
R
2. Are these graphs isomorphic? If so, show the correspondence between
them. [2]
ii. Explain how to find the minimum spanning tree in a weighted graph
using Prim’s algorithm. [2]
UL19/0827 page 13 of 14
(c) Given S be the set of integers {1, 2, 3, 4, 5, 6, 7, 8, 9}. Let R be a relation
T
defined on S by the following condition such that,
for all x, y ∈ S, xRy if x mod 3 = y mod 3 .
• reflexive;
AF
ii. Say with reason whether or not R is
• symmetric;
• anti-symmetric;
• transitive.
In the cases where the given property does not hold provide a counter
example to justify this. [4]
iii. is R a partial order? Explain your answer. [1]
R
iv. is R an equivalence relation? If the answer is yes, write down the
equivalence classes for this relation and if the answer is no, explain
why. [3]
D
END OF PAPER
UL19/0827 page 14 of 14