CS 2102 Reading Quiz 1
The reading material covered in this quiz comes from sections 1.2, 2.2, 2.3, and
3.1-3.3, you may use your book.
1. A statement and its converse are both true. A simpler way to state them would then be:
a.) A tautological statement
(8pts)1. Write a negation for each of the following statements:
a. The variable S is undeclared and the data are out of order.
b. The variable S is undeclared or the data are out of order.
c. If Al was with Bob on the first, then Al is innocent.
d. 5 x 2
CS 2102 - 2009 DISCRETE MATHEMATICS 1 Assignment 4 Solutions
1. Write a natural language specification for a program to determine whether a year is a leap year. Check Wikipedia to make sure you have the correct definition of a leap year. Answer: 2. A year
(12pts)1.Workoutoneoftheproblemsbelow,eitheraorb.Ifyouworkboth,onlypartawillbe
graded.
n 1
1 2 1
a. Usemathematicalinductiontoprovethat
,for n 0 .
3 2n
i 0 2
n
i
n
2
Basecase:Letn=0then 1
0
21 1
3
1 and
1 .
3
3
0
Inductivestep:Assumetrueforn=k,thenn
CS-2102
Discrete Math
Problem Set 1, Due Friday February 3, 2017 by 5 pm.
Remember that you can work one other person. Be sure to give adequate explanation for your
solutions, lack of clarity and completeness may result in points being deducted. Answers g
CS-2102
Discrete Math
Problem Set 6, Due Friday March 24, 2017 by 5 pm.
Remember that you can work one other person. Be sure to give adequate explanation for your
solutions, lack of clarity and completeness may result in points being deducted. Answers giv
CS-2102
Discrete Math
Problem Set 2, Due Friday February 10, 2016 by 5 pm.
Remember that you can work one other person. Be sure to give adequate explanation for your
solutions, lack of clarity and completeness may result in points being deducted. Answers
CS-2102
Discrete Math
Problem Set 5, Due Friday March 17, 2017 by 5 pm.
Remember that you can work one other person. Be sure to give adequate explanation for your
solutions, lack of clarity and completeness may result in points being deducted. Answers giv
CS-2102
Discrete Math
Problem Set 4, Due Friday February 24, 2016 by 5 pm.
Remember that you can work one other person. Be sure to give adequate explanation for your
solutions, lack of clarity and completeness may result in points being deducted. Answers
CS 2102
Discrete Mathematics
David L. Edwards
Rice Hall 502
434-982-2228
[email protected]
1
University of Virginia
Course Foci
Discrete Mathematics
&
Its Applications
2
University of Virginia
Course Information
See and read syllabus
Web site on Collab
Integers and Division
Integers and Division: Whats
Important
Divides: a | b
Mod: a mod m; a b (mod m)
GCD(a,b): greatest common divisor
LCM(a,b): least common multiple
(Prime) Factors Unique for a given integer & each
integers prime factors are unique
Flo
ModuloEquivalences
ModularEquivalences
Let a, b, and n be any integers and suppose n>1. The following statements
are all equivalent:
1. n a b
2. a b mod n
3. a = b + kn for some integer k.
4. a and b have the same (nonnegative) remainder when divided by
Proofs
1
Logic
If "experts" could always be trusted to make the right moral decision,
then public participation would not be necessarybut they cannot be,
and so it is.
Source: Keay Davidson, Carl Sagan: A Life, John Wiley & Sons, 1999, p. xv.
- http:/www.
Sequences: Whats Important
Sequences
Mapping from non-negative integers to a set S.
Arithmetic progressions
Summations
1
Sequences
What is a8 of each of the following sequences (In which
indexing starts at zero)?
a. The sequence whose first two number
CS-2102
Discrete Math
Problem Set 3, Due Friday February 17, 2016 by 5 pm.
Remember that you can work one other person. Be sure to give adequate explanation for your
solutions, lack of clarity and completeness may result in points being deducted. Answers
CS-2102
Discrete Math
Problem Set 7, Due Friday March 31, 2017 by 5 pm.
Remember that you can work one other person. Be sure to give adequate explanation for your
solutions, lack of clarity and completeness may result in points being deducted. Answers giv
CS-2102
Discrete Math
Problem Set 10, Due Friday April 21, 2017 by 5 pm.
Remember that you can work with one other person. Be sure to give adequate explanation for
your solutions, lack of clarity and completeness may result in points being deducted. Answe
CS 2102 Problem set 3, 2/18/16
Crystal Gong (cjg5uw)
Cynthia Zheng (xz7uy)
Wendy Wu (ww6vh)
Katharine Xie (kx3jj)
1. a) False. The first half is true (25 is a factor of 102 (i.e. 100), but the second half is not (25 is
not a factor of 10). Thus R(m,n) if
CS 2102 Problem Set 5
Wendy Wu (ww6vh)
Cynthia Zheng (xz7uy)
Katharine Xie (kx3jj)
Skylar Spears (srs5sb)
1.
p q
p q
p q
p q ( p q)
T
T
F
T
F
T
F
T
F
F
F
T
F
T
F
F
F
F
T
F
This truth table shows
p q
) is false for all conditions.
p q
2. Hypothesis:
tv u
Lecture before fall break
Strings
A string is a sequence of characters
o Characters are letters numbers punctuation marks, spaces
In python string literals are specified by enclosing a sequence of characters within a matching
pair of either single or doub
Public class DataTypeReviewcfw_
Public static vid main(Sting[] args)cfw_
Char CapitalC= C;
System.out.printIn
#to print
# int(CapitalC)
#CapitalC (int) both not correct
Char ch= a;
Int cIntVal=(int) ch; #cast ch to an int
System.out.printin(Inter value: +
Lecture 1
Primitive types vs Reference types
Primitive type=built in to java
o Ex. Int, double
o A box or chunk of memory holding the data itself
Reference types=class types
o The object refers to or points to the chunk of memory that actually holds the d
Constructor= to differential is the number and type of paramenters used, the 3 vs 2
Explain why it may be benedficial to have more than 1= may need first name, last name
o Takes in different paramenters
o At time of creation of object may not hae the info
CS-2102
Discrete Math
Problem Set 9, Due Sunday April 16, 2016 by 5pm.
Remember that you can work in groups that are no larger than 4. Be sure to give adequate
explanation for your solutions, lack of clarity and completeness may result in points being
ded
CS-2102
Discrete Math
Problem Set 8, Due Friday April 7, 2017 by 5pm.
Remember that you can work with one other person. Be sure to give adequate explanation for
your solutions, lack of clarity and completeness may result in points being deducted. Answers