COMP 382
Unit 1 Questions
Swarat Chaudhuri & John Greiner
Response
Counter
What do you need to do after class?
Do first assignment
Take first quiz
Sign up for tutorial section
Read 10 chapters of textbook
10
Re
ad
0%
rs
of
te
xt
bo
ok
ut
or
ia
ls
fo
rt
up
Si
gn
ch
ap
te
qu
iz
st
fir
Ta
ke
sig
nm
as
st
fir
0%
ec
tio
n
0%
en
t
0%
Do
A.
B.
C.
D.
Response
Counter
List definition has how many cases?
1
2
3
4
0%
4
0%
3
0%
2
0%
1
A.
B.
C.
D.
function append (x: List, y: List): List {Response
Counter
match x
case Empty => ???
case Cons(m, z) => ???
}
How to complete base case?
pt
y
0%
Em
0%
y
0%
x
A.x
B.y
C.Empty
function append (x: List, y: List): List {
Response
Counter
match x
case Empty => y
case Cons(m, z) => ???
}
How to complete inductive case?
Co
ns
(
m
,a
pp
en
d(
Co
ns
(
m
,a
pp
en
d(
m
,a
pp
en
d(
y,
z
))
z,
x
z)
x,
Co
ns
(
0%
z,
y)
)
0%
))
0%
)
0%
pp
en
d(
z))
x))
z))
y))
m
,a
append(x,
append(z,
append(y,
append(z,
Co
ns
(
A.Cons(m,
B.Cons(m,
C.Cons(m,
D.Cons(m,
function reverse (x: List): List {
match x
case Empty => Empty
case Cons(m, z) => ???
}
50% 46%
How to complete inductive case?
re
ve
rs
e(
z
),
...
Co
ns
(
re
ve
rs
e(
z
m
,E
m
),
m
)
m
)
z,
ap
pe
nd
(
ap
pe
nd
(
ap
pe
nd
(
Co
ns
(
z,
m
)
2% 3%
A.Cons(z, m)
B.append(z, m)
C.append(reverse(z), m)
D.append(reverse(z), Cons(m, Empty))
3
To prove: π β π is divisible by 3, for π β β.
How many cases in inductive proof?
A.
B.
C.
D.
1
2
3
4
E. π β 1
F. π
G. π + 1
3
To prove: π β π is divisible by 3, for π β β.
What is the inductive case?
A. If π3 β π | 3, then
(π + 1)3 β π + 1 | 3.
B. If (π + 1)3 β π + 1 | 3, then
π3 β π | 3.
Response
Counter
π
To prove: π! < π , for π > 1.
Response
Counter
What is base case?
A. π = 0
B. π = 1
C. π = 2
0%
$$
=2
0%
$$
=1
$$
=0
0%
Response
Counter
< is a well-founded relation over β.
A. True
B. False
0%
Fa
l se
Tr
ue
0%
Response
Counter
ο£ is a well-founded relation over β.
A. True
B. False
0%
Fa
l se
Tr
ue
0%
Response
Counter
< is a well-founded relation over β€.
A. True
B. False
0%
Fa
l se
Tr
ue
0%
Which is a well-founded relation on β×β?
Response
Counter
π, π < π, π iff β¦
$$
+$
$
$$
$$
<
an
d
$$
=$
$
or
$$
<$
$
$$
+$
$<
$
$<
$
or
$
$$
<$
$
an
d
$$
<$
$
0% 0% 0% 0% 0%
$$
<$
$
π<π
π < π and π < π
π < π or π < π
π < π or π = π and π < π
π+π <π+π
$$
<$
$
A.
B.
C.
D.
E.
For chips puzzle, do induction on what?
Response
Counter
Remove a red and anything β Put in none.
Remove two yellow β Put in 1 yellow, 5 blue.
Remove a blue and not red β Put in 10 red.
0%
#y
el
lo
w
,#
bl
ue
,#
re
d)
lo
w
,#
re
d)
Le
x
Le
x
0%
.o
rd
er
(
#b
lu
e,
#y
el
ye
llo
w
,#
bl
ue
)
0%
.o
rd
er
(
#r
ed
,#
To
ta
l#
of
ch
ip
s
0%
.o
rd
er
(
Total # of chips
Lex. order (#red, #yellow, #blue)
Lex. order (#blue, #yellow, #red)
Lex. order (#yellow, #blue, #red)
Le
x
A.
B.
C.
D.
Induction guarantees what for inductivelydefined programs?
Termination
Correctness
Most efficient algorithm
No such general statement
always holds
cie
nt
al
ge
go
ne
rit
hm
ra
ls
ta
te
m
en
ta
lw
...
No
su
ch
M
os
t
ef
fi
Co
rr
ec
tn
es
s
in
at
io
n
0% 0% 0% 0%
Te
rm
A.
B.
C.
D.
Response
Counter
© Copyright 2026 Paperzz