0% found this document useful (0 votes)
9 views6 pages

i1660130613rOswaal ISC 12th Computer Science_Practice Paper-2

The document contains solutions to various computer science problems, including concepts like truth values, binary decisions, and boolean algebra. It also discusses programming concepts such as exception handling, autoboxing in Java, and data structures like queues and arrays. Additionally, it provides examples of logic circuits, truth tables, and algorithms related to magic numbers and array manipulation.

Uploaded by

ifrahkol
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views6 pages

i1660130613rOswaal ISC 12th Computer Science_Practice Paper-2

The document contains solutions to various computer science problems, including concepts like truth values, binary decisions, and boolean algebra. It also discusses programming concepts such as exception handling, autoboxing in Java, and data structures like queues and arrays. Additionally, it provides examples of logic circuits, truth tables, and algorithms related to magic numbers and array manipulation.

Uploaded by

ifrahkol
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

PRACTICE PAPER - 2

SOLUTIONS
1. (a) Truth value is defined as truth or falsity of a (e) (i) leaf: The node which does not have a child
proposition. is called as LEAF Node.
(b) The decision which result into either Yes or No (ii) Degree: The number of children of a node
is called a Binary Decision. is called degree of the tree.
(c) Minterm designation 3.
 UVW = 100
Decimal equivalent
= 1 × 22 + 0 × 21 + 0 × 20 = 4.
 UVW = m4 Output: 75
Maxterm Designation The given function returns th sum of square of the
 UVW = 011 digits.
Decimal equivalent 4. (a) (i)
= 0 × 22 + 1 × 21 + 1 × 20
= 0 + 2 + 1 = 3
 UVW = m3
(d)



 Quad 1 = m0 + m4 + m8 + m12
(e) The translation of boolean algebra into the gates
form is known as logic circuit. = yz
2. (a) Finally block is always executed whether (ii)
exception is handled or not.
Exceptions are events occurring at the runtime
of a program that disrupt the overall execution
of the program. (b) (i) F(A, B, C, D) = p(0, 1, 3, 5, 6, 7, 10, 14, 15)
(b) The automatic conversion that the Java
computer makes between the primitive types
and their corresponding object wrapper classes
is called autoboxing.
Primitive types should be preferred over
wrappers as wrapper types are immutable and
their use may sometimes become impossible.
(c) The elements of 2-D arrays are allocated
contiguous memory locations.
To enable this storage array is linearized in two

ways i.e. in Row-major or Column-major.
Pair 1 = M0M1 = (A+B+C)
(d) Two applications of queues are:
Pair 2 = M10M14 = (A+C+D)
(i) For implementing any computational FIFO
service e.g., printer queues, disk queues etc. Quad 1 = M1M3M5M7 = (A+D)
(ii) For handling scheduling of processes in a Quad 2 = M5M7M14M15 = (C+B)
multitasking operating system e.g. FCFS F(A, B, C, D) = (A+B+C)(A+C+D)
scheduling. (A+D)(C+B)
2 Oswaal ISC Question Bank Chapterwise & Topicwise, COMPUTER SCIENCE, Class-XII

(ii) (b) Half Adder is a logic circuit that two bits. It


produces the outputs: SUM and CARRY.
Truth table for half adder is:
X Y Carry Sum
0 0 0 0
0 1 0 1
1 0 0 1
1 1 1 0
Boolean equation for SUM and CARRY of half
adder is
 SUM = X/Y
 CARRY = X·Y
Logic circuit for half adder is:


5. (a)
Hexadecimal Number F3 F2 F1 F0
0 0 0 0 0
1 0 0 0 1
2 0 0 1 0
(c) A·B+B·C = A·B(C+C)+(A+A)B·C
3 0 0 1 1
= ABC+ABC+ABC+ABC
4 0 1 0 0
= ABC+ABC+ABC
5 0 1 0 1 6. (a) (i)
6 0 1 1 0
R P D H T
7 0 1 1 1
0 0 0 0 0 M0 = R+P+D+H
8 1 0 0 0
0 0 0 1 0 M1 = R+P+D+H'
9 1 0 0 1
0 0 1 0 0 M2 = R+P+D'+H
A 1 0 1 0
0 0 1 1 0 M3 = R+P+D'+H'
B 1 0 1 1
0 1 0 0 0 M4 = R+P'+D+H
C 1 1 0 0
0 1 0 1 1 M8 = R'+P+D+H
D 1 1 0 1
0 1 1 0 1 M9 = R'+P+D+H'
E 1 1 1 0
0 1 1 1 1 M12 = R'+P'+D+H
F 1 1 1 1
1 0 0 0 0
Circuit diagram for Hexdecimal to Binary
encoder 1 0 0 1 0
1 0 1 0 1
1 0 1 1 1
1 1 0 0 0
1 1 0 1 1
1 1 1 0 1
1 1 1 1 1

T(R, P, D, H) = p(0, 1, 2, 3, 4, 8, 9, 12)
(ii) 
SOLUTIONS 3
n=0;
}
void inputnum(int no)
{
n=no;
}
int digitsSum(int num)
{
int d=0, sum=0;
 Quad 1 (M0 M1 M8 M9) = (P+D) while (num>0)
 Quad 2 (M0 M1 M2 M3) = (R+P) {
 Quad 4 (M0 M4 M8 M12) = (D+H) d=num%10;
 \ T(R, P, D, H) = (P+D)(R+D)(D+H) sum=sum+d;
(b) NOR=NOR can be implemented with 2-level num=num/10;
OR-AND implementation. F here should be in a }
product of sum form, i.e., return sum;
F(a, b, c, d) = Sm(1, 3, 4, 6, 9, 12) }
= pM(0, 2, 5, 7, 8, 10, 11, 13, 14, 15) void ismagic()
using K-map {
int num;
int sum=digitsSum(n);
while (sum>9)
{
num=sum;
sum=digitssum(num);
}
if (sum==1)
Quad 1 (M0 M2 M8 M10) = (b+d)  system.out.println(n+"is a magic
Quad 2 (M5 M7 M13 M15) = (b'+d') number.");
Quad 3 (M10 M11 M14 M15) = (a'+c') else
\ F(a, b, c, d) = (b+d)(b'+d')(a'+c')  system.out.println(n+"is NOT a
magic number");
}
}
8. import java.util.scanner;
class word
{

String str;
(c) A·(A'+B)·C·C·(A+B)
word()
= A·A'+A·B·C·(CA+CB)
{
= 0+A·B·C(CA+CB)
str="";
= A·B·C·(CA+CB)
}
= A·B·C·C·A+A·B·C·C·B
void readword()
= ABC+ABC
{
= ABC
scanner sc=new scanner(system.in);
7. import java.util.scanner;
System.out.println("Enter a word:");
Public class Magic
str=sc.next();
{
}
int n;
void arrange()
Magic()
{
{
4 Oswaal ISC Question Bank Chapterwise & Topicwise, COMPUTER SCIENCE, Class-XII

 char[] arr=str.toCharArray(); void display()


int i,j; char newValue; {
for (i=1; i<arr.length; i++) for (int i=0; i<this.m; i++)
{ {
newValue=arr[i]; for(int j=0; j<this.n; j++)
j=i; {
while(j>0&&arr[j=1]>newValue)  System.out.print(matrix[i][j]+" ");
{ }
arr[j]=arr[j–1]; System.out.println();
j--; }
arr[j]=newValue; void shift(shuffle S)
str=newString(arr); {
} for(int i=0; i<S.m; i++)
void display() int temp=S.matrix[i][S, n-1];
{ for (int j=P.n-2; j>=0; j--)
 system.out.println("New word {
is:"+str); S.matrix[i][j+1]=S.matrix[i][j];
} }
public static void main() S.matrix[i][a]=temp;
{ }
Word wo=new word(); }
wo.readword(); public static void main()
wo.display(); {
wo.arrange(); Shuffle Sh=new Shuffle(4,5);
wo.display(); Sh.input();
} System.out.println("Original Array");
} Sh.display();
} System.out.println("Shuffled Array");
} Sh.cyclic(Sh);
9. import java.util.scanner; Sh.display*();
public class shuffle }
{ 10. Public class chain
int m,n; {
int matrix [][]=new int[6][6]; protected int ele[];
public shuffle (int row, int col) protected int front, year;
{ protected int cap;
this.m=row; public chain (int max)
this.n=col; {
} cap=max;
void input() front=–1;
{ rear=–1;
Scanner sc=new Scanner(System.in); ele=new int[cap];
in x; }
For (int i=0; j<n; j++) public void pushfront (int V)
{ {
x=sc.nextInt(); if (front==–1)
this.matrix[i][j]=x; {
} front=0;
} rear=0;
} ele[front]=V;
SOLUTIONS 5
} return element;
else if (front==0) }
 system.out.println("Insertion at front }
not possible"); 11. Class worker
else if ((rear-front)+1<ele.length) {
ele[==front]=V; String name;
} double basic;
Public void pushrear(int V) Worker (String nm, double bas)
{ {
if(rear==–) name=nm;
{ basic=bas;
front=0; }
rear=0; void display()
ele[rear]=V; {
} System.out.println("Name:"+name);
else if(rear+1<ele.length) System.out.println("Basic:"+basic);
ele[++rear]=V; }
else }
Syestem.out.println("OVER FLOW"); Public class wages extends worker
} {
Public int popfront() int hrs;
{ double rate;
int element; double wage;
if (front==–1 && rear==–1) Wages(string nm, double bas, int hr, double
return=999; rt)
else {
{ super (nm, bas);
element=ele[front]; hrs=hr;
if (front==rear) rate=rt;
front=–1; }
rear=–1; double overtime()
else {
front++; return hrs rate;
return element; }
} void display()
} {
Public int poprear() super.display();
{ wage=overtime()+Basic;
int element; System.out.println("Hours worked:"+hrs);
if (front==–1 && rear==–1) System.out.println("Rate:"+rate);
return –999; System.out.println("Wage:"+wage);
else }
{ }
element=ele[rear]; 12. (a) void del (node start, int n)
if (front==rear) {
{ front=–1; int flag=0;
rear=–1; Node ptr=start;
} Node prev=ptr;
else int count=0;
rear– –;  while (count!=n)
6 Oswaal ISC Question Bank Chapterwise & Topicwise, COMPUTER SCIENCE, Class-XII

{ (b) (i) A B D E C F G
prev=ptr; (ii)
ptr=ptr.next;
count++;
}
prev.next=ptr.next;

ptr.next=null;
(iii) D, E & G
}



You might also like