Professional Documents
Culture Documents
1|Pa ge
Computer Science, Class XII (2017-18)
void main ( )
{Game A('G'), B;
B.show();
A.play(11);
A.change();
B.play(25);
A.show();
B.show();
}
void Game::change()
{Type=(Type=='P')?'G':'P';
}
void Game::play(int GS)
{score+=GS; if
(score>=30)
level=3;
else if (score>=20)
level=2;
else
level=1;
}
9. Define a class BALANCED_MEAL in C++ with following description:
Private Members:
Access number Integer
Name of Food String of 25 characters
Calories Integer
Food type String
Cost Float
AssignAccess( ) Generates random numbers
between 0 to 99 and return it.
Public Members
A function INTAKE( ) to allow the user to enter the values of Name of Food, Calories, Food type, cost
and call function AssignAccess() to assign Access number.
A function OUTPUT( ) to allow user to view the content of all the data members, if the Food type is
fruit.
2|Pa ge
Computer Science, Class XII (2017-18)
A function Buy( ) to allow user to enter values for ICode, ItemName, Price, Qty and call function
FindDisc( ) to calculate the discount.
A function ShowAll( ) to allow user to view the content of all the data members.
11. Answer the questions (i) and (ii) after going through the following class: /*CBSE 2015*/
class Passenger
{ long PNR;
char Name[20];
public:
Passenger( ) { cout<<”Ready”<<endl; } //Function1
void Book (long P, char N[ ]) // Function2
{ PNR=P; strcpy(Name,N); }
void Print ( ) // Function3
{ cout<<PNR<<Name<<endl; }
12. Answer the following questions (i) and (ii) after going through the following class. /*CBSE 2006*/
class Exam
{ int Year;
public:
Exam( ) //Constructor 1
{ Year=2015; }
Exam(int y) //Constructor 2
{Year=y; }
Exam(Exam &t); //Constructor 3
};
(i) Create an object, such that it invokes Constructor 2.
(ii) In Object Oriented Programming, what is Constructor 1 referred as and when does it get
invoked/called? Write its calling statement.
(iii) Write complete definition for constructor 3 and what is the purpose of using it?
(iv) Which feature Object Oriented Programming is demonstrated using Constructor1,
Constructor2, and Constructor 3 in the above class text?
13. What do you mean by DBMS? Give two advantages of DBMS.
14.What is a Candidate Key, Primary Key and Alternate key? Give suitable example of each from a table
containing some meaningful data.
15. What do you understand by the terms Degree & Cardinality of a relation in relational database?
16. Explain the concept of Cartesian product between two relations, with the help of appropriate example.
17. What is a relation? What is the difference between a tuple and an attribute? /* CBSE 1998 */
18. What do you understand by selection and projection operations in relational algebra? /* CBSE 2011 */
3|Pa ge
Computer Science, Class XII (2017-18)
19. What do you mean by constraint? Give its examples. Write similarity and dissimilarity between
primary key and unique constraints.
20.What are aggregate functions? Give its example & explain any of one with an example.
21.Write SQL commands (a) to (m) and outputs (n) to (s) on the basis of Teacher relation given below:
4|Pa ge
Computer Science, Class XII (2017-18)
25.Draw a Logical Circuit Diagram for the following Boolean Expression: /* CBSE 2008 */
A . (B + C')
26.Draw the circuit diagram for the following Boolean expression :
(A+B)(A’+B)(A+B’)
27.Convert the following Boolean expression, into its equivalent Canonical Product of Sum Form(POS) :
A. B' .C + A'. B. C + A'. B. C' /* CBSE 2008 */
28.Convert the following Boolean expression into its equivalent Canonical Sum of Product Form(SOP):
(X’+Y+Z’).(X’+Y+Z).(X’+Y’+Z).(X’+Y’+Z’).
29.Write the equivalent Canonical Product of Sum Expression for the following Sum of Product Expression
F(X, Y, Z) = ∑ /* CBSE 2007 */
30.Write the equivalent expression for the following logical circuit: /* CBSE 2006 */
31.Reduce the following Boolean expression using K-Map: /* CBSE 2006 Comp. */
F(P,Q,R,S)=∑(l,3,5,8,11,12,15 )
32.Reduce the following Boolean expression using K-Map: /* CBSE 2006 */
F(P, Q, R, S) = π (0,3,5,6,7, 11, 12, 15)
33.Reduce the following Boolean expression using K - Map: /* CBSE 2009 */
H(U,V,W,Z) = (0,1,4,5,6,7,11,12,13,14,15)
5|Pa ge
Computer Science, Class XII (2017-18)
6|Pa ge