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

Half Yearly Exam : 2021-22

Std. : XII Sub. : Computer Science Total Marks : 70


Name: ______________ Roll No. ______ Date : 07/09/2021
(Candidates are allowed additional 15 minutes for only reading the paper. They must NOT start writing during this time.)
Answer all questions in Part I (compulsory) and five questions from Part-II,
choosing two questions from Section-A, two from Section-B and one 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
Answer all questions.
While answering questions in this Part, indicate briefly your working and reasoning, Wherever
required.
Q:1
(a) Draw the logic diagram and truth table for 2 input XNOR gate. (01)
(b) State the De-Morgan’s law and verify it, using the truth table. (01)
(c) Draw a logic circuit for (A+B).(C+D).C (01)
(d) If (~P =>Q ) then write its: (i) Inverse (ii) Converse (01)
(e) State the difference between functions int nextInt() and boolean hasNextInt(). (01)
Q:2
(a) What is Interface? (02)
(b) Write an example of Compare To() function with return data type. (02)
(c) What is a Constructor? Explain with example. (02)
(d) Verify the following proposition with the help of a truth table:
(P∧Q)∨(P∧~Q) = P (02)
(e) Convert the following function into its Canonical Sum of Product form.
F(X,YZ)= (0,1,4,7) (02)
Q:3
(a) The following function Mystery( ) is a part of some class. What will the function
Mystery( ) return when the value of num=43629, x=3 and y=4 respectively? Show
the dry run/working (05)

PART – II
Answer seven questions in this part, choosing two questions from
Section A, two section from Section B and one from Section C.
SECTION : A (Any Two )
Q:4
(a) Given the Boolean function F(A,B,C,D) = ⅀(0, 2, 3, 4, 5, 8, 10, 11, 12, 13)
(i) Reduce the above expression by using 4-variable Karnaugh Map,
Showing the various groups (i.e octal,quads,and pairs). (04)
(ii) Draw the logic gate diagram for reduced expression. Assume that the
Variables and their components are available as inputs. (01)
(b) Given the Boolean function P(A,B,C,D) = π(0, 1, 2, 8, 9, 11, 13, 15)
(i) Reduce the above expression by using 4-variable Karnaugh Map, Showing
the various groups (i.e octal,quads,and pairs). (04)
(ii) Draw the logic gate diagram for reduced expression.Assume that
the Variables and their components are available as inputs. (01)
Q:5
(a) With the help of a logic diagram and truth table explain a Decimal to Binary Encoder. (05)

SGVP International School, Ahmedabad - INDIA Page 1 of 4


(b) What is a multiplexer? Draw the logic circuit diagram for a 4 to 1
Multiplexer (03)
(c) Using a truth table, state whether the following proposition is a Tautology, (02)
Contradiction or Contingency: ~(P =>Q)<=>(~P∨Q)
Q:6
(a) The owner of a company pays the bonus to his salesmen as per the criteria are given
below: (05)
If the salesman works overtime for more than 4 hours but does not work on off days/
holidays.
OR
If the salesman works when festival sales are on and updates showroom arrangements.
OR
If the salesman works on an off day/holiday when the festival sales are on.
The inputs are:
INPUTS

O Works overtime for more than 4 hours

F Festival sales are on

H Working on an off day/holiday

U Updates showroom arrangements


(In all the above cases 1 indicates yes and 0 indicates no)
Output: X[1 indicates yes, 0 indicates no for all cases]
Draw the truth table for the inputs and outputs given above and write the POS
expression for X(O, F, H, U). (04)
(b) Explain Truth table of NAND gate with logic diagram. (03)
(c) Simplify the following expression, using Boolean laws: (X + Z).(X.Y + Y.Z’) + X.Z + Y (02)

SECTION : B (Answer any two questions)


The programs must be written in Java
Q:7 (10)
Design a class ArmNum to check if a given number is an Armstrong number or not.
[A number is said to be Armstrong if sum of its digits raised to the power of length of the
number is equal to the number]
Example:
371 = 33 + 73 + 13
1634 = 14 + 64 + 34 + 44
54748 = 55 + 45 + 75 + 45 + 85
Thus, 371, 1634 and 54748 are all examples of Armstrong numbers.
Some of the members of the class are given below:
Class name : ArmNum
Data members/instance variables:
n : to store the number
a : to store the length of the number
Methods/Member functions:
ArmNum (int nn): parameterized constructor to initialize the data member n = nn
int sum_pow(int i): returns the sum of each digit raised to the power of the length
SGVP International School, Ahmedabad - INDIA Page 2 of 4
of the number using recursive technique eg., 34 will return 32 + 42 (as the length
of the number is 2)
void isArmstrong(): checks whether the given number is an Armstrong number by
invoking the function sum_pow () and displays the result with an appropriate message.
Specify the class ArmNum giving details of the constructor( ), int sum_pow(int) and
void isArmstrong( ). Define a main() function to create an object and call the
functions accordingly to enable the task
Q:8 (10)
A superclass Account contains employee and a subclass Simple calculate the employee’s
simple interest. The details of the classes is given below.
Class name Account
Data members
Name Stores the employee name
Pan Stores pan number
Acc_no stores account number
Member function:
Account()
Void display() to display the employee details.
Class name Simple
Data Members
time stores the time duration
rate stores rate of interest
interest stores the simple interest
Member function:
Simple()
Void calculate() calculate the simple interest as(principal*time*rate)/100
void display() display the employee details along with interest
Q:9 (10)
A class The String accepts a string of a maximum of 100 characters with you only one
blank space between the words.
Some of the members of the class are as follows.
Class Name : TheString
Data members:
Void CountFreq() : to count the numbers of words and number of the
consonants and store them in wordcount
Void display() : to Display the original string, along with the numbers
of words and number of consonant
SECTION : C (Answer any one questions.)
The programs must be written in Java
Q : 10 (10)
A class Composite contains a two dimensional array of order [m*n] .The maxium
Value possible for both ‘m’ and ‘n’ is 20.Design a class Composite to fill array with
First (m*n) composite number in column wise
Class Name composite
Data members
arr[] stores the composite number column wise
m stores number of rows
n stores number of column
Member function:
Composite(int mm,int nn) initialize size of matrix m=mm,n=nn
SGVP International School, Ahmedabad - INDIA Page 3 of 4
Int isComposite(int p) return 1 if composite number otherwise 0
Void fill() to fill the element of array with first(m*n)
Composite number column wise.
Void display display array in matrix form
Q : 11 (10)
Write a program to accept a set of 10 integers in single dimensional Array. Sort the
numbers in ascending order by using “Bubble” technique. Display the sorted array.

SGVP International School, Ahmedabad - INDIA Page 4 of 4

You might also like