Jabalpur region study material computer science



Download 0.87 Mb.
Page5/7
Date conversion01.05.2018
Size0.87 Mb.
1   2   3   4   5   6   7

Table : COMPANY

ID


COMP

City

T001

HLL

Mumbai

T008

Colgate

Delhi

T003

HLL

Mumbai

T004

Paras

Haryana

T009

Ponds

Noida

T006

Wipro

Ahmedabad




  1. To display PNAME, PRICE * QTY only for the city Mumbai.

  2. To display product name, company name & price for those items which IDs are equal to the IDs of company.

  3. To delete the items produced before 2007.

  4. To increase the quantity by 20 for soap and paste.

  5. SELECT COUNT(*) FROM ITEMS WHERE ITEMS.ID=COMPANY.ID;

  6. SELECT PNAME FROM ITEMS WHERE PRICE=SELECT MIN(PRICE) FROM ITEMS;

  7. SELECT COUNT(*) FROM COMPANY WHERE COMP LIKE “P_ _ _ _”;

  8. SELECT PNAME FROM ITEMS WHERE QTY<100;

Ans : (i) SELECT PNAME, QTY*PRICE FROM ITEMS WHERE ITEMS.ID = COMPANY.ID AND COMPANY.City=’Mumbai’;

(ii) SELECT PNAME, COMP, PRICE FROM ITEMS, COMPANY WHERE ITEMS.ID = COMPANY.ID

(iii) DELETE FROM ITEMS WHERE MDATE < {01/01/2007};

(iv) UPDATE ITEMS SET QTY = QTY + 20 WHERE PNAME = ‘Soap’ OR PNAME = ‘Paste’;

(v) 4


(vi) Soap

(vii) 2


(viii) Paste

Deodorant


Boolean Algebra

Introduction to Boolean Algebra & Laws

Boolean Algebra Rules

1

0 + X = X

Properties of 0

2

0 . X = 0




3

1 + X = 1

Properties of 1

4

1 . X = X




5

X + X = X

Idempotence Law

6

X . X = X




7

(X) = X

Involution Law

8

X + X = 1

Complementarity Law

9


X . X = 0




10

X + Y = Y + X

Commutative Law

11

X .Y = Y. X




12

X + ( Y + Z ) = ( X + Y ) + Z

Associative Law

13

X (YZ) = (XY) Z




14

X (Y + Z) = XY + XZ

Distributive Law

15

X + YZ = (X + Y) (X + Z)




16

X + XY = X

Absorption Law

17

X . (X + Y) = X




18

X + X Y = X +Y

Third Distributive Law

19

(X + Y)  = X . Y

DeMorgan’s Theorem

20

(X.Y)  = X + Y




Short Answer Questions ( 2 marks)
Q1. State and verify Demorgan's Laws algebraically.

Ans : Demorgan's Laws are : (i) (X+Y)' = X'.Y' (i) (X.Y)' = X' + Y'

Verification


(X+Y)'.(X+Y) = X'.Y'.(X+Y)

0 = X'.Y'.X + X'.Y'.Y

0 = X'.X .Y'+ X'.0

0 = 0 .Y'+ 0

0 = 0 + 0

0 = 0


L.H.S = R.H.S


(X.Y)' + (X.Y) = (X' + Y') + (X.Y)

1 = (X' + Y' + X). (X' + Y' + Y)

1 = (X' + X + Y') . (X' + 1)

1 = (1 + Y') . 1

1 = 1 . 1

1 = 1


L.H.S = R.H.S

Q2. State and algebraically verify Absorption Laws.

Ans : Absorption Laws are : (i) X+X.Y = X (ii) X . (X + Y) = X

V
L.H.S = X + X . Y

= X.1 + X.Y

= X.(1 + Y)

= X.1

=X

= R.H.S



L.H.S = X . ( X + Y )

= X.X + X.Y = X + X.Y

= X.(1 + Y)

= X.1


=X

= R.H.S

erification:

Q3. State Distributive Laws. Write the dual of : X + X Y = X + Y

Ans : Distributive laws are : (i) X . ( Y + Z ) = X.Y + X.Z (ii) X + Y.Z = (X + Y).(X + Z)

The dual form of X + X Y = X + Y is X . ( X + Y ) = X . Y

Q4. State any one form of Associative law and verify it using truth table.

Ans : Associative law states that : (i) X + (Y + Z) = (X + Y) + Z (ii) X.(Y.Z) = (X.Y).Z

Verification of X + (Y + Z) = (X + Y) + Z using truth table


X

Y

Z

Y + Z

X + Y

X + (Y + Z)

(X + Y) + Z

0

0

0

0

0

0

0

0

0

1

1

0

1

1

0

1

0

1

1

1

1

0

1

1

1

1

1

1

1

0

0

0

1

1

1

1

0

1

1

1

1


1

1

1

0

1

1

1

1

1

1

1

1

1

1

1

Q5. State the principle of duality in boolean algebra and give the dual of the following:

X.Y.Z + X.Y.Z + X.Y.Z

Ans : Principle of duality states that from every boolean relation, another boolean relation can be derived by : (i) changing each OR (+) sign to an AND (.) sign

(ii) changing each AND (.) sign to an OR (+) sign

(iii) replacing each 1 by 0 and each 0 by 1.

The dual form of X.Y.Z + X.Y.Z + X.Y.Z is (X+Y+Z) . (X+Y+Z) . (X+Y+Z)

Q6. Explain about tautology and fallacy.

Ans : If result of any logical statement or expression is always TRUE or 1, it is called tautology.



If result of any logical statement or expression is always FALSE or 0, it is called fallacy. For example, 1 + X = 1 is a tautology and 0 . X = 0 is a fallacy.
SOP & POS

Very Short Answer Questions ( 1 Mark)
Q1. Write the POS form of a Boolean function F, which is represented in a truth table as follows:

U


V

W

F
Note: In POS, consider only the cases those containing 0 in F column. For the same rows, write sum of the logical variables (Ex. U i.e. 0 in U column, U' i.e. 1 for U column). Then write the product form of all such sum of logical terms.


0

0

0

1

0

0

1

0

0

1

0

1

0

1

1

0

1

0

0

1

1

0

1

0

1

1

0

1

1

1

1

1

Ans : F(U,V,W) = ( U + V + W' ).( U + V' +W' ).( U' + V + W' )

Q2. Write the SOP form of a Boolean function G, which is represented in a truth table as follows:


X

Y

Z

G
Note: In SOP, consider only the cases those containing 1 in G column. For the same rows, write product of the logical variables (Ex. X' i.e. 0 in X column, X i.e. 1 for X column). Then write the sum form of all such product of logical terms.


0

0

0

0

0

0

1

1

0

1

0

1

0

1

1

0

1

0

0

0

1

0

1

1

1

1

0

1

1

1

1

0

Ans : G(X,Y,Z) = ( X' . Y' . Z ) + ( X' . Y .Z' ) + ( X . Y' . Z ) + ( X . Y . Z' )

Q3. Convert the following function into canonical SOP form.

F( A , B, C, D ) =  ( 1, 4, 6, 8, 11, 13)

Ans : F( A , B, C, D ) = A' B' C' D + A' B C' D' + A' B C D' + A B' C' D' + A B' C D + A B C' D

(Note : Here 1 = 0001  A' B' C' D , 4 = 0100  A' B C' D' , 13 = 1101 A B C' D ...)


Q4. Convert the following function into canonical SOP form.

F( A , B, C, D ) =  ( 0, 3, 7, 9, 10, 14)

Ans : F( A , B, C, D ) = (A+ B+C+D) . (A+B+C'+D') . (A+B'+C'+D') . (A'+B+C+D') . (A'+B+C'+D) . (A'+B'+C'+D)

(Note : Here 0 = 0000  A+ B+C+D , 3 = 0011  A+B+C'+D', 10 = 1010 A'+B+C'+D...)


Q5. Convert the following function to its equivalent SOP shorthand notation.

F( A , B, C, D ) =  ( 0, 3, 7, 9, 10, 14)

Ans : The equivalent SOP shorthand notation of F( A , B, C, D ) =  ( 0, 3, 7, 9, 10, 14) is

F( A , B, C, D ) =  ( 1, 2, 4, 5, 6, 8, 11, 12, 13, 15)


Q6. Convert the following function to its equivalent POS shorthand notation.

F( A , B, C, D ) =  ( 1, 4, 6, 8, 11, 13)

Ans : The equivalent POS shorthand notation of F( A , B, C, D ) =  ( 1, 4, 6, 8, 11, 13) is

F( A , B, C, D ) =  ( 0, 2, 3, 5, 7, 9, 10, 12, 14, 15)


Karnaugh Map

Short Answer Questions ( 3 marks)
Q1. Reduce the following Boolean Expression using K-Map:

F( A, B, C, D ) =  ( 0, 2, 3, 4, 6, 7, 8, 9, 10, 12, 13, 14 )

A

CD

AB C'D' C'D CD CD'

1

0



1

1

3



1

2

1

4


5

1

7



1

6

1

12



1

13


15

1

14



1

8

1

9


11

1

10




ns :



A'B'


A'B



AB

AB'


There are 1 octet, 2 quads after eliminating the redundant groups.

Octet (m0, m2, m4, m6, m8, m10, m12, m14) reduces to D'

Quad (m2, m3, m6, m7) reduces to A'C

Quad ( m8, m9, m12, m13) reduces to AC '

Hence, F( A, B, C, D ) = D' + A'C + AC '

Q2. Reduce the following Boolean Expression using K-Map:

F( A, B, C, D ) =  ( 0, 3, 5, 6, 7, 8, 11, 15 )

A

C+D

A+B C+D C+D' C'+D' C'+D


0

0



1

0

3


2


4

0

5



0

7

0

6


12


13

0

15


14

0

8


9

0

11


10




ns :



A+B


A+B'


A'+B'

A'+B

There are 1 quad and 3 pairs after eliminating the redundant groups.

Quad (M3, M7, M11, M15) reduces to C' + D'

Pair ( M5, M7) reduces to A + B ' + D'

Pair ( M6, M7) reduces to A + B ' + C'

Pair ( M0, M8) reduces to B + C + D

Hence, F( A, B, C, D ) = (C' + D') . (A + B ' + D') . (A + B ' + C') . (B + C + D)

Q3. Reduce the following Boolean Expression using K-Map:

F( A, B, C, D ) =  ( 2, 3, 4, 5, 10, 11, 13, 14, 15 )

A
CD

AB C'D' C'D CD CD'



0


1

1

3



1

2

1

4



1

5


7


6


12

1

13



1

15

1

14


8


9

1

11



1

10




1   2   3   4   5   6   7


The database is protected by copyright ©hestories.info 2019
send message

    Main page