COMPUTER EXAM Date :- F.
M -:
Note: Attempt all questions. All questions are compulsory.
SECTION – A (Attempt in not more than 40 minutes)
1. A class called DigiNumber has been defined to find the frequency of each digit
present in a number and the sum of the [Link] of the members of the class
DigiNumber are given below: (10)
Class Name : - DigiNumber
Data Members / Instance Variables
num : long integer for storing the number
Member Functions
DigiNumber() : constructor to assign 0 to num
DigiNumber(long n) : parameterised constructor to assign n to num
void digitfrequency() : to find the frequency of each digit present in num and
to display it
long sumDigits(long N) : to return the sum of the digits of the number stored
in num using recursive technique
void printsum() : to print the sum of digits of num by invoking sumDigits(...)
Specify the class DigiNumber, giving details of the two constructors and the
functions
void digitfrequency(), long sumDigits(long) and void printsum().Also write the
main() function to create an object and call the member functions accordingly.
2. A class Collection contains an array of 100 integers.
Using the following class description, create an array with common elements from
two integer [Link] of the members of the class are given below: (5)
Class Name:- Collection
Data Members / Instance Variables
int arr[] : an array of 100 integers
int len : length of the array
Member Functions / Methods
Collection() : default constructor
Collection(int) : parameterised constructor to assign the length of the array
void readArray() : to accept array elements
Collection common(Collection) : returns the Collection containing the
common elements of the current Collection object and the Collection object
passed as parameter
void displayArray() : to display the array elements
Define the class Collection by writing the complete Java code for the above class.
You need not write the main() function.
3. Write a Java program to input a sentence from the user in lowercase and
remove the first and the last characters of every word in it. (10)
Sample Input :- i love java for school.
Sample Output:- ov av o choo
Some of the data members and member functions are given below:
Class Name:- Remove
Data Members / Instance Variables
sent : stores the sentence
rem : stores the new sentence
size : stores the length of the sentence
Member Functions
Remove() : default constructor
void readsentence() : to accept the sentence
void remfirstlast() : extract each word and remove the first and the last
alphabet of the word and form a new sentence rem using the changed words
void display() : display the original sentence along with the new changed
sentence
Specify the class Remove giving details of the constructor Remove(),
void readsentence(), void remfirstlast() and void display().Define the main()
function to create an object and call the functions accordingly to enable the task.
SECTION – B (Attempt in not more than 30-35 minutes)
4. (a) Verify using the truth table: A + A = A . Also state the law. (1)
(b) If X ⇒ YX ,then write its:
(i) Converse
(ii) Contrapositive (2)
(c) Show how a NAND gate can be used to construct an OR gate.(2)
5. A man goes to a matrimonial office to search for a bride. The office has
information about 10,000 girls.
The man gives the following two conditions:
The girl must be a teacher or a graduate.
The girl must be 25 years or less and beautiful.
The inputs are:
G – The girl is a graduate
T – The girl is a teacher
A – The girl is 25 years or less
B – The girl is beautiful
The output is:
S – The girl is selected
(1 indicates selected and 0 indicates rejected)
(a) Draw the truth table for the inputs and output given above and write the
POS expression for S (G , T , A , B ) (5)
(b) Construct the logic circuit diagram for the following:
(i) Half Adder using only NAND gates (2)
(c) What are universal gates? Draw the AND gate using a universal gate.(3)
6. (a) Define a Full Adder. Write the Boolean expression and draw the logic
diagram for a Full Adder.(5)
(b) Draw the truth table for each of the following Boolean expressions:
(i) A + (AB + C) (ii) A′B + AB′ + C (4)
(c) Mention two limitations of integer numbers.(1)
SECTION – C (Attempt in not more than 20 minutes)
7. Perform the following conversions / operations:
(i) Convert (110101101)2 = (?)8 [1] (ii) Convert (345.33)8 = (?)2 [1]
(iii) Convert (89392)10 = (?)16 [1] (iv) Subtract:-
(1010)2 from (1101)2 using 1’s complement [1] (v) Multiply
(1101)2×(111)2 [1]
8. Write the output (4)
b) . What do you mean by Absoption Law . (1)
9. (a) Define the break statement. [1] (b) Name two Java packages. [1]
the following expression:- ∼p+(∼q) [1] (e) Refer to the
(c) What do you mean by debugging? [1] (d) Write the statement for
propositional statements given below:
P: Today is a holiday
q: I will go to attend a birthday party [1]
10. (a) Show that the expression. p∧(p∨q)=p [1] (b) Draw the truth
table for the following expressions: AB′C+A(B+C) [1] (c) Differentiate
between ASCII and Unicode. [1] (d) Perform the arithmetic operation:
Add the hexadecimal numbers (1F5C)16 and (AC2B)16 [1]
(e) What do you understand by the Binary Number System? [1]