Assignment 1 To 7
Assignment 1 To 7
Assignment - 1
2) State the two absorption laws. Verify one of them using truth table
5) Draw the truth table to prove the propositional logic expression: a<=>b=(a =>b).(b =>a)
6) Simplify using Boolean algebra. At each step state clearly the law used: X.Y. (X.Y+Y.Z)
7) State the De Morgan’s laws. Verify any one of them using truth table.
9) Draw the logic gate diagram and truth table for XOR gate.
11) Convert the given function to its equivalent POS form F(A,B,C)=(2,6,7)
12) Convert the following SOP into its corresponding POS: F(O,V,W,)=O’.V’.W’+O’.VV’.W+O’.V.W+O.V’.W
14) Write the product of sum form for the Boolean function F(A,B,C) whose output is 0 only when: A=1,B=0,C=0
16) Reduce the following into its simplest form using laws of Boooean Algebra. At each step state clearly the law
18) Simplify the given expression using laws of Boolean algebra. A.(B.C)’+(A.B.C)’
21) Write the canonical POS for the Boolean function denoted by the expression F(A,B,C)=∑(1,2,3,6,7)
24) Define Maxterms and minterms. Find the maxterm and minterm when P=0,Q=1,R=1,S=0
25) Convert the following cardinal form of expression to its canonical form
F= (P,Q,R)=𝜋(1,3)
Computer Science
Assignment - 2
Reduce the below expression by using 4-variable Karnaugh map, showing the various groups (i.e.
Draw the logic gate diagram for the reduced expression. Assume that the variables and their
1) Given F(P,Q,R,S) = π ( 5, 7, 8, 10, 12, 14, 15 ) 2) Given F(A,B,C,D) = ( 0, 2, 3, 6, 8, 10, 11, 14, 15 )
7) A passenger is alloted a window seat in an aircraft, if he/she satisfies the criteria given
below:
OR
OR
• The passenger is not below 15 years, but is travelling for the first time.
Output: W- Denotes the passenger is alloted a window seat(1 indicates yes and 0 indicates
no). Draw the truth table for the inputs and outputs given above and write the SOP
8) A person is allowed to travel in a reserved coach of the train, if he / she satisfies the criteria given below:- •
The person has a valid reservation ticket and a valid ID proof. OR
• The person does not have a valid reservation ticket, but holds a valid pass issued by the Railway department
with a valid ID proof. OR • The person is a disabled person and holds a valid pass issued by the Railway
department along with a valid ID proof.
The inputs are: R The person has a valid reservation ticket P The person holds a valid pass issued by the Railway
department D The person has a valid ID proof H The person is a disabled person ( In all the above cases 1
indicates yes and 0 indicates no ). Output :- T - Denotes allowed to travel ( 1 indicates yes and 0 indicates no in
all the cases)
a) Draw the truth table for the inputs and outputs given above and write the POS
expression for T(R,P,D.H). b) Reduce T(R,P,D,H) using Karnaugh map. Draw the logic gate
diagram for the reduced POS expression for T(R,P,D,H) using NOR gates. You may use
gates with more than 2 inputs. Assume that the variables and their complements are
available as inputs. 9) A school intends to select students for the Inter – school athletic meet, as per the criteria
given below: • The candidate is from the Senior school and has participated in an inter
• The candidate is not from the Senior School, but the height is between 5 ft. and 6ft.
OR
• The candidate is from the senior school and has height between 5ft. And 6ft., but the
OUTPUT:X Denotes the selection criteria [ 1 indicates selected and 0 indicates rejected
b) Reduce X(S,W,H,A) using Karnaugh map. Draw the logic gate diagram for the reduced
SOP expression for X(S,W,H,A) using AND and OR gate. You may use gates with two or
more inputs. Assume that the variable and their complements are available as inputs.
Assignment No. 3
BOOLEAN ALGEBRA & COMPUTER HARDWARE
1. Draw the circuit diagram for the given equation using basic logic gates:
a. [(p+q)’+(p’(q+r’))]’+(pq+r’)
b. (A+B+C’)+(A’+B’)’+(A’(B’C’)+A’+C)
c. [( p q)( q r ' )( p.q)].r
d. [( p.q)(q r ')].( p q r )
e. p[( q.r ).( p.r )] r
2. Draw the circuit diagram for the given expression:
(X Y) (X’ Y’) (Y Z)
3. Draw the circuit diagram using universal gates:
[[(A+B)’+(B’.C’)’]’+(A’B’)’]’
4. Draw the circuit diagram using only NAND gate:
a. P’Q’R’+P’(Q+Q’)R+QR+P’
b. A’B’+A’B+B
5. Draw the circuit diagram using only NOR gate:
a. (A+B+C’)(A’A+B+C)(A+BB’+C)
b. (P+Q) R (P+R’)
6. Check Which of the Statements are tautology, contradiction or contingency :-
a. [( p q)( q r )] ( p r )
b. [( p' q)( q r )] ( p' r )
c. ( p & q) ( p & q)'
d. ( p q)( p.q )
e. ( p' q) r s (r 'q)
7. Give the output of the diagrams given below: -
1.
2.
3.
4.
5.
9. Mention the gate represented by the following circuit diagram and prove it: -
1.
2.
3.
4.
1. Define :
a. Proposition
b. Simple proposition
c. Compound proposition
d. Truth table
e. Truth value
f. Syllogism
g. Premises
h. Well Formed Formulae
i. Logic gate
j. Contingencies
k. Tautologies
l. Contradictions
m. Consistent Statements
n. Converse
o. Inverse.
p. Contrapositive
q. Gate
r. Minterm
s. Maxterm
t. Canonical SOP and POS expression
2. Write a note on operators.
3. Write a note on Basic logic gate.
4. Differentiate between Basic and Universal logic gates.
5. Differentiate between XOR and XNOR gate.
6. Differentiate between NOR and NAND gate.
7. Differentiate between OR, AND and NOT gate.
8. Draw the circuit diagram and prove AND, OR, NAND and NOT using only NOR gate.
9. Draw the circuit diagram and prove AND, OR, NOR and NOT using only NAND gate only.
10. Prove properties of 0 using truth table and draw logic circuit diagram.
11. Prove properties of 1 using truth table and draw logic circuit diagram.
12. Prove Absorption law using truth table and draw logic circuit diagram.
13. Prove Involution law using truth table and draw logic circuit diagram.
14. Prove Idempotence law using truth table and draw logic circuit diagram.
15. Prove Complementarity law using truth table and draw logic circuit diagram.
16. Prove Commutative law using truth table and draw logic circuit diagram.
17. Prove Associative law using truth table and draw logic circuit diagram.
18. Prove Distributive law using truth table and draw logic circuit diagram.
19. Prove De Morgan's law using truth table and draw logic circuit diagram.
20. Prove Conditional elimination law using truth table.
21. Prove Bi-conditional law using truth table.
Computer Science
Assignment – 5
What prefix and postfix expression is equivalent to the following infix expression?
1. infix: (A + B) * C + D / (E + F * G) - H
2. infix: A + ((B - C * D) / E ) + F - G / H
3. infix: (A * B + C) / D - E / (F + G)
4. infix: A - B - C * (D + E / F - G) - H
5. infix: A * B / C + (D + E - (F * (G / H)))
6. infix: A + B / C* ( D / E * F)
7. infix: X+Y (Y-Z) + ((W+E) * F) / J
8. infix: (A/B +C) * (D/(E-F))
9. infix: P*Q/R+(S+T)
10. infix: A + (B – C * (D / E) * F)
(b) Answer the following questions from the diagram of a Binary Tree given below:
(i) Write the Inorder, postorder and preorder traversal of the above tree structure.
(ii) State the height of the tree, if the root is at level 0 (zero).
(iii) List the leaf nodes of the tree.
I) Name the leaf nodes of the right sub tree.
II) Write Inorder,postorder and preorder traversal of the left sub tree of node B including itself.
III) State the level number of nodes R and M when the root is at level 0.
iv) Root of the tree and name the internal and external nodes
Computer Science
Assignment – 6
1. A character array B[7][6] has a base address 1046 at 0,0. Calculate the address at B[2][3] if the array is
stored Column Major wise. Each character requires 2 bytes of storage.
2. Each element of an array A[20][10] requires 2 bytes of storage. If the address of A[6][8] is 4000, find the
base address at A[0][0] when the array is stored row major wise.
3. A two dimensional array defined as x[3…6, -2…2] requires 2 bytes of storage space for each element. If
the array is stored in row major order, determine the address of X[5,1], given the base address as 1200.
4. Each element of an array X[-15…10,15…40] requires one byte od storage. If the array is stored in column
major order with the beginning location 1500, determine the location of X[5,20].
5. In an array of real numbers ARR[25][25], ARR[1][1] is stored in location 1000. Find the address of
ARR[12][12] when the array is stored row major wise. Assume each real number requires 4 bytes.
6. An array ARR[10][5] is stored in memory with each element requiring 2 bytes of storage. If the first
element ARR[0][0] is stored at the location 1250, calculate the location of ARR[5][6] when the array is
stored row major wise.
7. A square matrix A[m x m] is stored in the memory with each element requiring 2 bytes of storage. If the
base address A[1][1] is 1098 and the address at A[4][5] is 1144, determine the order of the matrix
A[mxm] when the matrix is stored column majorwise.
8. A matrix B[10][7] is stored in the memory with each element requiring 2 bytes of storage. If the Base
address at B[x][1] is 1012 and the address B[7][3] is 1060, determine the value x where the matrix is
stored in column major wise.
9. A square matrix M[][] of size 10 is stored in the memory with each element requiring 4 bytes of storage.
If the base address at M[0][0] is 1840, determine the address at M[4][8] when the matrix is stored in row
major wise.
10. For an array of real numbers x[-6…8, -12…. 20], find the address of x[5][4] , if x[1][1] is stored in location
100 in the column major order. Assume that each element requires 4 bytes.
Sequence of statements
for(int j=0;j<M;j++)
Sequence of statements
ii) How would the complexity change if the second loop went to N instead of M?
13. i)Define computational complexity. Calculate the complexity using Big ‘O’ notation for the following code
segment:-
for(int k=0;k<n;k++)
s+=k;
14. i)What is the worst case complexity of the following code segment
For(int x=1;x<=a;x++)
Statement;}
For(int y=1;y<=b;y++)
Statement;
ii) How would the complexity change if the second loop went to N instead of a,b,c?
Assignment No. 7
CONCEPT OF INHERITANCE
1. A library issues books on a rental basis at a 2% charge on the cost price of the book per day.
As per the rules of the library, a book can be retained for 7 days without any fine. If the book
is returned after 7 days, a fine will also be charged for the excess days as per the
1 to 5 2.00
6 to 10 3.00
Design a class Library and another class Compute to perform the task. The details of the
Member functions
Library(…) : parameterized constructor to assign values to data
members.
Member functions
Compute(…) : parameterized constructor to assign values to data
void display() : displays the book details along with the number of
calculated as:
Specify the class Library giving details of the constructors and void show(). Using the
concept of inheritance, specify the class Compute giving details of the constructor, void
fine() and the void display() function. You need not write the main function.
2. A super class Worker has been defined to store the details of a worker. Define a sub class
Wages to compute the monthly wages for the worker. The details of both the classes are
given below:
Specify the class Worker giving details of the constructor() and void display(). Using the
concept of inheritance, specify the class Wages giving details of the constructor(),
double overtime()and void display(). The main function need not be written.
3. A super class Record has been defined to store the names and ranks of 50 students.
Define a sub class Rank to find the highest rank along with the name. The details of both
classes are given below:
Member functions:
Record() : constructor to initialize data members
Member functions
Rank() : constructor to invoke the base class constructor and to
initialize index to 0.
void highest() : finds the index location of the topmost rank and stores
Specify the class Record giving details of the constructor(), void readvalues(), void
display(). Using the concept of inheritance, specify the class Rank giving details of
constructor(), void highest() and void display(). The main function and algorithm
need not be written.
4. A super class Record has been defined to store the names and ranks of 50 students.
Define a sub class Rank to find the highest rank along with the name. The details of both
classes are given below:
Member functions:
Record() : constructor to initialize data members
Member functions
Rank() : constructor to invoke the base class constructor and to
initialize index to 0.
void highest() : finds the index location of the topmost rank and stores
it in index without sorting the array
void display() : displays the name and ranks along with the name
Specify the class Record giving details of the constructor(), void readvalues(), void
display(). Using the concept of inheritance, specify the class Rank giving details of
constructor(), void highest() and void display(). The main function and algorithm
need not be written
5. A super class Perimeter has been defined to calculate the perimeter of a parallelogram.
Define a sub class Area to compute the area of the parallelogram by using the required
data members of the super class. The details are given below:
Member functions:
Perimeter(…) : parameterized constructor to assign values to data
Members
Member functions:
Area(…) : parameterized constructor to assign values to data
parallelogram.
Specify the class Perimeter giving details of the constructor(…), double Calculate() and
void show(). Using the concept of inheritance, specify the class Area giving details of
he constructor(…), void doarea() and void show(). The main function and algorithm
need not be written.
6. A super class Stock has been defined to store the details of the stock of a retail store.
Define a subclass Purchase to store the details of the items purchased with the new rate
and updates the stock. Some of the members of the classes are given below:
Member functions:
Stock(......) : parameterized constructor to assign values to the data
members
void display() : to display the stock details
Member functions
Purchase(.....) : parameterized constructor to assign values to the data
7.