Computer Gp 1
Computer Gp 1
Q.1
(i)Which of the following Boolean laws is correct? [1]
(a) A + AꞌB = A
(b) A(A + B) = A
(c) A(B + C) = AB + AC
(d) (A + B)(A + C) = A + BC
(vi) Assertion: Boolean algebra and binary number system have some similarities. Reason:
Basic operations like AND, OR and NOT are common. [1]
(a) A is true, R is true and R correctly explains A
(b) A is true, R is true but R does not correctly explain A
(c) A is true but R is false
(d) A is false but R is true
(vii) What is the purpose of static for class data members? [1]
(x) Give one application each of half adder and full adder. [1]
Question 2:
(i) Convert the following infix expression to postfix form:
(P + Q) * (R – S) / T [2]
(iii) Void Reverse (char arr [], int start , int end) {
If (start < end) {
Char temp = arr[start];
Arr[start] = arr[end];
Arr[end] = temp;
Reverse (arr, start + 1, end – 1);
}
}
(a) What will be the output of ProcessString() when called with the input string
"JAVA"?
(b) What will be the output of ProcessString() when called with the input string
"HELLO"?
(c) Explain the functionality of the Reverse function and how it affects the output
(a) What should be replaced at ?1? to initialize the variable 'result' correctly?
(b) What should be replaced at ?2? to correctly compute the factorial within the loop?
(c) What should be replaced at ?3? to return the correct factorial value at the end of
the function?
PART II – 50 MARKS
Answer six questions in this part, choosing two questions from Section A, two
Question 3
A software engineer is designing a program that evaluates whether a computer
• If the CPU and Memory perform well but the Storage does not perform
well.
OR
• If the GPU and Storage perform well but the CPU does not perform well.’
OR
Draw the truth table for the inputs and outputs given above and write the Sum of
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
(i)
variable Karnaugh map. Clearly show the octal, quads, and pair groups.[4]
(b) Draw the logic gate diagram for the simplified expression. Assume that the
(ii)
Karnaugh map to reduce the expression. Identify octal, quads, and pairs
groups.[4]
(b) Create the logic gate diagram for the simplified expression. Assume the
Question :5
(a) Draw the logic circuit for a 3-to-8 decoder. Also, provide the truth table for the
decoder. (5)
(b) Write the SOP (Sum of Products) expression for the given Boolean function:
G(A,B,C)=𝜮(0,2,4,5). (2)
Question-6:
Design a class named “GoodNumber” to check if a given positive integer is a Good
Number or not. A Good Number is defined as a number that contains an odd number
of 1’ s in its binary equivalent.
Class name : Good
Data members/instance variables:
num : to store a positive
integer number bin : to
store the binary equivalent
Methods / Member
functions:
Evil( ) : default constructor to initialize the
data member with legal initial value
void accept Num( ) : to accept a positive integer number
void rec_bin (int x) : to convert the decimal number
into its binary equivalent using recursive technique
void check( ) : to check whether the given number is
an Good number by invoking the function rec_bin()
and
to display the result with an
appropriate message
Specify the class Good giving details of the constructor( ), void acceptNum( ),
void rec_bin(int) and void check( ). Define a main( ) function to create an
object and call all the functions accordingly to enable the task.
Question 7
Question 8:
To translate word into Piglatin word, convert the word into uppercase and then
place the first vowel of the original word as the start of the new word along with the
remaining alphabets. The alphabets present before the vowel being shifted
towards the end followed by "AY".
Sample Input 1:
London Output:
ONDONLAY
Question : 9
A bookshelf is designed to store the books in a stack with LIFO(Last in First Out)
operation. Define a class book with the following specifications:
Class Name Book
Data members/instance variable:
Name[ ] : Stores the names of the book
Point : Stores the index of the topmost book
Max : Stores the maximum capacity of the bookshelf
Methods/Member Functions:
Book(int cap) : Constructor to initialise the data member max
= cap and point = -1
Void tell ( ) : Displays the name of the book which was last
Entered in the shelf. If there is no book left in
The shelf, displays the message
“SHELF EMPTY”
Void add(String v) : adds the name of the book to the shelf if
Possible, otherwise displays the message
“SHELF FULL”
Void Display ( ) : Displays all the names of the books available
In the shelf
Specify the class Book giving the details of ONLY the functions void tell ( ) and void
add (String). Assume that the other function have been defined.
The main function need not be written.
Question:10
A line on a plane can be represented by coordinates of the two-ends points p1 and p2
as p1(x1, y1) and p2(x2, y2).
A super class Plane is defined to represent a line and a sub class Circle to find the
length of the radius and the area of circle by using the required data members of
super class.
Some of the members of both the classes are given below:
(b) Answer the following questions from the diagram of a Binary Tree Given below: