Q. 7. Suppose P, Q and R contain 5, 10 and 15 respectively. Find the value of each of the following logical expressions: (June 2000)
(i) 2 * P .EQ. Q .AND. Q .LE. R
(ii) .NOT. (5 .EQ. P - 2 .AND. Q .LE. R)
(iii) .NOT. P .GT. Q .OR. R .LT. 5

Solution. Given, P = 5, Q = 10 and R = 15
(i) 2 * P .EQ. Q .AND. Q .LE. R
= 2 * 5 .EQ. 10 .AND. 10 .LE. 15
= 10 .EQ. 10 .AND. 10 .LE. 15
= T .AND. T
= T

(ii) .NOT. (5 .EQ. P - 2 .AND. Q .LE. R)
= .NOT. (5 .EQ. 5 - 2 .AND. 10 .LE. 15)
= .NOT. (5 .EQ. 3 .AND. 10 .LE. 15)
= .NOT. (F .AND. T)
= .NOT. (F)
= T

(iii) .NOT. P .GT. Q .OR. R .LT. 5
= .NOT. 5 .GT. 10 .OR. 15 .LT. 5
= .NOT. F .OR. F
= T .OR. F
= T

Q. 8. Suppose at some values of variables A, B and C are 2, 3 and 4 respectively. Find the value of L after each pair of statements: (Dec. 99)
(i) A = A + A * C * * 2 + B
L = A + A * C * * 2 + B
(ii) A = ABS (A - C * B)/5
L = ABS (A - C * B)/5

Solution.
(i) A = A + A * C * * 2 + B
or A = 2 + 2 * 4 * * 2 + 3
or A = 2 + 2 X (4)2 + 3
or A = 2 + 32 + 3
or A = 37
L = A + A * C * * 2 + B
or L = 37 + 37 * 4 * * 2 + 3
or L = 632

(ii) A = ABS (A - C * B)/5
or A = ABS (2 - 4 * 3)/5
or A = | -10 |/5
or A = 10/5
or A = 2
L = ABS (A - C * B)/5
or L = ABS (2 - 4 * 3)/5
or L = 10/5
or L = 2



Main Contents Page

© Universal Teacher Publications