0% found this document useful (0 votes)
10 views4 pages

Comp 2

The document outlines an examination paper for Computer Science (XII) with a total of 70 marks and a duration of 3 hours. It consists of two parts: Part I, which includes compulsory questions, and Part II, which contains sections A, B, and C where students must answer specific questions. Topics covered include Boolean algebra, data structures, and class design in programming.

Uploaded by

mishraneetu0103
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views4 pages

Comp 2

The document outlines an examination paper for Computer Science (XII) with a total of 70 marks and a duration of 3 hours. It consists of two parts: Part I, which includes compulsory questions, and Part II, which contains sections A, B, and C where students must answer specific questions. Topics covered include Boolean algebra, data structures, and class design in programming.

Uploaded by

mishraneetu0103
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Computer Science (XII) (THEORY)

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 rest of the answer.
MM: 70 Time:3 hrs.
PART I.
Answer all questions from part I
Q1. a) Commutative law is : [1]
i) a+ab=a ii) a.b=b.a iii) a+(b+c) =(a+b)+c iv) (a’)’=a
b) <=> operator is [1]
i) Conjunction ii) Disjunction iii) Implication iv) Equivalence
c) If A=0, B=1, C=0, D=1, then what is the Maxterm for it? [1]
i) A+B’+C+D’ ii) A+B+C+D’ iii) A’BC’D iv) A’B’CD
d) For A=>~B, inverse is: [1]
i) ~A=>B ii) B=>A iii) ~B=>A iv) ~B=>~A
e) Reduced expression for F(a,b,c)=π(0,2,4,6) will be: [1]
i) a’+b’ ii) a’b’+c iii) a iv) c
f) Write the Dual of (W’+Y).0=0. [1]
g) What will be printed by: [Link](“4587”.charAt(0)+ “4587”.length()); ? [1]
h) Draw a 2 to 4 decoder. [1]
i) What held in int variable x, if x= ‘a’; [1]
j) Draw two universal gates. [1]

Q2. a) Write the postfix of the following infix expression [2]


A*B+(C-D)^E/F
b) A double dimension array arr[-43………21][-18………34] is stored in column major [2]
format. Size of each element is 9 bytes. If the address of arr[-10][11] is 75000 then
what is the address of arr[20][32]?
c) int rambo(int a){if(a<10) return a; return rambo(a/10)*10+a%10;}
with respect to above code, what is being returned for the given values?
i) a=4582 [1]
ii) a=112 [1]
d) String some(String s){if([Link]()<=2) return s; return
some([Link](2))+[Link](0);}
i) What is returned if function call is some(“MISSISSPPI”); [2]
ii) What is returned if function call is some(“A1B2C3D4E5F6”); [2]

PART – II
SECTION - A
Answer any two questions
Q3. a) Given the Boolean function:
F (W,X,Y,Z) = Σ (1,3,5,7,9,11,14,15)
i) Reduce the above expression by using 4 - variable K-Map, showing the various [3]
groups (i.e.; octets, quads and pairs).
ii) Draw the Logic gate diagram of the reduced expression. Assume that the [2]
variable and their complements are available as inputs.
b) Given the Boolean function:
F (W, X, Y, Z) = π (1,3,5,7,9,11,13,14,15)

Page 1 of 4
i) Reduce the above expression by using 4 - variable K-Map, showing the various [3]
groups (i.e.; octets, quads and pairs).
ii) Draw the Logic gate diagram of the reduced expression. Assume that the [2]
variable and their complements are available as inputs.

Q4. i) A game of luck is being hosted, in which 4 coins (gold, silver, bronze, copper) are [5]
tossed. A winner is declared:
• if gold coin lands on tail.
• if silver coin lands on head with bronze coin also landing on head.
• if gold coin lands on head and copper coin lands on tail.
draw the truth table for the possibility of winning.
Inputs are:
G: gold coin landing
S: silver coin landing
B: bronze coin landing
C: copper coin landing
In all situations 0 means head and 1 means tail.
Output is W: 1 means winning 0 means loosing.
Reduce the sop expression using a K-Map and draw the gate diagram for reduces
expression.
ii) Reduce using laws of Boolean algebra [2]
(a+b+c).(a+b’+c).(a+b’+c’).(a’+b+c).(a’+b’+c’).(a’+b’+c)
[3]
iii) Draw an 8 to 3 encoder

Q5. a) Define and prove De Morgan’s law. [4]


b) Show and prove AND operation using NAND gates. [3]
c) Show and prove OR operation using NOR gates. [3]

PART – II
SECTION - B
Answer any two questions

Q6. An integer is said to be a Spy number, if sum and product of its digits are same. [10]
Design a class Named Spy with following description to check for a Spy number

Class Name Spy


Data members/ Properties
x // integer variable

Member function/ Methods


Spy // default constructor to set x with 4211
Spy // parameterised constructor to set the values x
sum /* non-parameterized function to return sum of
digits of x*/
product /* non-parameterized function to return product
of digits of x*/
check() /* function to check x for being Spy or not, using
member functions, and return true or false*/
Design the class Spy, giving details of all the data members and member functions.
Page 2 of 4
Q7. Given below are the specifications of a class. [10]
Class Name: MyArray
Data members / Properties
matter // integer array
Member functions/ Methods
MyArray // default constructor to create matter to hold 10 integers
MyArray // parameterized constructor to create matter of size given
fillMyArray // non-parameterized function to store natural numbers in matter.
rev // non-parameterized function to reverse the array.
print // non-parameterized function to print the array.
show /* non-parameterized function to show original array, reverse it
and then show it again, using above functions only. */
Define class MyArray giving details of all the functions and constructors.

Q8. In Camel case, first letter of a word is capital, followed by small letter and then capital [10]
and so on. For example InStRuCtIoN. Given below is a class to perform the same. Make
the class giving description of all data members and member functions, including the
constructors.
Class Name: Camel
Data members / Properties
sentence // String to hold the sentence
Member functions/ Methods
Camel /* default constructor to set sentence with “friends romans
countrymen”*/
Camel // parameterized constructor to set the value of sentence
toCamel /* parameterized function to accept a word and return it in camel
case*/
change //non-parameterized function to change each word of the
sentence into camel case, using function toCamel.*/
print // non-parameterized function to print the sentence
work /*non-parameterized function to print original sentence using
function print. Now change each word of sentence into camel
case. Now print the changed sentence using function print. */

PART – II
SECTION - C
Answer any two questions

Q9. A super class Record has been defined to store the names and ranks of 50 [5]
students. Define a sub-class Rank to find the highest rank along with the names.
Details of both classes are given below:

Class Name Record


Data members/ Properties
Name[] //stores names of students
Rnk[] //stores ranks of students

Member functions/ Methods

Page 3 of 4
Record // parameterised constructor to set the values of properties.
display // function to print names and their relevant ranks.

Class Name Rank


Data members/ Properties
index // integer to store the index of topmost rank
Member function/ Methods
Rank /* parameterised constructor to set the values of both the
classes. */
highest /* function to set index with the index of highest rank,
without sorting*/
display /*non-parameterized function to show names and their
relevant ranks, along with the names and rank of the toppers.
Assume that the super class Record has been defined. Using the concept of
inheritance,
specify the class Rank giving details of constructor, highest and display.
The super class and the main function need not be written.

Q10. A Stack is a data structure in which elements can be added and removed from only one [5]
end known as top. A class stack has been defined to perform the standard operations
needed for a stack.
Class Name: Stack
Data members / Properties
data // integer array.
top // integer to hold top index.
Member functions/ Methods
Stack /* default constructor to create data to hold 5 integers and set top
to -1*/
push /* parameterized function to add int to top if possible, otherwise
print “stack overflow”.*/
pop /* non parameterized function to return the value from top, if
possible, otherwise return -99 after printing stack underflow. */
print // non parameterized function to print elements, currently in stack.

Q11. a) Print the pre order traversal of this tree. [5]


b) Print all internal nodes of this tree.
c) Print the path to J.
d) What is the height of this tree.
e) Mention the nodes that share the same
generation as that of K.

Page 4 of 4

You might also like