Haloalkane and Haloarenes
Haloalkane and Haloarenes
PART I – 20 MARKS
Answer all questions.
While answering questions in this Part, indicate briefly your working and reasoning, wherever required.
Question 1
(i) The law which states a + (b.c) = (a+b) . (a+c) is:[1]
(A) Associative Law (B) Distributive Law
(C) Involution Law (D) Commutative Law
(ii) The dual of (P + P’) . (Q + 0) = Q is: [1]
(A) P.P’ + Q.1 = Q (B) P.P’ + Q.0 = Q
(C) P.P + Q.1 = Q’ (D) P+P’ + Q+1 = Q
(iii) The complement of the Boolean expression (P . Q)’ + R’ is: [1]
(A) (P+Q).R (B) PQR
(C) (P’+Q’) .R’ (D) (P’+Q’).R
(iv) If ( x => ~y ) then, its inverse will be: [1]
(A) x => y (b) y => x
(C) ~y => x (d) ~x => y
(v) Transitive nature of inheritance is implemented through: [1]
(A) Single inheritance (B) Multiple inheritance
(C) Hybrid inheritance (D) Multilevel inheritance
(vi) Write the canonical sum of product form of the function y(A,B) = A + B. [1]
(vii) Name the basic gate that is equivalent to two NOR gates connected in series. [1]
(viii) State any one purpose of using the keyword super in Java programming. [1]
(ix) Define Interface with respect to data abstraction. [1]
(x) What is a linked list? [1]
Question 2
(i) Convert the following infix notation to postfix form. [2]
(P / Q – R) * (S + T)
(ii) A matrix N[11][8] is stored in the memory with each element requiring 2 bytes of storage. If the base address at
N[2][3] is 2140, find the address of N[7][5] when the matrix is stored in Row Major Wise. [2]
(iii) With reference to the code given below answer the questions that follow.
void Solve(int n)
{ int a=1,b=1;
Sample Question Papers 23
PART II – 50 MARKS
Answer six questions in this part, choosing two questions from
Section A, two from Section B and two from Section C.
SECTION - A
Answer any two questions.
Question 3
(i) Given the Boolean function F(A,B,C,D) = ∑(0, 1, 2, 3, 4, 6, 9, 11, 13).
(a) Reduce the above expression by using 4-variable Karnaugh map, showing the various groups (i.e. octal,
quads and pairs). [4]
(b) Draw the logic gate diagram for the reduced expression. Assume that the variables and their complements
are available as inputs. [1]
(ii) Given the Boolean function F(A,B,C,D) = π(0, 1, 3, 5, 6, 7, 9, 11, 13, 14, 15).
(a) Reduce the above expression by using 4-variable Karnaugh map, showing the various groups(i.e. octal,
quads and pairs). [4]
(b) Draw the logic gate diagram for the reduced expression. Assume that the variables and their complements
are available as inputs. [1]
Question 4.
(i) A family intends to purchase a smart phone depending on the criteria given below: [5]
• Quad core processor with internal memory of 64 GB or more but not a resale phone
OR
• Resale phone with quad core processor but without warranty
OR
• Processor is not a quad core but with a warranty of 1 year and the internal memory is of 64 GB or more
The inputs are:
INPUTS
P Quad core processor
M Internal memory of 64 GB or more
R Resale phone
W Warranty of 1 year
(In all the above cases, 1 indicates yes and 0 indicates no.)
24 OSWAAL ISC Sample Question Papers, COMPUTER SCIENCE, Class-XII
Output: X [1 indicates purchased, 0 indicates not purchased for all cases]
Draw the truth table for the inputs and outputs given above and write the SOP expression
(ii) What is a half adder? Draw the logic circuit for the SUM and CARRY expression of a half adder using only NAND
gates. [3]
(iii) Simplify the following expression using Boolean laws: [2]
F = PQ + ( P + Q ) • ( P + PR ) + Q
Question 5.
(i) What is a decoder? How is it different from a multiplexer? Draw the logic circuit for a 2 to 4 decoder and explain its
working. [5]
(ii) Verify if the following proposition is valid: [3]
( P => Q ) Ù ( P => R ) = P => ( Q Ù R )
(iii) Write the maxterm and minterm for the function F(A, B,C,D) when, A=1, B=1, C=0 and D=1. [2]
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.
(Flow charts and Algorithms are not required.)
The programs must be written in Java.
Question 6.
Design a class Pronic to check if a given number is a pronic number or not. [A number is said to be pronic if the
product of two consecutive numbers is equal to the number] [10]
Example: 0 = 0×1
2 = 1×2
6 = 2×3
12 = 3 × 4
thus, 0, 2, 6, 12... are pronic numbers.
Some of the members of the class are given below:
Class name : Pronic
Data members/instance variables:
num : to store a positive integer number
Methods / Member functions:
Pronic( ) : default constructor to initialize the data member with legal initial
value
void acceptnum( ) : to accept a positive integer number
boolean ispronic(int v) : returns true if the number ‘num’ is a pronic number, otherwise
returns false using recursive technique
void check( ) : checks whether the given number is a pronic number by invoking
the function ispronic() and displays the result with an appropriate
message
Specify the class Pronic giving details of the constructor( ), void acceptnum( ), boolean ispronic(int) and void
check( ). Define a main( ) function to create an object and call the functions accordingly to enable the task.
Question 7.
Design a class OddEven to arrange two single dimensional arrays into one single dimensional array, such
that the odd numbers from both the arrays are at the beginning followed by the even numbers. [10]
Example: Array 1: { 2, 13, 6, 19, 26, 11, 4 }
Array 2: { 7, 22, 4, 17, 12, 45 }
Arranged Array = { 13, 19 11, 7, 17, 45, 2, 6, 26, 4, 22, 4, 12 }
Some of the members of the class are given below:
Class name : OddEven
Data members/instance variables:
a[ ] : to store integers in the array
m : integer to store the size of the array
Methods / Member functions:
Sample Question Papers 25
SECTION – C
Answer any two questions.
Each program should be written in such a way that it clearly depicts the logic of the problem stepwise.
This can be achieved by using comments in the program and mnemonic names or pseudo codes
for algorithms. The programs must be written in Java and the algorithms must be written in
general / standard form, wherever required / specified.
(Flowcharts are not required.)
Question 9.
Holder is a kind of data structure which can store elements with the restriction that an element can be added from
the rear end and removed from the front end only.
The details of the class Holder is given below:
Class name : Holder
Data members/instance variables:
Q[ ] : array to hold integers
26 OSWAAL ISC Sample Question Papers, COMPUTER SCIENCE, Class-XII
(ii) Answer the following questions from the diagram of a Binary Tree given below:
(a) Write the in-order traversal of the above tree structure. [1]
(b) Name the children of the nodes B and G. [1]
(c) State the root of the right sub tree. [1]
SOLUTIONS
Sample Question Paper-1
COMPUTER SCIENCE
There are 1 octet 1 quad and 1 pair
30 OSWAAL ISC Sample Question Papers, COMPUTER SCIENCE, Class-XII
(b) = PQ + PQ + P + Q
= PQ + P + Q
= P(Q + 1) + Q
F=P+Q
Answer 5.
(i) A decoder is a combinational circuit that
converts binary information from ’n’ input
lines to a maximum of 2n unique output lines.
This decoder is called n-to-m line decoder,
where m [2n. Here, the decoder has n inputs
Answer 4.
and m output lines and is also referred as n ×
(i) m decoder.
Inputs Output Difference between multiplexer and decoders
are as follows:
P M R W X
Multiplexer Decoders
0 0 0 0 0
(i) A digital A decoder is a
0 0 0 1 0
multiplexer is a combinational
0 0 1 0 0 combinational circuit that coverts
0 0 1 1 0 circuit that binary information
selects binary from ‘n’ input lines
0 1 0 0 0 information from to a maximum of
0 1 0 1 1 one of many 2n unique output
0 1 1 0 0 input lines and lines
directs it to a
0 1 1 1 1 single output
1 0 0 0 0 line.
1 0 0 1 0 (ii) It is called as data This decoder is
selector, since called n-to-m line
1 0 1 0 1
it selects one of decoder where m
1 0 1 1 0 many inputs. £ 2n
1 1 0 0 1
1 1 0 1 1
1 1 1 0 1
1 1 1 1 0
Values for column (P =>Q) ^ (P=>R) and column P => (Q^R) are same. Hence Proved
(iii) The maxterm corresponding to the given value public static void main (String args[])
of the variables will be = A’+B’+C+D’ {
The minterm corresponding to the given valued Pronic p=new Prnoic();
of the variables will be = ABC’D
p.acceptnum( );
Answer 6.
p.check();
import java. util.*;
Answer 7.
public class Pronic
{ import java.util.*;
int num; class OddEven{
int a[];
Pronic( )
int m;
{
num = 0;} public OddEven(int mm){
void acceptnum ( ) m=mm;
{ a=new int[m];
Scanner x = new Scanner (System. }
in); public void fillarray(){
S y s t e m . o u t . p r i n t I n ( “ E n t e r Scanner sc=new Scanner(System.in);
number.”); System.out.println(“Enter numbers
num = x.nextInt (); into array...”);
} for(int i=0;i<m;i++)
boolean ispronic(int v) {
a[i]=sc.nextInt();
{
}
for (int i = 0;i <= (int) }
(sqrt(v));i++) public OddEven arrange(OddEven P,
if (v ==i * (i + 1)) OddEven Q){
return true; int k=0;
return false; OddEven obj=new OddEven(P.m+Q.m);
} for(int i=0;i<P.m;i++){
void check() if(P.a[i]%2!=0)
{ obj.a[k++]=P.a[i];
}
boolean f = ispronic(num);
for(int i=0;i<Q.m;i++){
if (f==true) if(Q.a[i]%2!=0)
S y s t e m . o u t . obj.a[k++]=Q.a[i];
println(“Pronic”); }
else for(int i=0;i<P.m;i++){
System.out.println(“not if(P.a[i]%2==0)
Pronic); obj.a[k++]=P.a[i];
}
{
for(int i=0;i<Q.m;i++){
32 OSWAAL ISC Sample Question Papers, COMPUTER SCIENCE, Class-XII
if(Q.a[i]%2==0) c=nextVowel.charAt(index);
obj.a[k++]=Q.a[i]; }
} newwrd+=c;
return obj; }
} }
public void display(){ public void disp(){
for(int i=0;i<m;i++){ System.out.println(“Original Word
System.out.print(a[i]+”\t”); “+wrd);
} System.out.println(“Encrypted Word
} “+newwrd);
public void main(){ }
OddEven ob1=new OddEven(7); public void main(){
OddEven ob2=new OddEven(6); Encrypt obj=new Encrypt();
ob1.fillarray(); obj.acceptword();
ob2.fillarray(); obj.freqvowcon();
OddEven ob3=arrange(ob1,ob2); obj.nextVowel();
ob3.display(); obj.disp();
} }
} }
Answer 8. Answer 9.
import java.util.*; void addint(int v)
class Encrypt{ {
String wrd; if(rear == size)
int len; {
String newwrd; System.out.println(“HOLDER IS
public Encrypt(){ FULL”);
wrd=””; }
len=0; else
newwrd=””; {
} Q[rear++] = v;
public void acceptword(){ }
Scanner sc=new Scanner(System.in); int removeint( )
System.out.println(“Enter a word {
“); if(font==size)
wrd=sc.nextLine().toUpperCase(); {
len=wrd.length(); System.out.println(“Underflow“);
} return–999;
public void freqvowcon(){ }
String vowel=”AEIOU”; else if (front== rear)
int c1=0,c2=0; {
d = Q [front];
for(int i=0;i<len;i++){ front = 0;
char c=wrd.charAt(i); rear = 0;
if(vowel.indexOf(c)>=0) return d;
c1++; }
else else
c2++; return Q [front++];
} }
System.out.println(“Number of vowel (ii) Above class describe the use of Queue.
“+c1);
Answer 10.
System.out.println(“Number of
consonants “+c2); import java.util.Scanner;
} public class Interest extends Bank
public void nextVowel(){ {
String vowel=”AEIOU”; static Scanner sc = new
String nextVowel=”EIOUA”; Scanner(System.in);
for(int i=0;i<len;i++){ double rate, time;
char c=wrd.charAt(i); Interest(String n, String a,
int index=vowel.indexOf(c); double pp)
if(index>=0){ {
Solutions 33