ISC Guess 2016

Computer Science (Theory)

Class-XII

(Three Hours)

Answer all questions in Part I (compulsory) and any six questions from Part II, choosing twoquestions from Section-A, two from Section-Bandtwo from Section-C.

The intended marks for questions or parts of questions are given in brackets [ ].

Part-I

Answer all questions.

Question 1:

a)State Associative law and prove it with the help of a truth table. [1]

b)Draw a logic circuit for (A+B). (C+D).C [1]

c)Find the complement of XY’Z + XY + YZ’ [1]

d)Using a truth table verify: [1]

(~p q) ^ p = (p ^ ~q) v (p ^ q)

e)If X Y then write its: i) Converseii) Contra positive [1]

Question 2:

a)State two advantages of using the concept of Inheritance. [2]

b)The array A [2…10][-3…8] contains double type elements. If the base address is 4134, find the address of A [4][5], when the array is stored in Row MajorWise. [2]

c)State the difference between Stack data structure and Queue data structure. [2]

d)Convert the following infix notation to its postfix form: [2]

(A - B) * C / (D + E) ^ F

e)Define Big ‘O’ Notation. State the two factors which determine the complexity of an algorithm. [2]

Question 3:

The following is a function of some class. What will be the output of the function test ( ) when the value of count is equal to 4. Show the dry run/ working. [5]

void test (int count)

{

if (count==0)

System.out.println (" ");

else

{

System.out.println ("Bye"+count);

test (- -count);

System.out.println (count);

}

}

Part-II

Section- A

Answer any two questions.

Question 4:

a)Given the Boolean function:F (A, B, C, D) = ∑ (0, 1, 3, 5, 7, 8, 9, 10, 11, 14, 15)

i)Reduce the above expression by using 4 variable K- map, showing the various groups. [4]

ii)Draw the logic gate diagram of the reduced expression. [1]

b)Given the Boolean function:F (P, Q, R, S) = π(0, 1, 2, 3, 5, 6, 7, 10, 13, 14, 15)

i)Reduce the above expression by using 4 variable K- map, showing the various groups. [4]

ii)Draw the logic gate diagram of the reduced expression. [1]

Question 5:

a)Define Universal gates. Show with the help of a logic diagram how a NAND gate is equivalent to an OR gate.[3]

b)Draw the truth table and logic gate diagram for an Octal to Binary Encoder. [3]

c)What is a Decoder? Draw the truth table and logic circuit diagram for a 2 x 4 Decoder. [4]

Question 6:

a)Verify algebraically if,

X’Y’Z’ + X’Y’Z + X’YZ + X’YZ’ + XY’Z’ + XY’Z = X’ + Y’ [3]

a)Derive a Boolean expression for the logic diagram given below and simplify it. [3]

A

B’

B F

C’

C

A’

b)What is a Multiplexer? Draw the truth table and logic diagram of 8:1 Multiplexer. [4]

Section- B

Answer anytwo questions.

(The programs must be written in Java.)

Question 7:

A class Composite contains a two dimensional array of order m x n. The maximum value possible for both m and n is 20. Design a class Composite to fill the array with the first m x n composite numbers in column wise. The details of the members of the class are given below: [10] Class Name : Composite

Data Members:

a [][ ]:stores the composite numbers column wise

m:to store the number of rows

n:to store the number of columns

Member functions/ Methods:

Composite (int mm, int nn):to initialize the size of the matrix m=mm and n=nn.

int isComposite(int p):returns 1 if number is composite otherwise returns 0.

void fill ():to fill the elements of the array with the first m x n composite numbers.

void display () :display the array in matrix form.

Specify the class Composite giving details of the constructor, int isComposite (int), void fill () and void display (). Define a main () function to create an object and call the functions accordingly to enable the task.

Question 8:

Design a class Exchange to accept a sentence and interchange the first alphabet with the last alphabet for each word in the sentence, with single letter word remaining unchanged. The words in the input sentence are separated by a single blank space and terminated by a full stop. Example: It is a warm day.

Output: tI si a marw yad.

Some of the data members and member functions are given below: [10]

Class Name:Exchange

Data Members:

str:stores the sentence

rev:to store the new sentence

len:stores the length of the sentence

Member functions:

Rearrange ():constructor to initialize the instance variables

void readSentence ():to accept the sentence

void exFirstLast ():extracts each word and interchange the first and last alphabet of the wordand

form a new sentence rev using the changed words

void display ():display the original sentence along with the new changed sentence.

Specify the class Exchange giving details of the constructor, void readSentence (), void exFirstLast () and void display (). Define the main ( ) function to create an object and call the functions accordingly to enable the task.

Question 9:

A sequence of Fibonacci strings is generated as follows:

S0=”a”, S1=”b”, Sn=S(n-1) + S(n-2) where ‘+’ denotes concatenation. Thus the sequence is: a, b, ba, bab, babba, ….n terms Design a class FiboString to generate Fibonacci strings. Some of the members of the class are given below: [10]

Class Name:FiboString

Data Members:

x:to store the first string

y:to store the second string

n:to store the number of terms

Member functions:

FiboStringp ():constructor to assign x=”a” and y=”b”

void accept ():to accept the number of terms

String Fibo(int i):to return the ith term of Fibonacci string using the recursive technique

void generate():to print Fibonacci strings up to n terms by invoking the function String Fibo (int).

Specify the class FiboString, giving details of the constructor, void accept (), String Fibo (int) and void generate (). Define the main () function to create an object and call the functions accordingly to enable the task.

Section - C

Answer any two questions.

The programs must be written in Java.

The Algorithm must be written in general/ standard form, wherever required.

Question 10:

A super class Account contains employee details and a sub class Simple calculates the employee’s simple interest. The details of the two classes are given below: [5]

Class Name:Account

Data Members:

name :stores the employee name

pan:stores the employee PAN number

principal:stores the principal amount (in decimals)

accno:stores the employee bank account number

Member functions/ Methods:

Account (…):Parameterized constructor to assign values to data members

void display ():to display the employee details

Class Name:Simple

Data Members:

time:stores the time duration

rate:stores the rate of interest

interest:stores the simple interest

Member functions/ Methods:

Simple (…):Parameterized constructor to assign values to data members of both the

classes

void calculate ():calculates the simple interest as (principal x rate x time / 100)

void display ():displays the employee details along with the rate, time and interest.

Assume that the super class Account has been defined. Using the concept of Inheritance, specify the class Simple giving details of constructor, void calculate () and void display () function. The super class and main function need not be written.

Question 11:

A deque enables the user to add and remove integers from both the ends i.e. front and rear. Define a class Deque with the following details: [5]

Class Name:Deque

Data Members:

a [ ]:array to hold the integer elements

cap:stores the maximum capacity of the deque

front:to point the index of the front

rear:to point the index of the rear

Member functions/ Methods:

Deque (int max):constructor to initialize data membercap=max, front=rear=0 and create array

void pushfront(int v):to add integer from the front index if possible else display the message

“Full from front”.

int popfront () :to remove and return elements from front. If array is empty then return -999

void pushrear(int v):to add integer from the rear index if possible else display the message

“Full from rear”.

int poprear () :to remove and return elements from rear. If array is empty then return -999

Specify the class Deque giving the details of ONLY the constructor, void pushfront (int), and int poprear (). Asuume that the other functions have been defined. The main function need not be written.

Question 12:

a)A Linked List is formed from the objects of the class, [2]

class Node

{

int num;

Node next;

}

Write a method OR an algorithm to add a node at the end of an existing linked list.

The method declaration is: void addnode (Node start, int n)

b)Answer the following from the diagram of a Binary Tree given below:

  1. Name the Root and the leaves of the tree.[1]
  2. Write In order Traversal of the tree.[1]
  3. Right subtree of node C[1]

With best complements:

Mukesh Kr. Srivastava

Mob: +91-9450882837

Web:www.mukeshinfotech.yolasite.com

Page 1 of 6

© Mks