National University of Computer and Emerging Sciences, Lahore Campus
National University of Computer and Emerging Sciences, Lahore Campus
National University of Computer and Emerging Sciences, Lahore Campus
Question 1 2 3 4 5 6 7 8 9 10 Total
Number
Total 10 10 10 10 10 10 10 10 10 10 100
Marks
Obtained
Marks
The summer in Maine is either cold (or not hot) or cloudy (or not sunny).
You can get admission in University unless you have failed the entrance exam.
You passed the exam but can’t get admission in University.
Translate the given statement into propositional logic using the propositions provided.
You can upgrade your operating system only if you have a 32-bit processor running
at 1 GHz or faster, at least 1 GB RAM, and 16 GB free hard disk space, or a 64- bit
processor running at 2 GHz or faster, at least 2 GB RAM, and at least 32 GB free hard
disk space.
u: “You can upgrade your operating system,” b32: “You have a 32-bit
processor,” b64: “You have a 64-bit processor,” g1: “Your processor runs at 1
GHz or faster,” g2: “Your processor runs at 2 GHz or faster,” r1: “Your
processor has at least 1 GB RAM,” r2: “Your processor has at least 2 GB RAM,”
h16: “You have at least 16 GB free hard disk space,” and h32: “You have at
least 32 GB free hard disk space.”
Express these system specifications using the propositions 𝒑𝒑 “The user enters a valid
password”, 𝒒𝒒 “Access is granted”, and 𝒓𝒓 “The user has paid the subscription fee” and
logical connectives (including negations).
“Access is granted whenever the user has paid the subscription fee and enters a
valid password.”
𝑝𝑝 ∧ 𝑟𝑟 → 𝑞𝑞
¬𝑝𝑝 ∧ 𝑟𝑟 → 𝑞𝑞
If one gets to the top of Long’s Peak, then one has walked 8 miles.
Your guarantee is good only if you bought your CD player less than 90 days ago.
If your guarantee is good, then you bought your CD player less than 90 days ago.
Show that ¬𝒑𝒑 → (𝒒𝒒 → 𝒓𝒓) and 𝒒𝒒 → (𝒑𝒑 ∨ 𝒓𝒓) are logically equivalent by developing a
series of logical equivalences.
Note: You can establish the above equivalence using truth table to get 50% marks.
¬𝒑𝒑 → (𝒒𝒒 → 𝒓𝒓) ≡ �¬(¬𝑝𝑝) ∨ (𝑞𝑞 → 𝑟𝑟)� ≡ 𝑝𝑝 ∨ (¬𝑞𝑞 ∨ 𝑟𝑟) ≡ 𝒑𝒑 ∨ ¬𝒒𝒒 ∨ 𝒓𝒓 (1)
For each of the three animals, cats, dogs, and ferrets, there is a student in your class
who has this animal as a pet.
∃𝑥𝑥𝑥𝑥(𝑥𝑥) ∧ ∃𝑥𝑥𝑥𝑥(𝑥𝑥) ∧ ∃𝑥𝑥𝑥𝑥(𝑥𝑥)
Let 𝑷𝑷(𝒙𝒙) be the predicate “𝑥𝑥 is a predator,” 𝑸𝑸(𝒙𝒙) be the predicate “𝑥𝑥 is a prey,” and
𝑹𝑹(𝒙𝒙, 𝒚𝒚) be the predicate “𝑥𝑥 has killed 𝑦𝑦,” where the domain consists of all animals in a
jungle. Use quantifiers to express each of these statements.
Some predator has not killed any prey.
∃𝑥𝑥(𝑃𝑃(𝑥𝑥) ∧ ∀𝑦𝑦(𝑄𝑄(𝑦𝑦) → ¬𝑅𝑅(𝑥𝑥, 𝑦𝑦)))
A negative real number does not have a square root that is a real number.
∀𝑥𝑥(𝑥𝑥 < 0 → ¬∃𝑦𝑦(𝑦𝑦 2 = 𝑥𝑥))
Determine the truth value of each of these statements if the domain of each variable
consists of all real numbers.
1. Kangaroos live in Australia and are marsupials. Therefore, kangaroos are marsupials.
Simplification
2. Linda is an excellent swimmer. If Linda is an excellent swimmer, then she can work
as a lifeguard. Therefore, Linda can work as a lifeguard.
Modus ponens
3. It is either hotter than 100 degrees today or the pollution is dangerous. It is less
than 100 degrees outside today. Therefore, the pollution is dangerous.
Disjunctive syllogism
4. A convertible car is fun to drive. Isaac’s car is convertible. Therefore, Isaac’s car is
fun to drive.
5. Quincy likes only action movies. Quincy likes the movie Eight Men Out. Therefore,
Eight Men Out is an action movie.
6. Everyone who eats granola every day is healthy. Linda is not healthy. Therefore,
Linda does not eat granola every day.
It’s not; e.g. 7 has more than one pre-images, (5,2), (4,3) etc.
The sequence whose 𝑛𝑛th term is the largest integer whose binary expansion has 𝑛𝑛
bits (Write your answer in decimal notation.)
Using an iterative approach, find the solution to the following recurrence relation and
initial condition:
𝑎𝑎1 = 1 ⋅ 5 = 5
𝑎𝑎2 = 2 ⋅ (1 ⋅ 5) = (2 ⋅ 1) ⋅ 5
𝑎𝑎3 = 3 ⋅ �(2 ⋅ 1) ⋅ 5� = (3 ⋅ 2 ⋅ 1) ⋅ 5
⋮
𝑎𝑎𝑛𝑛 = (𝑛𝑛 ⋅ 𝑛𝑛 − 1 ⋅ … ⋅ 1) ⋅ 5 = 𝑛𝑛! ⋅ 5 = 5(𝑛𝑛!)
Set up a recurrence relation for the amount in the account at the end of 𝑛𝑛 years.
Find an explicit formula for the amount in the account at the end of 𝑛𝑛 years.
𝑃𝑃0 = 1000
𝑃𝑃1 = (1.09)𝑃𝑃0
𝑃𝑃2 = (1.09)𝑃𝑃1 = (1.09)2 𝑃𝑃0
𝑃𝑃3 = (1.09)𝑃𝑃2 = (1.09)3 𝑃𝑃0
⋮
𝑃𝑃𝑛𝑛 = (1.09)𝑃𝑃𝑛𝑛−1 = (1.09)𝑛𝑛 𝑃𝑃0
��5
𝑖𝑖=1 𝑗𝑗=𝑖𝑖
= 𝟐𝟐𝟐𝟐𝟐𝟐𝟐𝟐𝟐𝟐
Suppose that m+n and n+p are even. Then m+n = 2s for some integer s and n+p = 2t for
some integer t. If we add these, we get m+p+2n = 2s +2t .
Subtracting 2n from both sides and factoring, we have m+p = 2s+2t − 2n = 2(s + t − n).
Because we have written m + p as 2 times an integer, we conclude that m + p is even.
Basis step:
Inductive step:
If no such 𝑏𝑏 ∈ 𝐴𝐴 exists such that (𝑎𝑎, 𝑏𝑏) ∈ 𝑅𝑅, then the proof would collapse.
Which of these relations on {0, 1, 2, 3} are equivalence relations? Determine the properties
of an equivalence relation that the others lack.
{(0, 0), (1, 1), (2, 2), (3, 3)}
Equivalence Relation
{(0, 0), (0, 2), (2, 0), (2, 2), (2, 3), (3, 2), (3, 3)}
Not Reflexive [(1,1) is missing]; Not Transitive [(0,2) and (2,3) are in the relation but
(0,3) is missing].
{(0, 0), (1, 1), (1, 3), (2, 2), (2, 3), (3, 1), (3, 2), (3, 3)}
Not Transitive [(1,3) and (3,2) are in the relation but (1,2) is missing; moreover, (2,3)
and (3,1) are in the relation but (2,1) is missing]
{(0, 0), (1, 1), (1, 2), (2, 1), (2, 2), (3, 3)}
Equivalence Relation
1 1 1
𝑀𝑀𝑅𝑅∘𝑆𝑆 = 𝑀𝑀𝑆𝑆 ⊙ 𝑀𝑀𝑅𝑅 = �1 1 1�
1 1 1
In how many ways can a student answer the questions on the test if the student
answers every question?
410
In how many ways can a student answer the questions on the test if the student can
leave answers blank?
510
How many bit strings of length seven either begin with two 0s or end with three 1s?
25 + 24 − 22 = 32 + 16 − 4 = 𝟒𝟒𝟒𝟒
What is the minimum number of students, each of whom comes from one of the 37 states,
who must be enrolled in a university to guarantee that there are at least 55 who come from
the same state?
𝑥𝑥
min �� � = 55� ⇒ 𝑥𝑥 = 𝟏𝟏𝟏𝟏𝟏𝟏𝟏𝟏
𝑥𝑥 37
There are 38 different time periods during which classes at a university can be scheduled.
If there are 677 different classes, how many different rooms will be needed?
𝟏𝟏𝟏𝟏
(𝒏𝒏!)𝟐𝟐
15
� � (3𝑥𝑥 2 )6 (−2𝑦𝑦)9 = 5005 ⋅ 729𝑥𝑥 12 (−512𝑦𝑦 9 ) = −𝟏𝟏𝟏𝟏𝟏𝟏𝟏𝟏𝟏𝟏𝟏𝟏𝟏𝟏𝟏𝟏𝟏𝟏𝟏𝟏𝑥𝑥 12 𝑦𝑦 9
6
Show that in a simple graph with at least two vertices there must be two vertices that have
the same degree.
𝐶𝐶𝑛𝑛
𝑊𝑊𝑛𝑛
Determine whether the given pairs of graphs are isomorphic. Exhibit an isomorphism or
provide a rigorous argument that none exists.
Answer:
Answer: