Boolean Logic & Truth Tables - Homework Assignment
Instructions: Complete the missing values in the truth tables below using AND, OR, and NOT
operators.
Hint: he inputs column should be populated in a binary count up
Hint: There should be 2^(n) number of inputs
Section 1: Basic Boolean Operators
1. Fill in the truth tables for the following Boolean expressions:
a) A AND B
A B A AND B
? ? ?
? ? ?
? ? ?
? ? ?
b) A OR B
A B A OR B
? ? ?
? ? ?
? ? ?
? ? ?
c) NOT A
A NOT A
? ?
? ?
Section 2: Combining Boolean Operators
2. Complete the truth tables for each Boolean expression below.
a) (A AND B) OR C
A B C A AND B (A AND B) OR C
? ? ? ? ?
? ? ? ? ?
? ? ? ? ?
? ? ? ? ?
? ? ? ? ?
? ? ? ? ?
? ? ? ? ?
? ? ? ? ?
b) (A OR B) AND (NOT C)
A B C A OR B NOT C (A OR B) AND (NOT C)
? ? ? ? ? ?
? ? ? ? ? ?
? ? ? ? ? ?
? ? ? ? ? ?
? ? ? ? ? ?
? ? ? ? ? ?
? ? ? ? ? ?
? ? ? ? ? ?
Section 3: More Complex Boolean Expressions
3. Complete the truth tables for the following expressions.
a) NOT (A AND B) OR C
A B C A AND B NOT (A AND B) NOT (A AND B) OR C
? ? ? ? ? ?
? ? ? ? ? ?
? ? ? ? ? ?
? ? ? ? ? ?
? ? ? ? ? ?
? ? ? ? ? ?
? ? ? ? ? ?
? ? ? ? ? ?
b) (A OR NOT B) AND (B OR C)
A B C NOT B A OR NOT B B OR C (A OR NOT B) AND (B OR C)
? ? ? ? ? ? ?
? ? ? ? ? ? ?
? ? ? ? ? ? ?
? ? ? ? ? ? ?
? ? ? ? ? ? ?
? ? ? ? ? ? ?
? ? ? ? ? ? ?
? ? ? ? ? ? ?
Section 4: Generalised array printer
4. Create a function take any array as input and print it.
✏️ Write a Python or Java program to complete the following tasks.
a) Print a 2D Array in Matrix Format
i) Write a program that prints the following 2D array as a matrix:
ii) create a function printArray(array) that takes in any 2D array and prints it in a matrix format
Given array:
1 2 3
4 5 6
7 8 9
Expected Output:
1 2 3
4 5 6
7 8 9