 #### For String programs clickhttps://java4school.com/string-programs-part-5

——————————————————————————————————————–

Answer all questions in Part I (compulsory) and four questions from Part-II, choosing two questions from Section-A, two from Section-B

All working, including rough work, should be done on the same sheet as the rest of the answer.

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

——————————————————————————————————————–

class XII practice test

PART I

Q 1. [5X1=5]

1. What is Tautology and contradiction in Boolean algebra?
2. Name a Character function used to check if a character is an alphabet or digit
3. State the Principle of Duality.
4. Write the contra positive statement for the following conditional statement: If I see lightning then it is raining. .
5. Draw the logic circuit of a NAND gate using NOR gates only.

Q 2.                                                                                                          [5X2=10]

1. What is coercion? Explain with example.
2. Each element of an array ARR[-5… 2,-2 … 5] requires 1 byte of storage.  If  the  array  is  stored in  column  major  order  beginning location 3500, find the location of ARR[0,0].
3. Convert the following infix expression into postfix.
(A-B)/C +(E%F) /M
4. Given F(A, B, C)=AB+BC’ to its canonical SOP form.
5. Show that the dual of A’BC’+AB’C+A’B’C is equal to the complement of     AB’C+B. (A’C’+AC’)

Q 3. Given the following code. Show the dry run/ working.
int fun(int a, int b)

{

if (b == 0)
return 0;
if (b % 2 == 0)
return fun(a+a, b/2);
return fun(a+a,   b/2) + a;
}

What will be the output for the call fun(3,2)?                         
What will be the output for the call fun(4,3) ?                        
What is the function fun() doing?                                            

class XII practice test

Part II
Answer six questions in this part, choosing two questions from Section A, two from Section B Section A

Q 4. Given the Boolean function: F (X,Y,Z,W) = Σ (0, 2, 4, 8, 9, 10,12,13)

• Reduce the above expression by using 4 – variable K-Map, showing the various groups.                                                                             
• Draw the Logic gate diagram of the reduced expression. Assume that the variable and their complements are available as inputs.     

Q 5. Given F(A,B,C,D)=  (A+B+C+D).(A+B+C+D’).(A+B+C’+D’). (A+B+C’+D). (A+B’+C+D’). (A+B’+C’+D’).(A’+B+C+D).(A’+B+C’+ D)

• Reduce the above expression by using 4- variable K-Map, showing the various groups (i.e. octets, quads and pairs).                                       
• Draw the logic gate diagram of the reduced expression.                     

Q 6. What is a Multiplexer? Draw the truth table and logic diagram of an 8:1 multiplexer.                                                                                             

Section B

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. (Flowcharts and algorithms are not required)
The programs must be written in Java.                              [2X5=10]

Q 7.
A class Rearrange has been defined to insert an element and to delete an element from an array. The data members are

Arr[] : integer type array
N : size of array (integer)

Member Functions/ Methods
Rearrange( ) : Default Constructor to initialize the data members
void enter() : to enter size N followed by array elements to store in array Arr. void insert(int p, int item): to insert an item at the position p of the array Arr.

void display() : to display array elements.
void remove(int p) :to delete an element at the position p of the array Arr.
Specify the class Rearrange giving details of the constructor and other member functions. The main() function need not be written.

Q 8. Link is an entity which can hold a maximum of 100 integers. Link enables to add elements from the rear end and remove integers from the front end of the entity. Define a class Link with the following details:

Data members
lnk[] : entity to hold the integer elements.
max : stores the maximum capacity of the entity.
begin : to point to the index of the front end.
end: to point to the index of the rear end.

Member functions

Link(int nn) : constructor to initialize max=mm, begin=0, end=0.
void addLink(int v) : to add an element from the rear index if possible   otherwise display the message “OUT OF SIZE”.
int dellink() : to remove and return an element from the front index,  if possible  otherwise display the message “EMPTY…” and return -99.
void display() : displays the elements of the entity.
Specify the class Link giving details of all the functions.

class XII practice test