# Oswal 36 Sample Question Papers ISC Class 12 Computer Science Solutions

## Section-A

• (i) (a) George Boole
• (ii) (a) 2

(iii) (c) dr.substring(0,4)+”.”+dr.substring(11)

Explanation :

substring(0,4) returns characters from index 0 to 3 that is “Dr.” and substring(11) returns characters from index 11 to the end that is “Chatterjee”.

(iv) (b) Inner loop

Explanation :

In bubble sort the largest element is pushed towards the end in each pass, hence the inner loops becomes smaller after every pass.

• (v) (c) Boolean
• (vi) When a labeled break is executed, execution resumes at the end of the labeled block.
• (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) 1. Reusability
• 2. Transitive nature
• (x) “Overflow” means attempt to INSERT when the list is full and no free space is available.

$$\text{(i)}\space F = (A + B^′) . (B + CD)^′\\\qquad= (A + \bar{B}) . (\overline{B + CD})\\\qquad= (A + \bar{B}) [\bar{B} . \overline{CD}]\space\space\space\text{(using De Morgan’s Law)}\\\qquad= (A + \bar{B}) [\bar{B} . (\bar{C} + \bar{D})]\\\qquad= (A + \bar{B}) (\bar{B} . \bar{C}) + (\bar{B} . \bar{D})\space\space\text{(using Distributive Law)}\\\qquad =A . \bar{B}. \bar{C} + A. \bar{B}. \bar{D} + \bar{B} . \bar{B} . \bar{C} + \bar{B} . \bar{B} . \bar{D}\\\qquad= A . \bar{B} . \bar{C} + A . \bar{B} . \bar{D} + \bar{B} . \bar{C} + \bar{B} . \bar{D}\\\qquad= \bar{B} . \bar{C} (A + 1) + \bar{B} . \bar{D} (A + 1)\\\qquad= \bar{B} . \bar{C} + \bar{B} . \bar{D}\\= \bar{B} (\bar{C} + \bar{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) S C R O L L
• L C R O L S
• L L R O C S
• L L O R C S
• (b) It reverses the part of a string from the specified location.
• (iv) (a) When n if-condition k n i
• 6 true 1 6 3
• In loop
 n i condition k = 1 6 3 true 1 × 6 × 3 = 18 5 2 true 18 × 5 × 2 = 180 4 1 true 180 × 4 × 1 = 720 3 0 false

= 720

• (b) It is computing, factorial of n.

## Section-A

• (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
• Quad 3 = m4 + m6 + m12 + m14 = BD
• (b) So the expession is:
• (ii) (a) F (P, Q, R, S) = π (0, 5, 7, 8, 10, 12, 13, 14, 15)

$$\text{Quad} 1 = \text{m}5 .\space\text{m}7 .\space \text{m}13 . \space\text{m}15 = \bar{\text{Q}} + \bar{\text{S}}\\\qquad \text{Quad 2} = \text{m8 . m10 . m12 . m14} = \bar{\text{P}} + \text{S}\\\text{Pair 1 = m0 . m8}\\\text{= Q + R + S}\\= (\bar{\text{P}} + \text{S}) . (\bar{\text{Q}} + \bar{\text{S}} ) . (\text{Q + R + S})$$

• (b) Logic gate diagram for the reduced expression using AND and OR gates :

(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 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)\\\space \bar S \bar P \bar C T + \bar S \bar P C T + \bar S P \bar C \bar T + \bar S P \bar C T + \bar S P C \bar T + \bar S P C T + S \bar P C \bar T + S \bar P C T + S P \bar C \bar T + S P \bar C T + S P C \bar T + S P C T$$

• (ii) Half Adder is a combinational logic circuit that adds two 1-bit digits. The half adder produces a sum of the two inputs. A half adder circuit cannot be used in the same way as a full adder circuit. A full Adder is a combinational logic circuit that performs an addition operation on three 1-bit binary number. The full adder produces a sum of the three inputs and carry value. A full adder circuit can be used in place of a half adder circuit.

$$\text{(iii)}\space F = (A + B ^′) . (B + CD)^′\\\qquad= (A + \bar B) . (\overline {B + CD})\\\qquad = (A + \bar B) [\bar B . \overline {CD}] \space \text{(using De Morgan’s Law)}\\\qquad= (A + \bar B) [\bar B . (\bar C + \bar D)]\\\qquad= (A + \bar B) (\bar B . \bar C) + (\bar B . \bar D)\space \text{(using Distributive Law)}\\\qquad = A . \bar B. \bar C + A. \bar B. \bar D + \bar B . \bar B . \bar C + \bar B . \bar B . \bar D\\\qquad = A . \bar B . \bar C + A . \bar B . \bar D + \bar B . \bar C + \bar B . \bar D\\\qquad = \bar B . \bar C (A + 1) + \bar B . \bar D (A + 1)\\\qquad = \bar B . \bar C + \bar B . \bar D\\\qquad = \bar B (\bar C + \bar D)$$

• (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();
}
}

import java.util.*;
public class Exchange
{
String sent, rev;
int size;
Exchange()
{
sent = “”;
rev = “”;
}
{
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.exfirstlast();
obj.display();
}
}

import.java.io.*;
class Combine
{
int com[],size;
public Combine(int nn)
{
size=nn;
com=new int[size];
}
void inputarray()throws IOException
{
int i;
for(i=0;i<size;i++)
{
System.out.println(“Enter a no.”);
}
}
void sort()
{
int i,j,t;
for(i=0;i<size;i++)
{
for(j=i+1;j<size;j++)
{
if(com[i]>com[j])

{
t=com[i];
com[i]=com[j];
com[j]=t;
}
}
}
}
void mix(Combine A, Combine B)
{
int i,j;
for(i=0,j=0;i<A.size;i++,j++)
{
com[j]=A.com[i];
}
for(i=0;i<B.size;i++,j++)
{
com[j]=B.com[i];
}
}
void display()
{
int i;
for(i=0;i<size;i++)
{
System.out.println(com[i]);
}
}
public static void main(String args[])throws IOException
{
Combine c1=new Combine(5);
Combine c2=new Combine(3);
Combine c3=new Combine(8);
c1.inputarray();
c2.inputarray();
c3.mix(c1,c2);
c3.sort();
c3.display();
}
}

## Section-C

{
int lnk[]=new int[100];

int begin,end,max;
{
max=mm;
begin=end=0;
}
{
if(end= =0)
{
end=begin=1;
lnk[end]=v;
}
else if(end= =max)
{
System.out.println(‘List is Full’);
}
else
{
lnk[++end]=v;
}
}
{
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.

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();
}
}
}

(i) Method
void search (node start, string b)
{
boolean found = false;
node tmp = start;
while (tmp ! = nul)
{
if ((tmp. n). equals (b) = = true)
{
System out.println (“Item found” + tmp. p);
System.out,println (tmp.n);
found = true;
break;
}
tmp = tmp. next;
if (found = = false)
}
}
Algorithm
Step 1 : Input b, the string to search
Step 2 : Let tmp = start, a temporary node created.
Step 3 : If (tmp.n = b) then print “found”, tmp.p, tmp.n, Goto End Else Goto steple
Step 4 : tmp = tmp-next, move tmp to the next node.
Step 5 : if tmp ! = null , then Goto step 3 else Goto step 6
Step 7 : End
(ii) (a) D, E, G
(b) C
(c) B, D, C, E, A, F, G

#### ISC 36 Sample Question Papers

All Subjects Combined for Class 12 Exam 2023

#### ISC 36 Sample Question Papers

All Subjects Combined for Class 12 Exam 2023

The dot mark field are mandatory, So please fill them in carefully