Module3 - Assignment Sheet1
Module3 - Assignment Sheet1
3
Boolean
Assignment
-‐
Truth
Tables
Ravi
Patel
-‐
Student
ID#
Question 1)
Question 2)
a)
The
program
terminates
when
the
department
number
is
invalid
(valid
numbers
are
between
0
and
100,
exclusive
(meaning,
not
including
0
and
100))
OR
we
reach
the
end
of
the
file.
When
counter
is
invalid,
it
is
<=
0
OR
>=
100.
A
OR
B
OR
C
A
V
B
V
C
b)
A B C A
V
B
V
C
F F F F
F F T T
F T F T
F T T T
T F F T
T F T T
T T F T
T T T T
We
can
see
by
the
final
column
that
the
expression
is
true
for
all
rows
except
for
row
1:
when
A
or
B
or
C
are
true.
One
has
to
be
true
for
the
program
to
terminate.
For
all
other
cases,
the
end
result
if
false.
Therefore,
our
process
terminates
when
we
reach
the
end
of
the
file,
or
when
counter
is
either
less
than
or
equal
to
0,
or
greater
than
or
equal
to
100.
Question
3)
Print
x
when
x
is
between
1
and
5
inclusive
or
is
an
odd
number.
Expression
-‐
(
B
AND
C
)
OR
(
NOT
D
)
(
B
^
C
)
V
(
!D
)
Print
x
when
x
isn't
a
prime
number,
is
between
1
and
5
inclusive,
and
is
odd.
Expression
-‐ (
NOT
A
)
AND
(
B
AND
C
)
AND
(
NOT
D)
(
!A
)
^
(
B
^
C
)
^
(
!D
)
Print
x
when
x
is
less
than
1
or
is
an
odd
number
greater
than
5.
Expression
-‐ (
NOT
B
)
OR
(
NOT
C
AND
NOT
D
)
(
!B
)
V
(
!C
^
!D
)