Page 665 - Computer science 868 Class 12
P. 665
Say the state of selection switch S =1 and S =0 then output Y will be
0
1
Y = 0.1.A + 0.0.A + 1.1.A + 1.0..A
0 1 2 3
Or Y = 0 + 0 + A + 0
2
From the high signal produced in OR gate it is evident that A is selected in this example.
2
(b) Verify if the following proposition is a tautology or not [3]
(p ∨ q) ∧ (q ∨ r) → p ∨ r
Ans. p q r (p ∨ q) (q ∨ r) (p ∨ q) ∧ (q ∨ r) p ∨ r (p ∨ q) ∧ (q ∨ r) → p ∨ r
0 0 0 0 0 0 0 1
0 0 1 0 1 0 1 1
0 1 0 1 1 1 0 0
0 1 1 1 1 1 1 1
1 0 0 1 0 0 1 1
1 0 1 1 1 1 1 1
1 1 0 1 1 1 1 1
1 1 1 1 1 1 1 1
It is a contingency and not tautology.
(c) Verify (A ⊕ B) ⊕ C = A ⊕ (B ⊕ C) [2]
Ans. (A ⊕ B) ⊕ C = A ⊕ (B ⊕ C)
A B C (A ⊕ B) (A ⊕ B) C (B ⊕ C) A ⊕ (B ⊕ C)
0 0 0 0 0 0 0
0 0 1 0 1 1 1
0 1 0 1 1 1 1
0 1 1 1 0 0 0
1 0 0 1 1 0 1
1 0 1 1 0 1 0
1 1 0 0 0 1 0
1 1 1 0 1 0 1
Hence proved
SECTION – B
Answer any two questions.
Each program should be written in such a way that it clearly depicts the logic of the problem.
This can be achieved by using mnemonic names and comments in the program.
(Flowcharts and Algorithms are not required.)
The programs must be written in Java.
Question 6. [10]
Design a class Amicable to check if two given numbers are Amicable numbers or not. [Two numbers are amicable if sum of it’s
factors (excluding itself) of each is equal to the other number.]
Example: (220 and 284), (1184, 1210), (2626, 2924) etc.
The proper divisors of 220 are 1, 2, 4, 5, 10, 11, 20, 22, 44, 55 110 which add up to 284.
The proper divisors of 284 are 1, 2, 4, 71, 142, which sum up to 220.
Some of the members of the class are given below:
Class name : Amicable
Data members/instance variables
x, y : to store the numbers
1 : to store the length of the number
663
Sample Paper 663

