Practice Exam Questions

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

4115COMP Practice Exam Questions

1. The following sets are defined as A={2,3,4}, B={1,5,10}, C={-1,1,2} and D={2,5,10}

What sets are produced by the following operations:

a) (AÇB)È(CÇD)
b) (AÈ(BÇC))Ç((AÈB)ÇC)
c) (A-(B-(C-D)))
d) (A-(BÈC))-(A-(BÈD))

2. Which of the following relations are symmetric, transitive or reflexive:

a) {(x,y)|xy>0, x,yÎR}
b) {(x,y)|x + y >0, x,yÎR}
c) {(n,m)|n + m =2, n, mÎZ}
d) {(n,m)|n ¹ m + 1, n, mÎZ}
Where R is the real numbers and Z is the integers.

3. For the functions f:RàR listed below, show they are bijections and state the inverse function:

a) f(x) = 2x – 5
!
b) f(x) = " + 2
"
c) f(x) = ! + 2 for f:R-{0} à R-{2} (i.e. from R with 0 removed to R with 2 removed

4. If a 40-sided dice (a tetracontagon) with the numbers 1 to 40 on its faces is rolled once. rolled once:
The probability that the number shown has not previously rolled in this session, is 1. If it is rolled a
"&
second time the probability of showing a different number is 1.'( as there are 39 numbers out of 40 that
will be different from the first roll. If it is rolled again (for a third time) the probability of showing a
"& "*
different number from the first two is 1. '( . '(. If it is then rolled for a fourth time the probability of
rolling a fourth different number from the other three is:
"& "* "+
1. '( . '(.'(

If we call P(1) the probability that 1 number is different on one roll, then P(2) is the probability that two
numbers are different from the two rolls, P(3) the probability that three numbers are different from the
three rolls, etc. Then:
"& "*
P(1) = 1, P(2) = P(1). '(, P(3) = P(2). '(, etc….. So that
'(,(.,/) '/,.
P(n) = P(n-1). '(
= P(n-1). '(
A recursive definition.

Using Excel show the probabilities of rolling 1 to 40 different numbers on the same number of rolls and
on a plot show where the probability of rolling a new different number goes below 50% (0.5).
5. Draw the expression trees for
/ "
a) 1!
+ '23 and evaluate for x = y = 4
b) a((c + 1) – bc) + b and evaluate for a = 3, b = 1 and c = 1

6. A database server handles queries from users. At a particular time the server receives nine queries:
Q1, Q2,….Q9. Some of these can be processed simultaneously. The following table shows the queries
that cannot be processed at the same time:

Query Q1 Q2 Q3 Q4 Q5 Q6 Q7 Q8 Q9
Q1 x x x
Q2 x x x
Q3 x x x
Q4 x x x x
Q5 x x x
Q6 x x x
Q7 x x x x
Q8 x x x x
Q9 x x x

Construct a graph linking those queries that cannot be run together and using as few colours as possible
colour the graph to show the queries hat can run at the same time. If each query takes a second to
process, state how long this set of queries will take to process.

You might also like