Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Discrete Structures
CMSC 2123
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
CRN 21858
Test 3 Version 1
Spring 2011
Print your name on your scantron in the space labeled NAME.
Print CMSC 2123 in the space labeled SUBJECT.
Print the date, 5-2-2011, in the space labeled DATE.
Print your CRN, 21858, in the space labeled PERIOD.
Print the test number and version, T1/V1, in the space labeled TEST NO.
You may not consult your neighbors, colleagues, or fellow students to answer the questions
on this test.
Mark the best selection that satisfies the question.
7.1.
True/False: Mark selection a if the statement is true or selection b if the statement
is false.
7.2.
Multiple Choice: If selection b is better that selections a and d, then mark selection
b. Mark only one selection. Please note that there are five possible answers for
question 49 unlike other questions on the test that have only four possible answers.
Darken your selections completely. Make a heavy black mark that completely fills your
selection.
Answer all 50 questions.
Record your answers on SCANTRON form 882-E (It is green!)
Submit your completed scantron to your instructor on Monday, May 2, 2011 at 11:00 a.m.
in room MCS 113.
1
Discrete Structures
CMSC 2123
CRN 21858
Test 3 Version 1
Spring 2011
1. Let π = {1,3,5,7,9} and π = {2π β 1|π β β}, then π β π.
a. True
b. False
2. The Well-Ordering Principle can be used to prove that the set of integers has a minimum
element.
a. True
b. False
3. If π|π, then gcd(π, π) = π.
a. True
b. False
4. The decimal number 12 is represented by the hexadecimal symbol C.
a. True
b. False
5. The decimal number 42 is equivalent to the binary number 101010.
a. True
b. False
6. The sum of the unsigned binary numbers 1010111 + 111001 = 10010000.
a. True
b. False
7. A loop invariant is a set of statements that are false when a loop is entered and become true
on the final exit from the loop.
a. True
b. False
8. If π is prime and π|ππ where π and π are positive integers, then π|π and π|π.
a. True
b. False
9. Assume π΄ is any set and π(π΄) is the power set under the inclusion relation. Then π΄ is an
upper bound and β
is a lower bound for any subset of π(π΄).
a. True
b. False
10. Let π = {(π₯, 2π₯ 3 + 3)|π₯ β β€}, where β€ is the set of integers. Then the range of π, Im(π), is
β€.
a. True
b. False
11. Let π be a finite set, and let π: π₯ β π₯ be a function. If π is one-to-one and πΌπ(π) = π, then
π is a one-to-one correspondence.
a. True
b. False
2
Discrete Structures
CMSC 2123
CRN 21858
Test 3 Version 1
Spring 2011
12. If π₯ = β3.98, then the floor of π₯, βπ₯β = β3.
a. True
b. False
13. The linear congruence 9π₯ β‘ 1(mod 36) has a solution.
a. True
b. False
14. The solution of the recurrence relation ππ = 2ππβ1 β ππβ2 , where π β₯ 2, with initial
conditions π0 = β3 and π1 = 1 is ππ = β4 + 3π.
a. True
b. False
15. Let π be a function of π,where π is the size of the list to be processed. The term asymptotic
refers to the study of functions where are unaffected by the size of π.
a. True
b. False
16. Let π(π₯) and π(π₯) be real-valued functions. Then π(π₯) = π(π(π₯)) if there exists positive
constants, π,and π₯0 , such that |π(π₯)| β€ π|π(π₯)| βπ₯ β₯ π₯0 .
a. True
b. False
17. Let π(π) = Ξ(π(π)), then π(π) = Ξ(β(π))
a. True
b. False
18. The selection sort efficiency is π(π2 )
a. True
b. False
19. Let π = {β3, β2, β1,0,1,2}, π = {3,4,5,6,7}, and π = {(β2,3), (β1,6), (0,4), (1,5), (2,7)}. π
is a function.
a. True
b. False
20. Consider the function π: π β β€, whereπ = {(π₯, π₯ 2 )|π₯ β π}, π = {β3, β2, β1,0,1,2,3}. π is
onto β€.
a. True
b. False
3
Discrete Structures
CMSC 2123
CRN 21858
Test 3 Version 1
Spring 2011
21. Let π΄ and π΅ be subsets of the universal set π. Of which law is π΄β² βͺ π΅β² = (π΄ β© π΅)β² an
example?
a. Absorptive law
b. Distributive law
c. DeMorganβs law
d. Idempotency law
22. Which of the following is true?
a. 2 is a prime number and -5 is a nonnegative number.
b. 5 is a negative integer if and only if pigs can fly.
c. 12 is a prime number or -4 is not a negative number
d. If 3 is not an even integer, then -3 is not a negative integer.
23. To determine whether the argument given below is valid, you would need to construct a
truth table for which of the following?
π β (π β¨ π)
π β ~π
β΄πβ¨π
a. (π β (π β¨ π) β§ (π β ~π) β§ (π β¨ π )
b. (π β (π β¨ π) β§ (π β ~π) β (π β¨ π )
c. (π β (π β¨ π) β (π β ~π) β (π β¨ π )
d. (π β (π β¨ π) β§ (π β ~π) β‘ (π β¨ π )
24. Which of the following is false?
a. 35 πππ£ 8 = 4
b. 219 πππ 3 = 73
c. 17 πππ£ 2 = 8
d. 39 πππ 7 = 4
25. Compute the binary sum: 101101+1101
a. 111001
b. 101010
c. 110010
d. 111010
26. What would be the inductive step using the first principle of mathematical induction to
prove that 2π > π for all π β₯ 0?
a. to show that 20 > 0
b. to show that 2π > π, where πis an integer and π β₯ 0, implies that 2π+1 > π + 1 is true
c. to show that 2π+1 > π for all π β₯ 0
d. to show that 2π > π for all π β₯ 0
27. Let π΄ = {1,2,3,4} and π΅ = {π₯, π¦, π§}. If relation π
= {(1, π¦), (2, π₯), (3, π§), (4, π¦)}, then which
of the following is NOT correct?
a. 2 π
π₯
b. (4, π₯) β π
c. π
(π¦) = 4
d. Both b and c.
4
Discrete Structures
CMSC 2123
CRN 21858
Test 3 Version 1
Spring 2011
28. Let π΄ be the set of all real numbers and relation π
defined on π΄ by π
=
{(π₯, π¦) β π΄ × π΄|π₯ 2 + π¦ 2 = 9}. Which of the following is true?
a. Domain of π
, π·(π
) = {π‘|0 β€ π‘ β€ 3}
b. Range of π
, πΌπ(π
) = {π‘|0 β€ π‘ β€ 3}
c. Domain of π
, π·(π
) = Range of π
, πΌπ(π
) = {π‘| β 3 β€ π‘ β€ 3}
d. Both a and b
29. Let π΄ = {1,2,3,4,5} and let π
be the relation on π΄ defined by π
=
{(1,3), (2,1), (2,2), (2,5), (3,4), (4,3), (4,4), (5,1), (5,3)}. Which of the following is true?
a. (2,4) β π
2
b. π
2 = π
3
c. π
3 = π
4
d. π
1 = π
2
30. Which of the following relations defined on the given set is not a partial order relation?
a. Power set of π΄ = {π, π, π, π} under inclusion.
b. π΄ = {π, π, π, π} π
= {(π, π), (π, π), (π, π), (π, π)}
c. π΄ = {1,2,3,4,5} π
= {(π₯, π¦)|π₯ β₯ π¦}
d. π΄ = {1,2,3,4,5,6,7,8,9,10} π
= {(π₯, π¦)|π₯|π¦}
31. Which of the following relations on set π΄ = {1,2,3,4} is an equivalence relation?
a. π
= {(1,1), (2,2), (3,3), (4,4), (1,2), (2,1)}.
b. π
= {(1,1), (2,2), (3,3), (1,2), (2,1)}.
c. π
= {(1,1), (2,2), (3,3), (4,4), (1,2)}.
d. π
= {(1,1), (2,2), (3,3), (4,4), (1,2), (2,1), (2,3), (3,4)}.
32. Which of the following relations π are functions from the set π to the set π?
a. π = {β3 β 2, β1,0,1,2}, π = {3,4,5,6,7}, and π = {(β2,3), (β1,6), (0,4), (1,5), (2,7)}
b. π = {β3 β 2, β1,0,1,2}, π = {3,4,5,6,7}, and π =
{(β3,3), (β2,3), (β1,6), (0,4), (β2,6), (1,5), (2,7)}
π
π
c. π = β = π, defined by π (π) = π + π for all π β β.
d. π = {β3 β 2, β1,0,1,2}, π = {3,4,5,6,7}, and π =
{(β2,3), (0,4), (β3,6), (β1,7), (1,5), (2,7)}
5
Discrete Structures
CMSC 2123
CRN 21858
Test 3 Version 1
Spring 2011
33. Let π΄ = {1,2,3,4} and π΅ = {π, π, π, π} be sets. Which of the following arrow diagrams is NOT
a function from π΄ into π΅?
1
a
1
a
2
b
2
b
3
c
3
c
4
d
4
d
a.
c
1
a
2
b
3
c
4
d
Both a and c
b,
d.
34. Which of the following functions does NOT have an inverse?
a. π = {π₯ β β€|β2 < π₯ β€ 5}, π = {π¦ β β€|1 < π¦ β€ 8}, π: π β π defined by π(π₯) = π₯ + 3
for all π₯ β π.
b. π: β€ β β€, π(π₯) = 4π₯ + 7 for all π₯ β β€
c. π: β β β, π(π₯) = 2π₯ β 5 for all π₯ β β.
d. π: β β β, π(π₯) = 8π₯ for all π₯ β β.
35. Consider the sequence: 2, 3, 5, 8, 12, 17, β―. Which of the following is a correct
representation this sequence?
1
a. π1 = 2 and ππ = ππβ1 + (ππβ1 )
2
b. ππ = ππβ1 + ππβ2
c. π1 = 2 and ππ = ππβ1 + (π β 1)
d. π1 = 2 and ππ = ππβ1 + π
6
Discrete Structures
CMSC 2123
CRN 21858
Test 3 Version 1
Spring 2011
36. Consider the sum β5π=0 π(π β 1). If we change the index variable to π = π β 1, then the
equivalent sum is:
a.
b.
c.
d.
β6π=β1 π(π β 1)
β4π=β1 π(π β 1)
β5π=β1 π(π + 1)
β4π=β1 π(π + 1)
37. Let π΄ be the set of lowercase English alphabet. Suppose π 1 = ππππ’ and π 2 = πππ‘. The
concatenation of π 1 and π 2 is:
a. ππππ’πππ‘
b. β
, the empty set
c. 7
d. ππππππ‘π’
38. Let π = {π₯, π¦, π§}. Define β on π by the following multiplication table:
*
x
x
y
z
x
x
x
y
x
x
y
z
z
x
z
a.
b.
c.
d.
Figure 38. Multiplication table for question 38
π₯ is identity of (π,β)
π¦ is identity of (π,β)
π§ is identity of (π,β)
(π,β) does not have an identity
39. A solution of the congruence 3π₯ = 7(πππ 13) is:
a. 3
b. 11
c. 14
d. 21
40. What is the remainder when 1! + 2! + β― + 100! is divided by 12?
a. 9
b. 2
c. 14
d. 7
7
Discrete Structures
CMSC 2123
CRN 21858
41. Which of the following ISBNs is valid?
a. 0 β 619 β 015919 β 7
b. 0 β 201 β 55540 β 8
c. 0 β 201 β 70982 β 1
d. 3 β 240 β 19102 β X
42. Find π(π), the timing function for the code fragment in figure 42.
for (i=0;i<n;i++) {
m=n;
while (m>1) m=m/4;
}
Figure 42. Code Fragment for Question 42.
a.
b.
c.
d.
π(π) = 3πβπππ4 πβ + 3π + 2)
π(π) = 3πβπππ2 πβ + 3π + 2)
π(π) = 3πβπππ4 πβ + 3π + 2)
π(π) = 3πβπππ2 πβ + 3π + 2)
43. Which of the following is a recurrence relation?
a. ππ = 3ππβ1 + ππβ2 β π β₯ 2
b.
c.
ππ = 2π2 β 1 β π β₯ 1
(π )!
ππ+1 = π β π β₯ 1
π!
a. Both a and c
44. Give the recurrence relation for the sequence 1, 5, 25, 125, β¦
a. π1 = 1, ππ+1 = 5π
b. π1 = 1, ππ+1 = 5ππ
c. ππ = 52π for π β₯ 1
d. π1 = 1, ππ = 5ππ+1 for π β₯ 1
45. Which of the following is a linear homogeneous recurrence relation?
a. ππ = 3πππβ1 + ππβ2
b. ππ = β3ππβ1 + 7
π
c. ππ = 3ππβ1 + πβ2
2
d. ππ = ππβ2 β ππβ1
46. Find the solution to the recurrence relation ππ = 4ππβ1 where π0 = 1.
a. The solution is a sequence, 1, 2, 4, 8, β¦
b. The solution is 4
c. The solution is a sequence, 1, 4, 16, 64, β¦
d. The solution is 1
8
Test 3 Version 1
Spring 2011
Discrete Structures
CMSC 2123
CRN 21858
Test 3 Version 1
Spring 2011
47. Find the sum of the sequence 1 + 2 + 3 + β― + π.
a.
b.
c.
d.
π2 + π
π(π+1)
2
π(πβ1)
2
2π(πβ1)
2
48. What do we normally disregard when we count the number of operations in an algorithm?
a. relational operations
b. I/O operations
c. assignment statements
d. arithmetic operators
49. Find π(π), the timing function for the code fragment in figure 49?
sum=0;
for (a=0;a<n;a++) {
for (b=0;b<a;b++) {
sum++;
}
}
Figure 49. Code Fragment for Question 49.
π
π
π
π
ππ
π+
π
a. π(π) = π ππ + π π + π
b. π(π) = ππ +
π
π
c. π(π) = ππ + ππ + π
π
π
d. π(π) = π ππ + π π + π
9
Discrete Structures
CMSC 2123
CRN 21858
Test 3 Version 1
Spring 2011
50. Given that array L is sorted in ascending order, what is the time complexity of member
function search given in figure 50?
class List {
int size;
int count;
int* L;
//Maximum number of available entries in the List.
//Number of occupied entries in the List.
//Index of the entry containing the largest value
//Points to a dynamically allocated array of integers used to
//implement the list
public:
int search(int key)
//Search the list for an entry whose value matches the key
{ int h=count;l=0;
while (l<h) {
int m=(l+h)/2;
if (L[m]=key) return m;
if (L[m]<key) h=m-1; else l=m+1;
}
return -1; //The key could not be found in the list
}
Figure 50. Code Fragment for Question 50.
a.
b.
c.
d.
π(π) = π(π2 )
π(π) = π(π)
π(π) = π(log2 π)
π(π) = π(π log2 π)
10