XII-B Monthly Test (July 2013) SAMPLE PAPER Subject : Computer Science
KENDRIYA VIDYALAYA NO. 1 ,
NAUSENABAUGH, VISAKHAPATNAM
Monthly Test (July 2013) SAMPLE PAPER Subject
: Computer Science
Class : XII
Section : B Duration: 90
Min. Max Marks :40
Attempt all questions.
Q1. What is Memory Leak? What
are the reasons ? How to avoid it?
2M
Q2. Explain the concept of
Array of pointers with a Program. 4M
Q3. Explain the concept of
passing address(pointer) as an argument to the Function 4M
Q4. Write code in C++ to
implement the following types of inheritance : 6M
(i)
Multiple Inheritance (II) Multilevel Inheritane
(III) Hybrid Inheritance
Q5.Write an OOP and
implement following in it :
10M
1.Default
Constructor 2.
Parameterized constructor
3.Copy
constructor 4.Destructor 5.Function
overloading
Q6. Consider the following declarations and answer
the questions given below: 4M
class Animal
{
int leg:
protected:
int tail;
public:
void INPUT (int );
void OUT ( );
};
class wild : private Animal
{
int carniv;
protected:
int teeth;
Public:
void INDATA (int, int )
void OUTDATA( );
};
class pet : public Animal
{
int herbiv;
public:
void Display (void);
};
(i) Name the base class and derived class of the class
wild.
(ii) Name the data member(s) that can be accessed from
function Display ( ).
(iii) Name the member function(s), which can be accessed
from the objects of class pet.
(iv) Is the member function OUT ( ) accessible by the
objects of the class wild?
Q7.Find the output of the following program: 4M
#include<iostream.h>
void main()
{ intX[]={10,25,30,55,110};
int*p=X;
while(*p<110)
{ if(*p%3!=0) *p=*p+1;
else *p=*p+2;
p++;
}
for(inti=4;i>=1;i--)
{cout<<X[i]<<"@";
if(i%3==0)cout<<endl; }
cout<<X[0]*3<<endl;}
#include<iostream.h>
void main()
{ intX[]={10,25,30,55,110};
int*p=X;
while(*p<110)
{ if(*p%3!=0) *p=*p+1;
else *p=*p+2;
p++;
}
for(inti=4;i>=1;i--)
{cout<<X[i]<<"@";
if(i%3==0)cout<<endl; }
cout<<X[0]*3<<endl;}
Q8.Give the output of the
following program segment (assume all required header files are included in the
program):
3M
char *NAME= "a
ProFile";
for(int
x=0;x<strlen(NAME);x++)
if(islower(NAME[x]))
NAME[x]=toupper(NAME[x]);
else
if(isupper(NAME[x]))
if(x%2!=0)
NAME[x]=tolower(NAME[x-1]);
else
NAME[x]--;
Cout<<NAME<<endl;
if(islower(NAME[x]))
NAME[x]=toupper(NAME[x]);
else
if(isupper(NAME[x]))
if(x%2!=0)
NAME[x]=tolower(NAME[x-1]);
else
NAME[x]--;
Cout<<NAME<<endl;
Q9.Find the output of the
following program: 3M
#include<iostream.h>
struct Game
{ char magic[20];
int score; };
void main()
#include<iostream.h>
struct Game
{ char magic[20];
int score; };
void main()
{
Game M={"Tiger", 500}; Char * Choice;
Choice =M.Magic; Choice[4]='P'; Choice[2]='L'; M.Score+=5;
cout<< M.Magic<<M.Score<<endl; Game N=M; N.Magic[0]='A'; N.Magic[3]='J';
N.Score-=120; Cout<<N.magic<<N.Score<<endl;
Game M={"Tiger", 500}; Char * Choice;
Choice =M.Magic; Choice[4]='P'; Choice[2]='L'; M.Score+=5;
cout<< M.Magic<<M.Score<<endl; Game N=M; N.Magic[0]='A'; N.Magic[3]='J';
N.Score-=120; Cout<<N.magic<<N.Score<<endl;
}
****************************************************************************