CS 173, Spring 2010
Midterm 1 Solutions
Problem 1: Short answer (12 points)
State whether each of the following claims is
TRUE
or
FALSE
. Justification/work is not re
quired, but may increase partial credit if your short answer is wrong.
(a) For all integers
p
and
q
, if
p

q
then
q
must be positive.
Solution:
False.
(b) For all prime numbers
p
, there are exactly two natural numbers
q
such that
q

p
.
Solution:
True.
(c) 8
≡
11 (mod 3)
Solution:
True.
(d) There is a set
A
such the cardinality of
P
(
A
) is less than two.
Solution:
True.
(e) For all positive integers
p
and
q
,
gcd(
p,q
)
≤
lcm(
p,q
).
Solution:
True.
(f) For all sets
A
and
B
,
P
(
A
∩
B
)
⊆
P
(
A
∪
B
).
Solution:
True.
Problem 2: Set theory calculation (10 points)
Suppose that
A
=
{
4
,
5
,
6
}
and
B
=
{
2
,
7
,
8
,
11
,
13
}
.
Calculate the values of the following
expressions (recall that
P
(
X
) is the power set of
X
). Explicitly list the contents of nonempty
sets.
(a)
A
∪ {
4
,
{
5
,
6
}
,
11
}
=
Solution:
{
4
,
5
,
6
,
11
,
{
5
,
6
}}
(b) Cardinality of
P
(
A
×
B
) =
Solution:
2
3
·
5
= 2
15
(c)
P
(
A
)
∩
P
(
B
) =
Solution:
{∅}
(d)
{
p
∈
B

p
2
∈
A
}
=
Solution:
{
2
}
(e)
A
× {
a,
∅}
=
Solution:
{
(4
,a
)
,
(5
,a
)
,
(6
,a
)
,
(4
,
∅
)
,
(5
,
∅
)
,
(6
,
∅
)
}
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Problem 3: Longer answers (8 points)
(a) (3 points) Trace the execution of the Euclidean algorithm as it computes gcd(1012
,
299).
Clearly indicate the return value.
This is the end of the preview.
Sign up
to
access the rest of the document.
 Spring '10
 FLECK

Click to edit the document details