 Standard: XII                                    Subject: Computer

Section A (All questions are compulsory)

Q-1.                                                                           [5X2=10]

a)   State the dual for the following expression and also draw the logic gate diagram for the dual expression obtained using NOR gate only.

P= A.B + C.D

b) Convert the following infix expression to its postfix form:-

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

c)   What do LIFO and FIFO  stand for? Name a data structure that follows LIFO principle and one that follows FIFO principle.

d)   A two dimensional array defined as X[3…6, -2…2] requires 2 bytes of storage space for each

element. If the array is stored in row major order, determine the address of X[5,1], given the base address as 2500.

e) Convert the following expression into its canonical POS form.

F(X,Y,Z)=(X+Y’). (Y’+Z)

Q 2. The following function is a part of some class. It returns the value 1 when the number is an Armstrong number, otherwise it returns 0.                                                                                                

class Armstrong

{

/* An armstrong number is a number which is equal to the sum of the cube of its individual digits*/

Int  arms(int n)

{

int digit=0, sum=0;

int rem=n;

while(?1?)

digit=?2?;

sum=sum+?3?;

rem=?4?;

}

if(?5?)

return 1;

else

return 0;

}

}

1. What is the expression / value at ?1?
2. What is the expression / value at ?2?
3. What is the expression / value at ?3?
4. What is the expression / value at ?4?
5. What is the expression / value at ?5?

Section B [Attempt any one Question]

Q 4.                                                                   [2X5=10]

a)   Given F(A,B,C,D)= ∑(5,6,7,8,9,10,14)

Use Karnaugh map to reduce the given function F using the SOP form. Draw a logic gate diagram for the reduced SOP form. You may use gates with more than two inputs. Assume that the variables and their complements are available as inputs.

b)   X(A,B,C,D)= π(0,2,6,8,10,14)

Use Karnaugh map to reduce the given function X using the POS form. Draw a logic gate diagram for the reduced POS form. You may use gates with more than two inputs. Assume that the variables and their complements are available as inputs.

Q-5  A person is allowed to travel in a reserved coach of the train, if he / she satisfies the criteria given below:-

•   The person has a valid reservation ticket and a valid ID proof.

OR

•   The person does not have a valid reservation ticket, but holds a valid pass issued by the

Railway department with a valid ID proof.

OR

•    The person is a disabled person and holds a valid pass issued by the Railway department along with a valid ID proof.

The inputs are:

( In all the above cases 1 indicates yes and 0 indicates no)

Output :- T         – Denotes allowed to travel ( 1 indicates yes and 0 indicates no in all the cases)

a)   Draw the truth table for the inputs and outputs given above and write the POS expression for T(R,P,D.H).

b)   Reduce T(R,P,D,H) using Karnaugh map.

Draw the logic gate diagram for the reduced POS expression for T(R,P,D,H) using NOR gates. You may use gates with more than 2 inputs. Assume that the variables and their complements are available as inputs.                                                                                                                          

Section B [Attempt any two programs]

Q-5 A class Composite contains a two dimensional array of order [m x n ]. The maximum values possible for 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:-

Class name                                                     :                            Composite

Data members

arr[][]                                                               : stores the composite number column wise

m                                                                      : integer to store the number of rows

n                                                                       : integer to store the number of columns

Member functions

Composite(int mm , intnn)     : 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 in column wise

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

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

Q-6 In Piglatin a word such as KING is replaced by INGKAY, while TROUBLE becomes OUBLETRAY and so on. The first vowel of the original word becomes the start of the translation, any preceding letters being shifted towards the end and followed by AY.

Words that begin with a vowel or which do not contain any vowel are left unchanged.

Design a class Piglatin using the description of the data members and member functions given below:

Class name                                                    : PigLatin

Data members

txt                                                                   : to store a word

len                                                                  : to store the length

Member functions

PigLatin()                                              : constructor to initialize data members

void readstring()                                  : to accept the word input in uppercase

void convert()                                       : converts the word into its piglatin form and displays the word.( changed or unchanged)

void consonant()                                  : counts and displays the number    of consonants

present in the given word.

Specify the class Piglatin giving details of the constructor, void readstring(), void convert() and void consonant(). Also define a main function to create an object and call methods accordingly to enable the task.

Q-7.   Define a class Repeat which allows the user to add elements from one end (rear) and remove elements from one end (rear) and remove elements from the other end (front) only.

The following details of the class Repeat are given below:

Class name                                                : Repeat

Data members

st[]                                                             : an array to hold a maximum of 100 integer elements

cap                                                            : stores the capacity of the array

f                                                                 : to point to the index of the front

r                                                                 : to point to the index of the rear

Member functions

Repeat(int m)                                           : constructor to initialize the data members cap=m, f=0, r=0 and to create the integer array

void pushvalue(int v)                                : to add integers from the rear index if possible

else display the message “overflow”

int popvalue()                                           : to remove and return element from the front, if array is empty then return -9999

void disp()                                                 : displays the elements present in the list