XII Computer Science (1st monthly test) SET-CSO1
Attempt all questions. Max
Marks: = 50
Q1) Differentiate Object Oriented Programming and Procedural programming? (2)
Q2) What are
various OOPS Concepts .Explain them in brief. (4)
Q3) What are
constructors and destructors. Demonstrate their use by making C++ program. (2)
Q4) What is this
pointer?
(2)
Q5) What is
Function Overloading? Explain with example. (2)
Q6) Write an OOP
C++ program implementing classes to implement class complex and add two complex
no(using function). (4)
Q7) Explain
various types of Constructors with example.
(4)
Q8) How many
destructors can be used in program.Can destructors be overloaded.Give reasons
for any of your answers.(4)
Q9) Define scope
resolution operator and briefly explain its purpose. (2)
Q10).
Rewrite the following code using do while looping construct: (2)
i=100;
while(i)
cout<<i-
-;
cout<<
“ Thank you”;
Q11)
Evaluate the following, where a, b, c are integers and d, f are floating point
numbers.(3)
The value of a=8, b=4 and d=2.5
(i)
f
= a * b + a/b
(ii)
c
= d+a + b % a
(iii)
c=[
(++a) * (b++) + (++d) ] *[f = (++b) / b – a %b ]
Q12). What is
the difference between entry controlled loop and exit controlled
loop? Explain with example. (2)
Q13) What is copy constructor
? When it is invoked ? Support your answer with an example. (3)
Q14) What will be the output? (7)
Class A { int a;
Public : A() { cout<<“Default
constructor called\n”;}
A(int x) {
a=x; cout<<“Single argument constructor called\n”<<”a=”<<a;}
A(class
& ob1) { a=ob1.a + 1 ;
cout<<“Copy constructor called\n”
<<”a=”<<a;}
~A() {
cout<<“Destructor called\n”;} };
Void main ()
{ A
ob1,ob2,ob3;
{
A ob4(10); A ob5=20;
A ob6 =ob4;
{
A ob7,ob8;
ob5=ob4;
}
}
}
Q15) Identify the errors and correct it. (7)
Class ABC {
int a;
private : int b;
protected : int c ;
public int d;
void f1(){};
ABC (int y){ a=y;};
private : void f1(){};
protected : void f2(){};
public : void f3(){};
};
Void main ()
{
Class ABC X,Y ;
X.a;
Y.b;
X.c ;
X.f1();
X.f3();
Y.f2();
}