Skip to main content

Diwali Assignment Oct 2014 XII B (CS)


22/Oct/2014 (KV Balasore 2014-15)



XII B (CS)


1). What is the difference between call by reference and call by value with respect to memory allocation ? Give a suitable example to illustrate using C++.

2). Define a class Competition in C++ with the following descriptions:

Data Members:
Event_no integer
Description char(30)
Score integer
qualified char

Member functions:
- A constructor to assign initial values Event_No number as 101, Description as “State level”, Score is 50 and qualified as ‘N’.
- Input(), To take the input for event_no, description and score.
-Award(int), To award qualified as ‘Y’, if score is more than the
cutoffscore passed as argument to the function else ‘N’.
-Show(), To display all the details.




3). Obtain output from following program after including the desired header files.

int main( )
{
int array [ ]={ 2, 3, 5, 6};
int *arptr = array;
int value =*arptr;
 cout<<value<<'\t';
value = *arptr++;
 cout << value <<'\t';
value = *arptr;
 cout << value <<'\t';
value = * ++arptr;
 cout<<value<<'\t';
getch();
return 0;
}


4). Obtain output from following program after including the desired header files.
 
int main( )
{
char *Text = "AJANTA";
int *p, array[ ]={ 5,6,8,20};
p=array;
 cout<<*p<<'\t'<<Text<<endl;
Text++;
p++;
 cout<<*p<<'\t'<<Text<<endl;
getch();
return 0;
}

5). Obtain output from following program after including the desired header files.

int main ( )
{
int Track [ ] = {10, 20, 30, 40}, *Striker ;
Stxiker=Track :
Track [1] += 30 ;
 cout<<"Striker>"<<*Striker<<end1 ;
Striker – =10 ;
Striker++ ;
 cout<<"Next@"<<*Striker<<end1 ;
Striker+=2 ;
 cout<<"Last@"<<*Striker<<end1 ;
 cout<< "Reset To" <<Track[0] <<end1 ;
return 0;
}

7).  Obtain output from following program after including the desired header files.

int main ( )
{
int *Queen, Moves [ ] = {11, 22, 33, 44};
Queen = Moves;
Moves [2] + = 22;
 Cout<< "Queen @"<<*Queen<<end1;
*Queen - = 11;
Queen + = 2;
 cout<< "Now @"<<*Queen<<end1;
Queen++;
 cout<< "Finally@"<<*Queen«end1;
 cout<< "New Origin @"<<Moves[0]<<end1;
return 0;
}


8).  Obtain output from following program after including the desired header files.

int main()
{
char C1 ='A';
char C2 ='D';

char *i, *j;
i = &C1;
j = &C2;
i = j;
 cout << *i;
getch();
return 0;
}

9). Find the output of the following program:

#include<iostream.h>
void Indirect(int Temp=20)
{
   for(int I=10;I<=Temp;I+=5)
   cout<<I<<”,”;
   cout<<endl;
}
void Direct(int &Num)
{
   Num+=10;
   Indirect(Num);
}
int main( )
{
  int Number=20;
  Direct(Number);
  Indirect( );
  cout<<”Number =”<<Number<<endl;
return 0;
}

10). How is &p different from *p ?

11). Identify the syntax error(s), if any, in the following program. Also give reason for errors.

int main()
{
const int i = 20;
const int * const ptr = &i;
*ptr++;
int j= 15;
ptr = &j;
return 0;
}



Enjoy ...  :-)

Popular posts from this blog

Project Work for Class XII Informatics Practices (065) - CBSE 2020-2021

  Marks  allotted : 05 Marks A. PROJECT GUIDELINES The aim of the class project is to create tangible and useful IT application. The learner may identify a real-world problem by exploring the environment. e.g. Students can visit shops/business places, communities or other organizations in their localities and enquire about functioning of the organization, and how data are generated, stored, and managed. The learner can take data stored in csv or database file and analyze using Python libraries and generate appropriate charts to visualize. If an organization is maintaining data offline, then the learner should create a database using MySQL and store the data in tables. Data can be imported in Pandas for analysis and visualization. Learners can use Python libraries of their choice to develop software for their school or any other social good. Learners should avoid plagiarism and violation of copyright issues while working on projects. Any resources (data, image etc.) used in t...

Assignments - XII Computer Science

POINTERS ASSIGNMENT Assignment Date: 09/09/15 Submission Date: 14/09/15 Q1. What will be the output of the following program: int main() { int x [ ] = { 50, 40, 30, 20, 10}: int *p, *t; p = x; t = x + 1; cout << *p << “,” << *t++; return 0; } Q2. What will be the output of the program( Assume all necessary header files are included) void print (char * p ) { p = "Comp"; cout<<"value is "<<p<<endl; } int main( ) { char * x = "Class XII"; print(x); cout<<"new value is "<<x<<endl; return 0; } Q3. Identify errors on the following code segment, and underline the error. float c[ ] ={ 1.2,2.2,3.2,56.2}; float *k,*g; k=c; g=k+4; k=k*2; g=g/2; cout<<”*k=”<<*k<<”*g=”<<*g; Q4. Write the output of the following program. void print (char * p ) { p = "Comp"; cout<<"valu...