Computer Sample Paper2013

Only available on StudyMode
  • Download(s) : 113
  • Published : February 22, 2013
Open Document
Text Preview
Sample Paper -2013
Sub:Computer Science
Class – XII
Time: 3Hours Maximum Marks: 70
Note. (i) All questions are compulsory.
(ii) Programming Language: C++
1.(a) Give the difference between the type casting and automatic type conversion .Also, give a suitable C++ code to illustrate both. 2 1.(b) Which C++ header file(s) will be essentially required to be included to run /execute the following C++ source code (Note : Do not include any header file, which is/are not required): 1 void main()

{
char Text[ ]="SomeThing";
cout<<”Remaining SMS Chars:”<<160-strlen(Text)<<endl; }
1.(c) Rewrite the following program after removing the syntactical errors (if any). Underline each correction. 2

#include <iostream.h>
class Book
{
Long Bid,Qty;
Public:
void Purchase(){cin>>Bid>>Qty;}
void Sale{cout<<setw(5)<<Bid<<”Old:”<<Qty<<endl; }};
void main()
{
Book B;
B.Purchase();
B.Sale()
Sale.B();
Sale();
}
1.(d). Find the output of the following program: 3
#include<iostream.h>
#include<conio.h>
#include<ctype.h>

class Metro
{
int Mno,TripNo,PassengerCount;
public:
Metro(int Tmno=1)
{
Mno=Tmno;
TripNo=0;
PassengerCount=0;
}
void Trip(int PC=20)
{
TripNo++;
PassengerCount+=PC;}
void StatusShow()
{
cout<<Mno<<":"<<TripNo<<":"<<PassengerCount<<endl;} } ;
void main()
{
Metro M(5),T;
M.Trip();
T.Trip(50);
M.StatusShow();
M.Trip(30);
T.StatusShow();
M.StatusShow();
}
1.(e). Find the output of the following program: 2

#include<iostream.h>
#include<conio.h>
#include<ctype.h>
typedef char Str80[80];
void main()
{
clrscr();
char *Notes;
Str80 Str="vR2GooD";
int L=6;
Notes=Str;
while(L>=3)
{
Str[L]=(isupper(Str[L])?tolower(Str[L]):toupper(Str[L])) ; cout<<Notes<<endl;
L--;
cout<<L;
Notes++;
cout<<Notes;
}
}

1.(f). Observe the following program and find out, which output(s) out of (i) to (iv) will not be expected from the program? What will be the minimum and the maximum value assigned to the variable Chance? 2

#include<iostream.h>
#include<stdlib.h>
void main( )
{
randomize( );
int Arr[ ]={9,6},N;
int Chance=random(2)+10;
for(int I=0; I<2;I++)
{
N=random(2);
cout<<Arr[N]+Chance<<”*”;
}
}
(i) 9*6*
(ii) 19*17*
(iii) 19*16*
(iv) 20*16*

2 (a) What do you understand by Data Encapsulation and Data Hiding? Also, give a suitable C++ code to illustrate both. 2 2 (b) Answer the questions (i) and (ii) after going through the following class: 2

class Travel
{
int PlaceCode ; char Place[20];float Charges;
public: Travel( )//Function 1
{
PlaceCode=1; strcpy (Place,”DELHI”); Charges=1000;
}
void TravelPlan(float C)//Function 2
{
cout<<PlaceCode<<”:”<<Place<<”:”<<Charges<<endl; }
~Travel( )//Function 3
{
Cout<<”Travel Plan Cancelled”<<endl;
}
Travel (int PC,char P[ ],float C)//Function 4
{
PlaceCode=PC; strcpy (Place,P);Charges=C;
}
};
i) In Object Oriented Programming, what are Function 1 and Function 4 combined together referred as? ii) In Object Oriented Programming, which concept...
tracking img