Sample Paper - Computer-Xii
Sample Paper - Computer-Xii
Sample Paper - Computer-Xii
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 The intended marks for questions or parts of questions are given in
brackets [ ].
---------------------------------------------------------------------------------------------------------
PART I – 20 MARKS
(Answer all questions.)
While answering questions in this Part, indicate briefly your working and
reasoning, wherever required.
Question1)
i) The propositional operator => represents: [1]
(a) Conjunction
(b) Implication
(c) Disjunction
(d) Negation
(iii) The ability of an object to take many forms is known as: [1]
(a) inheritance
(b) data abstraction
(c) overriding
(d) polymorphism
iv)If A=1, B=0, C=0 and D=1, then the maxterm will be: [1]
(a) AB’C’D
(b) A’BCD’
(c) A+B’+C’+D
(d) A’+B+C+D’
vi)State involution law and prove it with the help of truth table. [1]
vii)Show that X ˅ ~(Y ˄ X) is a tautology. [1]
viii) Write minterms and maxterms when the inputs are A=0, B=1,C=1 and D=0. [1]
ix) Draw the logic circuit of a NAND gate using NOR gate only. [1]
x) Differentiate between keyword extends and implements with reference to inheritance. [1]
Question 2) a) An array AR(-4….6][-2….12] , stores elements in row major wise, with the
address AR[2][3] as 4142. If each element requires 2 bytes of storage , find the base address.
[2]
b) Convert the following infix expression into its postfix form.
(A+B/C)+B-C*D+C [2]
c) Write the Principal of Stack and Queue [2]
d) The following function strange (int x int y) is a part of some class. Answer the given
questions with dry run or working:
int strange(int x and int y)
{
if(x>=y)
{
x=x-y;
return strange(x,y);
}
else
return x;
i) What will the function strange(20,5) returns when invoked? [2]
ii) What will the function strange(15,6) returns when invoked? [2]
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.)
ii) Given the Boolean function F(A,B,C,D) = π(0, 1, 3, 5, 6, 7, 9, 11, 13, 14, 15).
(a) Reduce the above expression by using 4-variable Karnaugh map, showing the various
groups(i.e. octal, quads and pairs). [4]
(b) Draw the logic gate diagram for the reduced expression. Assume that the variables and
their complements are available as inputs. [1]
Question4) a) A person is allowed to travel in a reserved coach of the train, if he/she satisfies
the criteria given below:
• The person has a valid reservation ticket and a valid ID proof.
OR
• The person does not a valid reservation ticket,but holds a valid pass issued by the
Railway department with a valid ID proof.
OR
• The person is a disabled person and holds a valid pass issued by the Railway
department with a valid ID proof
The inputs are
R: The person has a valid reservation ticket
P: The person holds a valid pass issued by the Railway department
D: The person has a valid ID proof.
H: The person is a disabled person
( 1 indicates yes and 0 indicates No in all the cases)
Output
T: Denotes allowed to travel( 1 indicates yes and 0 indicates no in all the cases)
Draw the truth table for the inputs and outputs given above and write the POS expression for
T( R,P,D,H).
[5]
b) What is full adder? Draw circuit diagram for full adder. [3]
c) Convert the following function into its canonical sum of product form
F(X,Y,Z) =Ʃ(0,1,5,7) [2]
SECTION B( 20 marks)
(Attempt any two questions)
Question 6) Write a program to check whether a number is prime or not recursively.
Class name :prime
Data members
int n;
Member function
Prime() – default constructor
public void enter()- To accept the value of n
public int check(int a)- To check whether a number is prime or not recursively.
public void display() – To display number as well as it is prime or not.
Define all functions along with the main functions.
Question 7) A class myarray contains an array of n integers . The subscript of the array
elements vary from 0 to n-1. Some of the members of the class myarray are given below:
Class name : myarray
Data members
Arr[] : integer array to store elements.
n: size of the array
Member functions:
myarray() : constructor to initialise 0 in each memory location of arr[]
myarray(int size): parametised constructor to initialise n=size
void readarray(): to read n integers into the array arr[]
void bubsort(): sorts the array in ascending order using bubble sort technique
void display() : display n integers horizontally
int search(int num) : searches for the element num in the sorted arrayusing binary search
technique and returns the position of the array element if num is found otherwise returns -9999.
Specify the class myarray giving the details of the constructors and functions void array(),
bubsort() , display(), int search(int num) . Write the main function to create the object and call
the functions.
SECTION C
(10 MARKS)
(Attempt any two questions)
Question-9) In a school, during the examination the students are allowed to enter in the hall
on first come and first serve basis and will sit in a queue and also allowed to go out in he same
sequence after the examination is over. A maximum of 50 students can be accommodated in
the hall. [5]
To perform this task, design a class examination with the following details:
Class name : Examination
Data members/instance variables
Name[] : stores the name of the students
Front : points the index of the front of the queue
Rear : points the index of the rear of the queue
Max : stores the maximum capacity of the hall.
with the Member functions/methods
Examination(int cap) : paramtized constructor to initialize max=cap and front=0 and rear=0.
Void entry(String na) : adds the name of the student(na) at the rear index, if possible otherwise
, displays the message “HALL IS FULL”.
String exit(): allow the student to exit from the front, if the students are in the examination hall
and return , otherwise return “NULL”.a
Void display() : displays all the names in the queue, if possible otherwise display a message
“HALL IS EMPTY”.
Specify the class examination giving the details of the constructor and other functions. The
main function need not be written .
Question 10)Strange is an entity which can hold at the most 20 integers. The strange restriction is that
an integer can only be added from the top or removed from the top. This is like a pile of china plates,
where we can add a plate to the pile from the top and remove a plate from the top only. Define a class
strange with the following details: [5]
Data members
Member function
Strange (int cap) : constructor to initialise the data capacity =cap, top=-1
Void pushitem(int value) : adds the integer value to the top of strange if possible, otherwise output the
message”Strange is full, cannot push item”
Int popitem() : removes the integer from the top of strange and returns it if strange is not empty,
otherwise outputs a message “Strange is empty” and returns -9999.
a) Specify the class strange giving details of he constructor and the functions void pushitem(int
value) and popitem() only. The main function need not be written. [4]
b) What is the common name of the entity described above? [1]
Q11)
B C
D E F G
a) Write in-order, post-order and pre-order of the above binary tree [2]
b) Write the sibling of B. [1]
c) What is the depth of the binary tree? [1]
d) Write the leaf nodes of binary tree [1]