(b) (i) F(A, B, C, D) = π(3, 4, 5, 6, 7, 10, 11, 14, 15)

Reduced Expression is (A + B’).(C’ + D’).(B’ + C’).(A’ + C’)
(ii) (A + B’).(C’ + D’).(B’ + C’).(A’ + C)
Logic Gate

Question 5.
(a) A training institute intends to give scholarships to its students as per the criteria given below: [5] The student has excellent academic record but is financially weak.
OR
The student does not have an excellent academic record and belongs to a backward class.
OR
The student does not have an excellent academic record and is physically impaired.
The inputs are:

(In all the above cases 1 indicates Yes and 0 indicates No).
Output: X [1 indicates Yes, 0 indicates No for all cases] Draw the truth table for the inputs and outputs given above and write the SOP expression for X(A, F, C, I).
(b) Using the truth table, state whether the following proposition is a tautology, contingency or a contradiction: [3|
~(A∧B)∨(~A=>B)
(c) Simplify the following expression, using Boolean laws: [2]
A.(A’ + B).C.(A + B)

From the last column, all the values are neither all 1 ‘s nor 0’s.
It is the case of neither tautology nor contraction.
It is a contingency.

(c) A.(A’+B).C.(A + B)
= (AA’ + AB).C.(AA + AB)
= (0 + AB).C.(A + AB) (∵ AA’ = 0)
= (AB).C.(A + AB) (∵ A + AB = A)
= AB.CA
= AA.BC (∵ A.A = A)
= A.B.C

Question 6.
(a) What is an Encoder? Draw the Encoder circuit to convert A-F hexadecimal numbers to binary. State an application of a Multiplexer. [5] (b) Differentiate between Half Adder and Full Adder. Draw the logic circuit diagram for a Full Adder. [3] (c) Using only NAND gates, draw the logic circuit diagram for A’ + B. [2] Answer 6:
(a) An Encoder is a combinational circuit that performs the reverse operation of Decoder. It has maximum of 2An input lines and ‘n’ output lines, hence it encodes the information from 2An inputs into an n-bit code. It will produce a binary code equivalent to the input, which is active High. Therefore, the encoder encodes 2An input lines with ‘n’ bits.

Application of a multiplexer:
The multiplexer is used to perform high-speed switching in networking.

(b) The major difference between Half Adder and Full Adder is that Half Adder adds two 1-bit numbers given as input but do not add the carry obtained from previous addition while the Full Adder, along with two 1-bit numbers can also add the carry obtained from the previous Addition.

(c) A’ + B = ((A’ + B)’)’
= ((A’)’ + B’)’
= (A + B’)’

Section – B

### ISC Computer Science 2018 Class-12 Previous Year Question Paper Solved

• 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 7.
Design a class Perfect to check if a given number is a perfect number or not. [A number is said to be perfect if sum of the factors of the number excluding itself is equal to the original number] Example: 6 = 1 + 2 + 3 (where 1, 2 and 3 are factors of 6, excluding itself) [10] Some of the members of the class are given below:
Class name: Perfect
Data members/instance variables:
num: to store the number
Methods/Member functions:
Perfect (int nn): parameterized constructor to initialize the data member num=nn
int sum_of_factors(int i): returns the sum of the factors of the number(num), excluding itself, using a recursive technique
void check(): checks whether the given number is perfect by invoking the function sum_of_factors() and displays the result with an appropriate message
Specify the class Perfect giving details of the constructor(), int sum_of_factors(int) and void check(). Define a main() function to create an object and call the functions accordingly to enable the task.

```import java.io.*;
import java.util.Scanner;
class Perfect{
private int num;
private int f;
public Perfect(int num) {
this.num = num;
f = 1;
}
public int sumofFactors(int i) {
if(i==f){
return 0;
}
elseif(i%f==0)
return f++ + sumOfFactors(i);
else{
f++;
return sumOfFactors(i);
}
}
public void check() {
if(num==sumOfFactors(num))
System.out.println(nxun + “ is a Perfect Number”);
else
System.out.println(num + “ is not a Perfect Number”);
}
public static void main(String args[ ])throws IOException {
Scanner sc = new Scanner(System.in);
System.out.print(“Enter the number:”);
int n = sc.nextInt();
Perfect obj = new Perfect(n);
obj.check();
}
}```

Question 8.
Two matrices are said to be equal if they have the same dimension and their corresponding elements are equal. [10] For example, the two matrices A and B is given below are equal:

Design a class EqMat to check if two matrices are equal or not. Assume that the two matrices have the same dimension.
Some of the members of the class are given below :
Class name: EqMat
Data members/instance variables:
a[][] : to store integer elements
m: to store the number of rows
n: to store the number of columns
Member functions/methods:
EqMat: parameterized constructor to initialise the data members m = mm and n = nn
void readArray(): to enter elements in the array
int check(EqMat P, EqMat Q): checks if the parameterized objects P and Q are equal and returns 1 if true, otherwise returns 0
void print(): displays the array elements
Define the class EqMat giving details of the constructor ), void readarray( ), int check(EqMat, EqMat) and void print( ). Define the main( ) function to create objects and call the functions accordingly to enable the task.

```import java.io.*;
import java.util.Scanner;
class EqMat{
private int a[][];
private static int m;
private static int n;
public EqMat(int mm, int nn) {
m = mm;
n = nn;
a = newint[m][n];
}
public void readArray( )throws IOException {
Scanner sc = new Scanner(System.in);
for(int i = 0; i < m; i++) {
for(int j = 0; j < n; j++) {
a[i][j] = sc.nextInt();
}
}
}
public static boolean check(EqMat p, EqMat q) {
boolean flag = true;
for(int i = 0; i < m; i++) {
for(int j = 0; j < n; j++) {
if(p.a[i][j] !=q.a[i][j])
return false;
}
}
return flag;
}
public void print() {
for(int i = 0; i < m; i++) {
for(int j = 0; j < n; j++) {
System.out.print(a[i] [j] + “\t”);
}
System.out.println();
}
}
public static void main(String args[ ]) throws IOException {
Scanner sc = new Scanner(System.in);
System.out.print(“Number of rows: ”);
int rows = sc.nextInt();
System.out.print(“Number of columns: ”);
int columns = sc.nextInt();
EqMat obj 1 = new EqMat(rows, columns);
EqMat obj2 = new EqMat(rows, columns);
System.out.println(“Enter elements for first matrix:”);
System.out.println(“Enter elements for second matrix:”);
System. out.println(“First Matrix:”);
obj1.print();
System.out.println(“Second Matrix:”);
obj2.print();
if(check(obj1, obj2))
System.out.println(“Both Matrices are Equal”);
else
System.out.println(“Matrices are not Equal”);
}
}```

Question 9.
A class Capital has been defined to check whether a sentence has words beginning with a capital letter or not. [10] Some of the members of the class are given below:
Class name: Capital
Data member/instance variable:
sent: to store a sentence
freq: stores the frequency of words beginning with a capital letter
Member functions/methods:
Capital () : default constructor
void input (): to accept the sentence
boolean isCap(String w): checks and returns true if the word begins with a capital letter, otherwise returns false
void display(): displays the sentence along with the frequency of the words beginning with a capital letter
Specify the class Capital, giving the details of the constructor( ), void input( ), boolean isCap(String) and void display( ). Define the main( ) function to create an object and call the functions accordingly to enable the task.

```import java.io.*;
import java.util. Scanner;
import java.util.StringTokenizer;
public class Capital{
private String sent;
private int freq;
public Capital() {
sent = new String();
freq = 0;
}
public void input() throws IOException {
Scanner sc = new Scanner(System.in);
System.out.print(“Enter the sentence: ”);
sent = sc.next();
}
boolean isCap(String w) {
char ch = w.charAt(0);
if(Character.isLetter(ch) && Character.isUpperCase(ch))
return true;
return false;
}
public void display() {
StringTokenizer st = new StringTokenizer(sent, "" , ?!");
int count = st.countTokens();
forint i = 1; i<= count; i++) {
String word = st.nextToken();
if(isCap(word))
freq++;
}
System.out.println(“Sentence: ” + sent);
System.out.println(“Frequency: ” + freq);
}
public static void main(String args[ ])throws IOException {
Capital obj = new Capital();
obj.input();
obj.display();```

Read Next 👇 Click on Page Number Given Below 👇