CBSE Class-12 Question Papers for IOP/Comptt Examination 2017 : All India Scheme, Computer Science

Disclaimer: This website is NOT associated with CBSE, for official website of CBSE visit - www.cbse.gov.in

CBSE Class-12 Question Papers for IOP/Comptt Examination 2017

All India Scheme, (Computer Science)

CBSE Class-12 Question Papers for IOP/Cmptt Examination :  Computer Science

COMPUTER SCIENCE

Time allowed : 3 hours

Maximum Marks : 70

SECTION – A

(Only for Candidates, who opted for C++)

1. (a) Write the type of C++ tokens (keywords and user defined identifiers) from the following : 2
(i) case
(ii) _delete
(iii) WHILE
(iv) 21stName

(b) Jayneel has just started learning C++. He typed the following C++ code and during
the compilation of the code, he got some errors. When Jayneel asked his teacher,
the teacher told him to include necessary header files in the code. 1
Write the names of those header files, which Jayneel needs to include, for
successful compilation and execution of the following code.
void main()
{
cout <<"We win !"<<endl;
cout <<strlen("The World")<<endl ;
}
(c) Rewrite the following C++ code after removing any/all syntactical errors with each
correction underlined. 2
Note : Assume all header files required in the code are already being included.
#define 10*Number MAX(Number)
void main()
{
int Num,NewNum;
cout<<"Number:";
cin<<Num;
if Num<10
NewNum=MAX(Num);
else
NewNum=Num-2;
cout<<"New Number:"<<NewNum<<end;
}
(d) Find and write the output of the following C++ program code : 2
Note : Assume all required header files are already included in the program.
void Decider(int &K,int L=70)
{
if (K>L)
K-=L;
else
K+=L;
}
void main()
{

int M=100,N=40;
Decider(M,N);
cout<<M<<"#"<<N<<endl;
Decider(M);
cout<<N<<"#"<<M<<endl;
}
(e) Find and write the output of the following C++ program code : 3
Note : Assume all required header files are already being included in the program.
void DispScore(int S[],int N)
{
for(int Count = 0;Count<N;Count++)
cout<<S[Count]<<"#";
cout<<endl;
}
void main()
{
int *Point,Score[]={10,5,20,15};
Point=Score;
DispScore(Score,2);
for(int Count=0; Count<4; Count++)
{
cout<<*Point<<":";
if(Count%2==0)
Point++;
else
{
*Point +=10;
Point++;
}
}
cout<<endl;
DispScore(Score,4);
}
(f) Look at the following C++ code and find the possible output(s) from the options (i) to (iv) following it. Also, write the maximum values that can be assigned to each of the variables Low and High. 2
Note :
• Assume all the required header files are already being included in the code.
• The function random(n) generates an integer between 0 and n – 1.

void main()
{
randomize();
int Low=2+random(3),High=5+random(3);
int C[] = "ABCDEFGHIJ";
for(int I=Low;I<=High;I++)
cout<<C[I];
cout<<endl;
}

(i)

(ii)

BCDE

CDEF

(iii)

(iv)

CDE

DCEFG

2. (a) Differentiate between Data Hiding and Data Encapsulation in context of Object
Oriented Programming. Also give a suitable example illustrating the same in C++. 2
(b) Observe the following C++ code and answer the questions (i) and (ii).
Note : Assume all necessary files are included.
class GAME
{
int Pcode,Round,Score;
public:
GAME() //Member Function 1
{
Pcode=1;Round=0;Score=0;
}
GAME(GAME &G) //Member Function 2
{
Pcode=G.Pcode+1;
Round=G.Round+2;
Score=G.Score+10;
}
};
void main()
{
_____________ //Statement 1
_____________ //Statement 2
}

(i) Which Object Oriented Programming feature is illustrated by the Member
Function 1 and Member Function 2 together in the class GAME ? 1
(ii) Write Statement 1 and Statement 2 to execute Member Function 1 and
Member Function 2 respectively. 1
(c) Write the definition of a class FRAME in C++ with following description : 4
Private Members
- FID // data member of integer type
- Height // data member of float type
- Width // data member of float type
- Amount // data member of float type
- GetAmount() // Member function to calculate and assign
// Amount as 10*Height*Width
Public Members
- GetDetail() // A function to allow user to enter values of
// FID, Height, Width. This Function should
// also call GetAmount() function to calculate
// Amount
- DispDetail() // A function to display the
// values of all data members
(d) Answer the questions (i) to (iv) based on the following : 4
class DIGITAL
{
int ID;
protected:
float Amount;
int Seconds;
public:
DIGITAL();
void Register(); void Disp();
};
class PRINT
{
int PID;
protected:
float Amount;
int SQinch;
public:
PRINT();
void Get();
void Print();
};
class MEDIA : Public PRINT, private DIGITAL
{
int MID;

public:
MEDIA();
void Enter();
void Print();
};
void main()
{
MEDIA M; //Statement 1
__________; //Statement 2
}
(i) Which type of Inheritance out of the following is illustrated in the above example ? – Single Level Inheritance, Multilevel Inheritance, Multiple Inheritance
(ii) Write the names of all the member functions, which are directly accessible by the object M of class MEDIA as declared in main( ) function.
(iii) What will be the order of execution of the constructors, when the object M of class MEDIA is declared inside main ( ) ?
(iv) Write Statement 2 to call function Print( ) of class PRINT from the object M of class MEDIA

 

Click Here to Download Computer Science

Courtesy: CBSE