Midterm 2 from CS 220
True or false: the sequence ()(())() is uniquely defined.
F
Corvettes are fun to drive. James's car is not a Corvette, therefore it's not fun to drive
False
Let w i be the string created by concatenating i copies of w. For example, w 2 = w w. Which of the following are correct recursive definitions for the set W = { w i : i ∈ N }?
* Base case: the empty string, w 0 ∈ W . Recursive rule: w i = { w w i − 1 , i is odd w i / 2 w i / 2 , i is even ∈ W . * Base case: the empty string, w 0 ∈ W . Recursive rule: w i = w w i − 1 ∈ W . * Base case: the empty string, w 0 ∈ W . Recursive rule: w i = w i − 1 w ∈ W .
Consider the following recursive definition for the following set A of bitstrings: Base case: The empty string, λ ∈ A, 1 ∈ A, and 0 ∈ A Recursive rule: if x ∈ A then 1 x 1 ∈ A 0 x 0 ∈ A Which of the following are elements of A?
1101011 101 110011
Consider the following recursive definition for the following set A of bitstrings: Base case: The empty string, λ ∈ A, 1 ∈ A, and 0 ∈ A Recursive rule: if x ∈ A then 1 x 1 ∈ A 0 x 0 ∈ A Which of the following are elements of A?
1101011 110011 101
What is f(3) if f(0) = 1 and f(n) is defined recursively by f(n+1) = 2f(n)?
16
What is the value of f(4) if f(0) = 5 and f(n) is defined recursively by f(n+1) = 5f(n)/5?
5
What is the value of f(4) if f(0) = 5 and f(n) is defined recursively by f(n+1) = -2f(n)?
80
What step best completes the following proof if substituted for the "???"? Proposition: A postage price of n ≥ 8 cents can be payed entirely using 3 cent and 5 cent stamps.
By the inductive hypothesis, ( k − 2 ) can be represented using 3 and 5 cent stamps.
What step best completes the following proof if substituted for the "???"? Proposition: A postage price of n ≥ 8 cents can be payed entirely using 3 cent and 5 cent stamps. We
By the inductive hypothesis, ( k − 2 ) can be represented using 3 and 5 cent stamps.
Which rule do you need to conclude (A ∨ C) from the hypotheses (A ∨ B) (¬B ∨ C)?
Resolution
Why is the function f:R → R defined by f(x) = sqrt(x) not well defined?
Some elements in the domain do not map to an element in the range.
Why is the function f:R → R defined by f(x) = 1/(x-1) not well defined?
Some elements in the domain do not map to an element in the target.
Why is the function f:R → R defined by f(x) = ±sqrt(x^2) not valid?
Some elements in the domain map to more than one element in the target.
In class we showed that breaking up a chocolate bar with n squares into the individual squares takes n-1 breaks. Did we show this using regular induction or strong induction?
Strong INduction
In class we showed that all natural numbers n ≥ 2 can be represented as the product of primes. Did we show this using regular induction or string induction?
Strong Induction
In class we showed that breaking up a chocolate bar with n squares into the individual squares takes n-1 breaks. Did we show this using regular induction or strong induction?
Strong Induction
In class we showed that the Fibonacci sequence given by f ( 0 ) = 0 f ( 1 ) = 1 f ( n ) = f ( n − 1 ) + f ( n − 2 ) , n ≥ 2 has the property that f ( n ) ≤ 2 n. Did we show this using regular induction or strong induction?
Strong Induction
In class we showed that the Fibonacci sequence given by f ( 0 ) = 0 f ( 1 ) = 1 f ( n ) = f ( n − 1 ) + f ( n − 2 ) , n ≥ 2 has the property that f ( n ) ≤ 2 n. Did we show this using regular induction or strong induction?
Strong induction
In regular induction, showing P(n) is true for n greater than or equal to zero requires showing the basis step, P(0), and the inductive step, i.e. that for every natural number k, if P(k) then P(k+1). True or false: In strong induction, the only difference from regular induction is in the inductive step where you instead prove that for every natural number k, if P(0)∧P(1)∧P(2)∧...∧P(k) then P(k+1).
T
True or false: A proof using regular induction can be considered a special case of proof by strong induction.
T
True or false: The function f:R → R defined by f(x) = sqrt(x^2 + 1) is a well-defined function.
T
True or false: the sequence (()()) is uniquely defined.
T
True or false: the sequence ()(()) is uniquely defined.
T
P(0) is true. For all nonnegative integers n, if P(n) is true, then P(n + 2) is true. We can now infer that P(n) is true for:
The even nonnegative integers
What is wrong with this "proof" by strong induction? Proposition: For every nonnegative integer n, 5n = 0. Basis step: For n = 0, we see that 5 ⋅ 0 = 0. Inductive step: Suppose that 5 j = 0 for all nonnegative integers j with 0 ≤ j ≤ k. We will show that 5 ( k + 1 ) = 0. Write k + 1 = i + j where i and j are natural numbers less than k + 1. By the inductive hypothesis,5 ( k + 1 ) = 5 ( i + j ) = 5 i + 5 j = 0 + 0 = 0. Since the basis step and the inductive step hold, for very nonnegative integer n, 5n = 0.
The inductive step is not correct.
P(0) and P(1) are true. For all nonnegative integers n, if P(n) and P(n + 1) are true, then P(n + 2) is true. We can now infer that P(n) is true for:
The nonnegative integers
P(1) is true. For all positive integers n, if P(n) is true, then P(n + 2) is true. We can now infer that P(n) is true for:
The odd positive integers
P(1) is true. For all positive integers n, if P(n) is true, then P(n + 1) is true. We can now infer that P(n) is true for:
The positive integers
P(1) and P(2) are true. For all positive integers n, if P(n) and P(n + 1) are true, then P(n+2) is true. We can now infer that P(n) is true for:
The positive integers.
P(1) is true. For all positive integers n, if P(n) is true, then P(2n) is true. We can now infer that P(n) is true for:
The powers of two: {2^x : x E N} = {1,2,4,8,...}
What is wrong with this "proof" by strong induction? Proposition: a n = 1 for all nonnegative integers n. Basis step: For n = 0, we see that a 0 = 1 by definition of a 0. Inductive step: Assume that a j = 1 for all nonnegative integers j with j ≤ k. We will show that a k + 1 = 1. We see that a k + 1 = a k ⋅ a k a k − 1 = 1 ⋅ 1 1 = 1. Since the basis step and the inductive step hold, a n = 1 for all nonnegative integers n.
This proof requires a basis step for n = 1, and for which the claim is not correct.
Every student in the university has lived in the dorms. Moses has not lived in the dorms. Therefore Moses was not a student in the university.
True
True or false: The function f:R → R defined by f(x) = sqrt(x^2 + 1) is a well-defined function.
True
True or false: the sequence (()()) is uniquely defined.
True
Let the function f: Z → Z (the integers) be defined as f(x) = |x|. What are the Domain [ Select ] ["Z (the integers)", "N (the natural numbers)", "R (the real numbers)", "The positive integers"] Range N (the natural numbers) Target [ Select ] ["R (the real numbers)", "Z (the integers)", "N (the natural numbers)", "The positive integers"] of this function?
Z (the integers) N (the natural numbers) Z (the integers)
It is raining; therefore it is snowing or raining.
addition
The sun shines; the wind blows. Therefore the sun shines and the wind blows.
conjunction
Which of the following functions functions f: Z → Z are not onto?
f(x) = 2x f(x) = x^2
Which of the following functions f: R → R are not onto?
f(x) = ceiling(x) f(x) = floor(x)
Which of the following functions f: R → R are valid?
f(x) = floor(x) f(x) = 3
Which of the following functions f: Z → Z are not one to one?
f(x) = x % 3 (% is modulo) f(x) = |x|
Which of the following functions f: Z → Z are not one to one?
f(x) = |x| f(x) = x % 3 (% is modulo)
Corvettes are fun to drive. James's car is not a Corvette, therefore it's not fun to drive.
false
If it is cold I need a coat; it is cold. Therefore I need a coat.
modus ponens
If it is cold I need a coat; I do not need a coat. Therefore it is not cold.
modus tollens
P(0) and P(1) are true. For all nonnegative integers n, if P(n) and P(n + 1) are true, then P(n + 2) is true. We can now infer that P(n) is true for:
nonnegative integer
P(0) and P(1) are true. For all nonnegative integers n, if P(n) and P(n + 1) are true, then P(n + 2) is true. We can now infer that P(n) is true for:
nonnegative integers
P(1) and P(2) are true. For all positive integers n, if P(n) and P(n + 1) are true, then P(n+2) is true. We can now infer that P(n) is true for:
positive integer
P(1) is true. For all positive integers n, if P(n) is true, then P(n + 1) is true. We can now infer that P(n) is true for:
positive integer
P(1) and P(2) are true. For all positive integers n, if P(n) and P(n + 1) are true, then P(n+2) is true. We can now infer that P(n) is true for:
positive integers
Given ¬p, ¬q and ¬(p ∨ q) → r, which of the following is true?
r
In class we showed that breaking up a chocolate bar with n squares into the individual squares takes n-1 breaks. Did we show this using regular induction or strong induction?
strong induction
What is wrong with this "proof" by strong induction? Proposition: For every nonnegative integer n, 5n = 0. Basis step: For n = 0, we see that 5 ⋅ 0 = 0. Inductive step: Suppose that 5 j = 0 for all nonnegative integers j with 0 ≤ j ≤ k. We will show that 5 ( k + 1 ) = 0. Write k + 1 = i + j where i and j are natural numbers less than k + 1. By the inductive hypothesis,5 ( k + 1 ) = 5 ( i + j ) = 5 i + 5 j = 0 + 0 = 0. Since the basis step and the inductive step hold, for very nonnegative integer n, 5n = 0.
the inductive step is not correct
Consider the set of binary strings, B ∗ defined recursively by Base case: The empty string, λ ∈ B ∗ Recursive rule: if x ∈ B ∗, then x 1 ∈ B ∗ x 0 ∈ B ∗ What elements does the subset ofB ∗ consisting of strings of length three that start with one contain?
{ 100 , 101 , 110 , 111 }
Consider the set S of strings defined recursively by Base case: the empty string, λ ∈ S and a ∈ S Recursive rule: if x ∈ S then, x b ∈ S x b a ∈ S What are all the strings of length at most 3 in S?
{ λ , a , b , a b , b b , b a , a b b , b b b , b a b , a b a , b b a }
The set A is defined as A = {a, b, c, d}. Let the function f: A → Z (the integers) be defined as f = {(a, -1), (b, 0), (c, 1), (d, 2)}. What are the Domain [ Select ] ["Z (the integers)", "{a, b, c, d}", "{-1, 0, 1, 2}"] Range [ Select ] ["{-1, 0, 1, 2}", "{a, b, c, d}", "Z (the integers)"] Target Z (the integers) of this function?
{a, b, c, d} {-1, 0, 1, 2} Z (the integers)
Which of the following equivalences is true?
¬(k ∧ r) ∨ s ≡ (r ∧ ¬s) → ¬k
Which of the following equivalences is true
¬(k∧¬r)∨s ≡ ¬k∨r∨s ≡ k → r∨s
The statement (p ∨ q) ∧ (p → r) is logically equivalent to:
¬p ∧ r ***answer***None of the above are true q ∨ ¬r p ∨ ¬r q ∨ r
Given ¬p, ¬q and r → (p ∨ q), which of the following is true?
¬r
Given k and r and ¬(k ∨ r) ∨ s. Which of the following is false?
¬s
Given the following predicates, which is not equivalent with the others?
∀x ¬P(x))
Given the following predicates, which is not equivalent with the others?
∃x(¬P(x)∧¬Q(x))