Q. 4. Suppose J, K and L contain
10, 20 and 30 respectively. Find the value of each
of the following logical expressions: (June
2001)
(i) .NOT. (5 .EQ. J - 5 .AND. 2 * K .EQ. J + L)
(ii) 2 * J .EQ. K .AND. K .LE. L
Solution. Given, J = 10, K =
20 and L = 30
(i) .NOT. (5 .EQ. J - 5 .AND. 2 * K .EQ. J
+ L)
= .NOT. (5 .EQ. 10 - 5 .AND. 2 * 20 .EQ. 10 + 30)
= .NOT. (5 .EQ. 5 .AND. 40 .EQ. 40)
= .NOT. (T .AND. T)
= .NOT. (T)
= F
(ii) 2 * J .EQ. K .AND. K .LE.
L
= 2 * 10 .EQ. 20 .AND. 20 .LE. 30
= 20 .EQ. 20 .AND. 20 .LE. 30
= T .AND. T
= T
Q. 5. Find the value of each of the
following FORTRAN expressions: (Dec.
2000)
(i) A * * B * * C * D
Where A, B, C and D are integers with values A = 2,
B = 3, C = 2, D = 2
(ii) 17 + 3 .LT. 12 .OR. 7 .GT. 9
(iii) '332' // '+148'
Solution.
(i) A * * B * * C * D
= 2 * * 3 * * 2 * 2
= (29) X 2
= 512 X 2
= 1024
(ii) 17 + 3 .LT. 12 .OR. 7 .GT.
9
= 20 .LT. 12 .OR. 7 .GT. 9
= F .OR. F
= F
(iii) '332' // '+148'
= 332 + 148
= 480
Q. 6. Suppose J, K and L contain
10, 20 and 30 respectively. Find the value of each
of the following logical expressions: (Jan.
2001)
(i) .NOT. J .GT. K .OR. L .LT. 5
(ii) K .EQ. 10 .AND. .NOT. J .LT. L - 15
Solution. Given, J = 10, K =
20 and L = 30
(i) .NOT. J .GT. K .OR. L .LT. 5
= .NOT. 10 .GT. 20 .OR. 30 .LT. 5
= .NOT. F .OR. F
= T .OR. F
= T
(ii) K .EQ. 10 .AND. .NOT. J
.LT. L - 15
= 20 .EQ. 10 .AND. .NOT. 10 .LT. 30 - 15
= F .AND. .NOT. T
= F .AND. F
= F
|