Oswal 36 Sample Question Papers ISC Class 12 Computer Science Solutions
PART-I
Answer 1.
(i) (d) X+Y
(ii) (a) Both Assertion and Reason are true, and Reason is the correct explanation for Assertion.
(iii) (c) P+Q+R
(iv) (a) a tautology
A+A′ = 1 and that is a tautology
(v) (d) A′+B+C+D
In maxterm 0 represents the literal itself and 1 represents the complement of the literal.
(vi) (a) Both Assertion and Reason are true, and Reason is the correct explanation for Assertion.
(vii) A statement block is used to organize a sequence of statements as a single statement group.
(viii) False. Java does not allow array overruns at run time.
(ix)
- Reusability
- Transitive nature
(x) “Overflow” means attempt to INSERT when the list is full and no free space is available.
Answer 2.
(i) F = (A + B ′) . (B + CD) ′
$$=(\text{A + B'}).(\overline{\text{B +CD}})\\= (\text{A +} \overline{\text{B}}).\lbrack\overline{\text{B}}.\overline{\text{CD}}\rbrack\\\text{(using De Morgan’s Law)}\\=(\text{A +}\bar{\text{B}})\lbrack\overline{\text{B}}.(\overline{\text{C}} + \overline{\text{D}})\rbrack\\=(\text{A+}\overline{\text{B}})(\overline{\text{B}}.\overline{\text{C}}) + (\overline{\text{B}}.\overline{\text{D}})\\\text{(using Distributive Law)}\\=\text{A}.\bar{\text{B}}.\bar{\text{C}} + \text{A}.\bar{\text{B}}.\bar{\text{D}} +\\ \bar{\text{B}}.\bar{\text{B}}.\bar{\text{C}} +\bar{\text{B}}.\bar{\text{B}}.\bar{\text{D}}\\= \text{A} .\bar{\text{B}}.\bar{\text{C}} + \text{A}.\bar{\text{B}}.\bar{\text{D}} +\bar{\text{B}}.\bar{\text{C}}+ \bar{\text{B}}.\bar{\text{D}}\\=\bar{\text{B}}.\bar{\text{C}}(\text{A +1}) + \bar{\text{B}}.\bar{\text{D}}(\text{A+1})\\= \bar{\text{B}}.\bar{\text{C}} + \bar{\text{B}}.\bar{\text{D}}\\=\bar{\text{B}}(\bar{\text{C}} + \bar{\text{D}})$$
(ii) BA = 1012, ES = 2, R = 10, I = 7, J = 3, LR = X, LC = 1
Address of B [I, J] = BA + ES [(I – LR) + R (J – LC)]
B [7, 3] = 1012 + 2 [(7 – X) + 10 (3 – 1)]
1060 = 1012 + 2 [(7 – X) + 10 (2)]
1060 = 1012 + 2 [(7 – X) + 20)]
1060 – 1012 = 2 [(7 – X) + 20)]
48 = 2 [(7 – X) + 20)]
(7 – X) = 48/2 – 20
7 – X = 4
X = 7 – 4 = 3.
(iii) (a) What does the method recursive (86, 1) return?
count=0
recursive(86,1) → 8*6=48, count=1
recursive(48,1) → 4*8=32, count=2
recursive(32,1) → 3*2=6, count=2
return 2
(b) What does the method recursive (341, 1) return?
count=0
recursive(341,1) → 3*4*2=24, count=1
recursive(24,1) → 2*4=8, count 1
return 1
(iv) 1. mul*=m%10;
2. m==0
3. mul=1;
4. count++;
PART-II
Section-A
Answer 3.
(i) Truth table for the inputs and outputs :
S | P | C | T | X | |
0 | 0 | 0 | 0 | 0 | 0 |
0 | 0 | 0 | 1 | 1 | 1 |
0 | 0 | 1 | 0 | 0 | 2 |
0 | 0 | 1 | 1 | 1 | 3 |
0 | 1 | 0 | 0 | 1 | 4 |
0 | 1 | 0 | 1 | 1 | 5 |
0 | 1 | 1 | 0 | 1 | 6 |
0 | 1 | 1 | 1 | 1 | 7 |
1 | 0 | 0 | 0 | 0 | 8 |
1 | 0 | 0 | 1 | 0 | 9 |
1 | 0 | 1 | 0 | 1 | 10 |
1 | 0 | 1 | 1 | 1 | 11 |
1 | 1 | 0 | 0 | 1 | 12 |
1 | 1 | 0 | 1 | 1 | 13 |
1 | 1 | 1 | 0 | 1 | 14 |
1 | 1 | 1 | 1 | 1 | 15 |
X (S, P, C, T) = Σ (1, 3, 4, 5, 6, 7, 10, 11, 12, 13, 14, 15)
$$\bar{\text{S}}\bar{\text{P}}\bar{\text{C}}\text{T} + \bar{\text{S}}\bar{\text{P}}\text{CT +} \bar{\text{S}}\text{P}\bar{\text{C}}\bar{\text{T}} +\bar{\text{S}}\text{P}\bar{\text{C}}\text{T} +\\\bar{\text{S}}\text{P}\text{C}\bar{\text{T}} +\bar{\text{S}}\text{PCT}+ \text{S}\bar{\text{P}}\text{C}\bar{\text{T}} +\text{S}\bar{\text{P}}\text{C}\text{T} +\\\text{SP}\bar{\text{C}}\bar{\text{T}} +\text{SP}\bar{\text{C}}\text{T} + \text{SPC}\bar{\text{T}} + \text{SPCT}$$
(ii) (a) Gate 1 = (A.B)′ = A′ +B′
Gate 2 = (B′.C)′ = B+C′
Gate 3 = (A.B)′+(B′.C)′ OR (A′+B′)+(B+C′) = 1
Gate 4 = ((A.B)′+(B′.C)′)′ = (A.B)′′.(B′.C)′′ = A.B.B′.C = 0
(b) Σ( 0, 2, 7, 6)
$$ =\overline{\Sigma(1,3,4,5)}$$
= Π(1, 3, 4, 5)
Answer 4.
(i) (a) F (A, B, C, D) = Σ (4, 6, 7, 10, 11, 12, 14, 15)
Quad 1 = m6 + m7 + m14 + m15 = BC
Quad 2 = m10 + m11 + m14 + m15 = AC
$$\text{Quad 3 = }m4 + m6 + m12 + m14 =\text{B}\bar{\text{D}}$$
(b) So the expession is:
(ii) X (S,P,C,T) = Σ(1,3,4,5,6,7,10,11,12,13,14,15)
C′.T′ | C′.T | C.T | C.T′ | |
S′.P′ | 1 | 1 | ||
S′.P | 1 | 1 | 1 | 1 |
S.P | 1 | 1 | 1 | 1 |
S.P′ | 1 | 1 |
Octet(m4,m5,m7,m6,m12,m13,15,m14) = P
Quad1(m1,m3,m5,m7) = S′.T
Quad2(m15,m14,m11,m10) = S.C
X (S,P,C,T) = P + S′.T +S.C
Answer 5.
(i) Decimal to binary encoder is used to convert decimal numbers into its equivalent binary form.
F3 | F2 | F1 | F0 | |
0 | 0 | 0 | 0 | 0 |
1 | 0 | 0 | 0 | 1 |
2 | 0 | 0 | 1 | 0 |
3 | 0 | 0 | 1 | 1 |
4 | 0 | 1 | 0 | 0 |
5 | 0 | 1 | 0 | 1 |
6 | 0 | 1 | 1 | 0 |
7 | 0 | 1 | 1 | 1 |
8 | 1 | 0 | 0 | 0 |
9 | 1 | 0 | 0 | 1 |
$$\text{(ii)\space} \text{A}⊕\text{B} = \text{A}\bar{\text{B}} + \bar{\text{A}}.\text{B}\space\text{A}⊙\text{B}\\=\overline{\text{A}⊙\text{B}}$$
A | B | C | A ⊕ B ⊕ C | A ⊙ B ⊙ C | A ⊙ B ⊙ C |
0 | 0 | 0 | 0 | 1 | 0 |
0 | 0 | 1 | 1 | 0 | 1 |
0 | 1 | 0 | 1 | 0 | 1 |
0 | 1 | 1 | 0 | 1 | 0 |
1 | 0 | 0 | 1 | 0 | 1 |
1 | 0 | 1 | 0 | 1 | 0 |
1 | 1 | 0 | 0 | 1 | 0 |
1 | 1 | 1 | 1 | 0 | 1 |
(iii)
Proposition | wff |
A proposition is an elementary atomic sentence that returns either true or false. | wff’s are well formed formula which is a proposition that is satisfiable or valid. |
Section-B
import java.util.*;
public class Emirp
{
int n, rev, f;
Emirp(int nn)
{
n = nn;
rev = 0;
f = 2;
}
int isprime(int x)
{
if(n = = x) return 1;
else if(n % x = = 0 || n = = 1)
return 0;
else
return isprime(x + 1);
}
void isEmirp()
{
int x = n;
while(x != 0)
{
rev = rev * 10 + x % 10; x = x / 10;
}
int ans1 = isprime(f);
n = rev;
f = 2;
int ans2 = isprime(f);
if(ans1 = = 1 && ans2 = = 1)
System.out.println(n+“ is an Emirp no.”);
else
System.out.println(n+“is not an Emirp no.”);
}
public static void main()
{
Scanner sc = new Scanner System.in);
System.out.println(“Enter a no.”);
int x = sc.nextInt();
Emirp obj = new Emirp(x);
Obj.isEmirp();
}
}
Answer 7.
import java.util.*;
public class Exchange
{
String sent, rev;
int size;
Exchange()
{
sent = “”;
rev = “”;
}
void readSentence()
{
Scanner sc = new Scanner(System.in);
System.out.println(“Enter a string”);
sent = sc.nextLine();
size = sent.length();
}
void exfirstlast()
{
int p = 0;
char ch;
String b;
for (int i = 0; i < size; i++)
{
ch = sent.charAt(i);
if(ch = = ‘ ’ || ch = = ‘.’)
{
b = sent.substring(p, i);
if(b.length() != 1)
{
rev += b.charAt(b.length() – 1);
rev += b.substring (1, b.length() – 1);
rev += b.charAt(0);
}
else { rev += b; rev = rev + “ ”; }
}
}
}
void display()
{
System.out.println(“\nInput :” +sent);
System.out.println(“\nOutput :” +rev);
}
public static void main()
{
Exchange ob = new Exchange();
obj.readSentence();
obj.exfirstlast();
obj.display();
}
}
Answer 8.
import java.util.*;
class MatrixSum
{
int matA[][];
int matB[][];
int m, n;
MatrixSum(int mm , int nn)
{
m =mm;
n =nn;
matA=new int [m][n];
matB=new int [m][n];
}
void input()
{
Scanner sc=new Scanner(System.in);
for(int i=0;i<m;i++)
for(int j=0;j<n;j++)
{
System.out.println(“Enter the value for matA”);
matA[i][j]=sc.nextInt();
System.out.println(“Enter the value for matB”);
matB[i][j]=sc.nextInt();
}
}
void sum()
{
for(int i=0; i<m; i++)
{
for(int j =0; j<n; j++)
{
System.out.print((matA[i][j]+matB[i][j])+”\t”);
}
System.out.println( );
}
}
public static void main(String ar[])
{
MatSum ob=new MatSum(3,4);
ob.input();
ob.sum();
}
}
Section-C
Answer 9.
(i) class Link
{
int lnk[]=new int[100];
int begin,end,max;
public Link(int mm)
{
max=mm;
begin=end=0;
}
void addlink(int v)
{
if(end= =0)
{
end=begin=1;
lnk[end]=v;
}
else if(end= =max)
{
System.out.println(‘List is Full’);
}
else
{
lnk[++end]=v;
}
}
int dellink()
{
int a;
if(begin= =0)
{
System.out.println(“Empty...”);
return(-99);
}
else if(begin= =end)
{
a=lnk[begin];
begin=end=0;
return a;
}
else
{
a=lnk[begin];
begin++;
return(a);
}
}
void display()
{
int i;
for(i=begin;i<=end;i++)
{
System.out.println(lnk[i]);
}
}
}
}
(ii) It is a queue.
Answer 10.
class Stock
{
protected String item;
protected int qty;
protected double rate, amt;
public Stock(String it, int q, double r)
{
item = it;
qty = q;
rate = r;
amt = qty * rate;
}
public void display()
{
System.out.println(item + “ “ + qty + “ “ + rate + “ “ + amt);
}
class Purchase extends Stock
{
int pqty;
double prate;
public Purchase(String it1, int q1, double r1, double pr, int pq)
{
super(it1, q1, r1);
pqty = pq;
prate = pr;
}
void update()
{
qty += pqty;
if(rate != prate)
{
rate = prate;
}
amt = qty * rate;
}
public void display()
{
System.out.println(“Details Before Updation “);
super.display();
System.out.println(“Details After Updation “);
update();
super.display();
}
}
}
Answer 11.
(i) The dominant term is the term that grows the fastest. For example, n² grows faster than n, so if we have something like g(n) = n² + 5n + 6, it will be big O(n²).
(ii) (a) D, E, G
(b) C
(c) B, D, C, E, A, F, G
Please Click on Download Now