March Test1 Xiia

Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

Online Revision Test

Answer all questions in Part I (compulsory) and six questions from Part-II,
choosing two questions from Section-A, two from Section-B and
two from Section-C .
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 [ ].
---------------------------------------------------------------------------------------------------------------------

PART— I (20 Marks)


Answer all the questions.
While answering questions in this Part, indicate briefly your working and reasoning,
wherever required.

Question 1.
(i) Among the following which one is Associative law:- [1]
(a) X(YZ) =(XY)Z
(b) X+(YZ)=(X+Y)(X+Z)
(c) (X+Y).Z=XZ+YZ
(d) XYZ=(XY)Z

(ii) Assertion (A):- P = 20 is greater than 10, Q= JUNE comes after May . [1]
These two statements are consistent.

Reason(R) : Two statements are said to be consistent if and only if their


conjunction is not a contradiction.

(a)Both A and R are true and R is the correct explanation of (A)


(b)Both A and R are true but R is not the correct explanation of A
(a) A is true but R is false
(b) A is false but R is true.
(iii) F(A,B,C)=∏(0, 3, 5, 6) [1]
The POS expression corresponding to above function is:-
(a) (A+B+C).(A+B’+C’).(A’+B+C’).(A’+B'+C)
(b) (A+B’+C’).(A’+B’+C).(A+B+C’).(A’+B+C)
(c) (A+B+C).(A’+B’+C).(A+B+C’).(A+B’+C)
(d) (A’+B’+C’).(A+B’+C’).(A’+B+C’).(A’+B’+C)

(iv) 2 TO 4 decoder contains [1]


(a) 2 NOT gates ,4 AND gates and 1 OR gate
(b) 2 NOT gates ,4 AND gates and 0 OR gate
(c) 4 NOT gates ,2 AND gates and 1 OR gate
(v) A SOP expression comprising of A B C has got 1 in 0,4, and 2 and 6 position [1]
.in Kmap with 1 can be marked as
(a) 2 QUAD
(b) 2 PAIR
(c) 1 QUAD
(d) 1 QUAD AND 1 PAIR

(vi) Assertion(A): [1]

Which of the following option is correct?


(a) Both Assertion and Reason are true, and Reason is the correct
explanation for Assertion.
(b) Both Assertion and Reason are true, but Reason is not the correct
explanation for Assertion.
(c) Assertion is true and Reason is false.
(d) Assertion is false and Reason is true.
(vii) Name any recursive data structure. [1]
(viii) Differentiate between the keywords this and super [1]
(ix) How is a multiplexer different from a decoder? [1]
(x) .Half adder circuit is present in which unit of Computer? [1]

Question 2.
(a) Convert the following infix notation to prefix form. [2]
( A / B + C ) / ( D * ( E − F ))
(b) A matrix A[m][m] is stored in the memory with each element requiring 4 bytes [2]
of storage If the base address at A[1]{1] is 1500 and the address of A[4][5] is
1608 ,determine the order of the matrix when it is stored column major wise.

(c) The following function check() is part of some class.What will the function [3]
check() return when both ‘m’ and ‘n’ are equal to 5.
int check(int m,int n)
{
if (n==1)
return -m--;
else
return ++m+check(m,--n);
}
(d) Following is a recursive function to find the sum of the digits from a string .Fill [3]
up the blanks with necessary statements.
int sum(String str)
{
?1? {
char c=str.charAt(0);
if (c>='0' && c<='9')
return ?2?;
else
return sum(str.substring(1));
}
else ?3?

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) For the selection in national level competition ,the selection committee has [5]
decided to select few candidates who satisfies one of the following conditions:-
● The candidate is a female and not below 18 years of age and has won
prize at state level
● The candidate is a male of 18 years or above and has won the prize at state
level.
● The candidate is a male who is a member of racing organizations and also
national level player.
● The candidate is a female who has qualified in inter_school racing
competition of a state.
Draw the truth table for the above phenomenon and the logic circuit diagram of
the reduced expression.
Inputs
A The candidate is male( 1 indicates yes and 0 indicates no)
B The candidate is 18 years and above(1 indicates yes and 0
indicates no)
C The candidate belongs to the racing organization or/and
national level player (1 indicates yes and 0 indicates no)
D The candidate is an inter school state champion or state prize
winner (1 indicates yes and 0 indicates no)

(ii) Reduce the above expression X (A,B,C,D) by using 4-variable Karnaugh map, [5]
showing the various groups (i.e. octal, quads and pairs). Draw the logic gate
diagram for the reduced expression. Assume that the variables and their
complements are available as inputs.
Question 4.
(i)(a) Given the boolean function F(A,B,C,D) = 𝚷(0,8,10,12,13,14,15) [4]
Reduce the above expression by using 4 variable K map ,showing the various
groups (i.e. octets,quads and pairs).

(b) Draw the logic gate diagram for the reduced expression. Assume that the [1]
variables and their complements are available as inputs. [
(ii)(a) [4+1]

From the above logic circuit,the diagram mentions the output at (1) ,(2),(3) and
also the output at (4) and simplifies it.
Identify the logic gate which is equivalent to the simplified expression

Question 5.
With the help of 2 half adder and an OR gate make a FULL adder [5]
Draw the logic circuit corresponding to it.After writing the Truth table of a Full
adder Write the POS expression of carry from the truth table.
(ii) Verify if the following proposition is valid using the truth table: A => ( B ∧ C ) [3]
= ( A => B ) ∧ ( B => C )
(iii) How is a 2 to 4 decoder related to 4:1 multiplexer? [2]

SECTION – B
Answer any two questions
Each program should be written in such a way so 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.
Question 6.
A class Strop is used to find the sum of positional values of the words of a sentence
.all the words are in capital letter.eg if the word is VAT
Sum of positional values=22+1+20=(2+2)+1+(2+0)=7

It is having following data member and member functions.


Class name Strop

Data member

String sent To store a sentence

Member functions

void readdata() To accept the sentence

int sumpos(String wd) To return the sum of the positional value in


the above mentioned way for the word wd
in recursive manner

void extractprintsumpos() Extract each word of the sentence and find


and print the words along with sum of
positional values of each word.
Define all the functions mentioned above .Define void main() to create an object and invoke
above functions accordingly to enable the task.

Question 7.
Consider a class Arrop which is used to find the player’s name and the name of the games he
can play. One player can be capable of playing different games. As example if players and games
are as follows:

A cricket
B football
A basketball
C cricket
Program should display
A capable of playing cricket and basketball
B capable of playing football
C capable of playing cricket

It is having following data members and member functions


Class name Arraop

Data member

String player[] Array to store players’ name

String game[] Array to store the name of the game which the student
can play.

int n To store the number of players capable of playing


different games

Arraop(int num) To initialize n with num

void readdata() To store the names of the players and the name of the
game he or she can play in player[] and game[]
respectively.

void sort() Sort the names alphabetically along with game[]

void display() Display the name of the players along with name of
the game which he can play as mentioned in the
example

Question 8.
A Class Decihexa is used for finding out how many alphabets are present in an
hexadecimal number
Example : 3A contains 1 alphabet
756 contains no alphabet
A class is designed for following purpose:

Class name Decihexa [10]

Data members

int num To store a positive integer

String hexa To store the hexadecimal equivalent

Member functions:
Decihexa() default constructor to initialize the
data member with legal initial value

void accept() To accept the decimal number

void convertdeci(int num) To convert any decimal number to


hexadecimal number and store it into
hexa.

void prncount() To count and print number of


alphabets present in the hexadecimal
number hexa after invoking the
above mentioned function.

void display() To display the decimal number and


the hexadecimal number
Define all the functions mentioned above along with void main) to create an
object and execute above mentioned function to enable the task.

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.
Shelf 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.

Class name Shelf

ele[ ] : array to hold decimal numbers

lim : maximum limit of the shelf

front : to point the index of the front end

rear: to point the index of the rear end


Member functions

shelf(int n ) : void display( ) : to display the constructor to initialize lim=n, front= 0 and
elements of the shelf rear=0

void pushVal(double v) : to push decimal numbers in the shelf at the


rear end if possible otherwise display the
message “SHELF IS FULL ”

double popVal( ) : to remove and return the decimal number


from
the front end of the shelf if any, else returns
−999.99

void display() To display the element of the shelf

Specify the above class by defining above functions . [5]


Void main() and algorithm need not be written.
Question 10.
[5]
A super class Circle has been defined to calculate the area of a circle. Define a
subclass Volume
to calculate the volume of a cylinder.
The details of the members of both the classes are given below:

Class name Circle

Data members

radius to store the radius in decimals

area to store the area of a circle

Member functions:

Circle( ... ) : Data parameterized constructor to assign values to the


members/instance data members
variables:
Methods / Membe

cal_area() : calculates the area of a circle (πr 2 )

void display( ) : to display the area of the circle

Class name Volume

height : to store the height of the cylinder in decimals

volume : to store the volume of the cylinder in decimals

Method name:- parameterized constructor to assign values to the


Volume( ... ) : data members of both the classes

calculate( ) : to calculate and return the volume of the cylinder


using the formula (πr 2 h) where, r is the radius and
h is the height

void display( ) : to display the area of a circle and volume of a


Cylinder

Assume that the super class Circle has been defined. Using the concept of inheritance,
specify the class Volume giving the details of the constructor(...), double calculate( )
and
void display( ).
The super class, main function and algorithm need NOT be written.

Question 11.
(i ) Find the Big-O Complexity of the following nested loop. [3]
for(i=0;i<N;i++)

{
for (j=i+1;j<N;j++)
{
Sequence of statements
}
}

(ii) Answer the following question s for the binary tree given below:- [2]

(a) Find the height of the tree?


(b) Write the preorder traversal of the tree.
(c) What is the degree of the tree?

You might also like