Questions – Exam Papers – Computer Sir Ki Class

Login


Lost your password?

Don't have an account ?
Register (It's FREE) ×
  


Shop
siteicon
Question Typewise Collection-"Output Writing" Questions - Exam Papers (CPP) No. of Q.55

Find and write the output of the following C++ program code:
Note : Assume all required header files are already included in the program.

 

void strpat(char *str)
{
  for(int i=0;str[i]>0;i++)
  {
    for(int j=0;j<=i;j++)
    {
      cout<<str[j];
    }
    cout<<endl;
  }   
}
int main( )
{
  char *t="CBSE";
  strpat(t);
  return 0;
}

 




Find and write the output of the following C++ program code:
Note : Assume all required header files are already included in the program.

 

int main( )
{
  char str[]="NOCONFUSION";
  cout<<*str<<*(&str[2])<<endl;
  cout.write(str,2)<<endl;
  cout.write(str+2,9)<<endl;
  return 0;
}

 




Write the output of the following C++ program code:
Note: Assume all required header files are already being included in the program.

void series(int x=10)
{
  for(int i=2;i<=x;i+=2)
   cout<<i<<" ";
  cout<<endl; 
}
void modify(int &n)
{
  n*=2; 
  series(n);
}

int main()
{
   int a=10;
   cout<<"a="<<a<<endl;
   modify(a);
   series();
   cout<<"new a="<<a<<endl;
   return 0;
}



struct Employee{double salary,hra;};
void change(Employee &a,double h=100)
{
  a.salary+=1000;
  a.hra+=h;
}   
int main() 
{ 
  Employee A={5000,2000};
  cout<<"Initial Payment  = "<<A.salary+A.hra<<endl;
  change(A,500);
  cout<<"After 1st Change = "<<A.salary+A.hra<<endl;   
  change(A);
  cout<<"After 2nd Change = "<<A.salary+A.hra<<endl;
  return 0; 
}

Write the output of the above program. Assume that required header files are present.




struct Play {char Arr[20];int n;}; 
int main() 
{ 
  struct Play P={"JUDO",2};
  P.Arr[0]='L';
  P.n+=2; 
  cout<<P.Arr<<"#"<<P.n<<endl;   
  Play R = P;
  R.Arr[0]='S';R.Arr[1]='O';
  strcat(R.Arr,"KU");
  R.n-=3; 
  cout<<R.Arr<<"#"<<R.n<<endl; 
  return 0; 
}

Write the output of the above program. Assume that required header files are present.




Find and write the output of the following C++ program code:
Note: Assume all required header files are already being included in the program.

struct Score { 
  int Year;float Topper; 
}; 
void change(Score *s,int x=10)
{
  s->Topper=(s->Topper+15)-x;
  s->Year++;
}	 
int main() 
{ 
  Score Arr[]={{2006,100},{2007,85}};
  Score *point=Arr;
  change(point,40);
  cout<<Arr[0].Year<<'#'<<Arr[0].Topper<<endl;
  change(++point);
  cout<<Year<<'#'<<Topper<<endl;
  return 0; 
}





Find and write the output of the following C++ program code.

int main( )
{
  int Ar[]={1,3,8,10,4,6,7} ;
  int *Ptr= Ar, I ;
  cout<<++*Ptr++ << '@' <<endl;
  for( int x=0; x<7 ;x++) cout<<Ar[x]<<" ";
  cout<<endl;
  I = Ar[3] - Ar[2] ;
  cout<<++*(Ptr+I)<<'@';
  cout<<Ar[I]<<'@';
  return 0;
}


Q.8   Exam - CBSE12A-2019/A01D/2

Find and write the output of the following C++ program code:

Note: Assume all required header files are already included in the program.

void Alter(char *S1, char *S2)
{
  char *T;
  T=S1;
  S1=S2;
  S2=T;
  cout<<S1<<"&"<<S2<<endl;
}
void main()
{
  charX[]="First", Y[]="Second";
  Alter(X,Y);
  cout<<X<<"*"<<Y<<endl;
}

 



Q.9   Exam - CBSE12D-2016/01F/2

Look at the following C++ code and find the possible output(s) from the options (i) to (iv) following it. Also, write the maximum and the minimum values that can be assigned to the variable CHANGER.
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 CHANGER;
  CHANGER=random(3);
  char CITY[][25]={”DELHI”,”MUMBAI”,”KOLKATA” ,”CHENNAI”};
  for(int I=0;I<=CHANGER;I++)
  {
    for(int J=0;J<=I;J++)
    cout<<CITY[J];
    cout<<endl;
  }
}
(i) (ii)
DELHI

DELHIMUMABAI

DELHIMUMABAIKOLKATA

DELHI

DELHIMUMABAI

DELHIMUMABAIKOLKATA

DELHIMUMABAIKOLKATACHENNAI

(iii) (iv)
MUMABAI

MUMABAIKOLKATA

MUMABAIKOLKATACHENNAI

KOLKATA

KOLKATACHENNAI



Q.10   Exam - CBSE12D-2016/01E/3

Find and write the output of the following C++ program code:
Note: Assume all required header files are already being included in the program.

class Stock
{
  long int ID;
  float Rate; int Date;
  public:
  Stock(){ID=1001;Rate=200;Date=1;}
  void RegCode(long int I,float R)
  {
    ID=I; Rate=R;
  }
  void Change(int New,int DT)
  {
    Rate+=New; Date=DT;
  }
  void Show()
  {
    cout<<”Date :”<<Date<<endl;
    cout<<ID<<”#”<<Rate<<endl;
  }
};
void main()
{
  Stock A,B,C;
  A.RegCode(1024,150);
  B.RegCode(2015,300);
  B.Change(100,29);
  C.Change(20,20);
  A.Show();
  B.Show();
  C.Show();
}


Q.11   Exam - CBSE12D-2016/01D/2

Find and write the output of the following C++ program code:
Note: Assume all required header files are already included in the program.

typedef char STRING[80];
void MIXITNOW(STRING S)
{
  int Size=strlen(S);
  for (int I=0;I<Size-1;I+=2)
  {
    char WS=S[I];
    S[I]=S[I+1];
    S[I+1]=WS;
  }
  for (I=1;I<Size;I+=2)
    if (S[I]>='M' && S[I]<='U')
      S[I]=’@’;
}
void main()
{
  STRING Word="CRACKAJACK";
  MIXITNOW(Word);
  cout<<Word<<endl;
}

 



Q.12   Exam - CBSE12D-2017/04C/1

Find the output of the following C++ code considering that the binary file BOOK.DAT exists on the hard disk with a data of 200 books.

class BOOK
{
  int BID;char BName[20];
public:
  void Enter();void Display();
};
void main()
{
  fstream InFile;
  InFile.open("BOOK.DAT",ios::binary|ios::in);
BOOK B;
  InFile.seekg(5*sizeof(B));
  InFile.read((char*)&B, sizeof(B));
  cout<<"Book Number:"<<InFile.tellg()/sizeof(B) + 1;
  InFile.seekg(0,ios::end);
  cout<<" of "<<InFile.tellg()/sizeof(B)<<endl;
  InFile.close();
}


Q.13   Exam - CBSE12D-2017/01F/2

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 R and C.
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 R=random(3),C=random(4);
  int MAT[3][3] = {{10,20,30},{20,30,40},{30,40,50}};
  for(int I=0; I<R; I++)
  {
    for(int J=0; J<C; J++)
      cout<<MAT[I][J]<<" ";
    cout<<endl;
  }
}



Q.14   Exam - CBSE12D-2017/01E/3

Find and write the output of the following C++ program code:
Note: Assume all required header files are already being included in the program .

void main()
{
  int A[]={10,12,15,17,20,30};
  for(int i = 0; i<6; i++)
  {
    if(A[i]%2==0)
    A[i] /= 2;
    else if(A[i]%3==0)
    A[i] /= 3;
    if(A[i]%5==0)
    A[i] /= 5;
  }
  for(i = 0; i<6; i++)
  cout<<A[i]<<"#";
}


Q.15   Exam - CBSE12D-2017/01D/2

Find and write the output of the following C++ program code:
Note: Assume all required header files are already included in the program.

#define Big(A,B) (A>B)?A+1:B+2
void main()
{
  char W[] = "Exam";
  int L=strlen(W);
  for(int i =0; i<L-1; i++)
     W[i] = Big(W[i],W[i+1]);
  cout<<W<<endl;
}


Q.16   Exam - CBSE12A-2015/01F/2

Study the following program and select the possible output(s) from the option (i) to (iv) following it. Also, write the maximum and the minimum values that can be assigned to the variable VAL.
Note:
– Assume all required header files are already being included inthe program.
– random(n) function generates an integer between 0 and n-1.

void main()
{
  randomize();
  int VAL;
  VAL=random(3)+2;
  char GUESS[]="ABCDEFGHIJK";
  for (int I=1;I<=VAL;I++)
  {
    for(int J=VAL;J<=7;J++)
      cout<<GUESS[J];
    cout<<endl;
  }
}


(i)       (ii)      (iii)      (iv)
BCDEFGH   CDEFGH    EFGH       FGHI
BCDEFGH   CDEFGH    EFGH       FGHI
                    EFGH       FGHI
                    EFGH       FGHI


Q.17   Exam - CBSE12A-2015/01E/3

Write the output of the following C++ program code:
Note: Assume all required header files are already being included in the program.

class Eval
{
  char Level;
  int Point;
public:
  Eval() {Level='E';Point=0;}
  void Sink(int L)
{
  Level=L;
}
void Float(int L)
{
  Level += L;
  Point++;
}
void Show()
{
  cout<<Level<<"#"<<Point<<endl;
}
};
void main()
{
  Eval E;
  E.Sink(3);
  E.Show();
  E.Float(7);
  E.Show();
  E.Sink(2);
  E.Show();
}


Q.18   Exam - CBSE12A-2015/01D/2

Write the output of the following C++ program code:
Note: Assume all required header files are already being included in the program.

void Location(int &X,int Y=4)
{
  Y+=2;
  X+=Y;
}
void main()
{
  int PX=l0,PY=2;
  Location(PY) ;
  cout<<PX<<","<<PY<<endl ;
  Location(PX,PY);
  cout<<PX<<","<<PY<<endl ;
}


Q.19   Exam - CBSE12D-2015/01F/2

Study the following program and select the possible output(s)from the option (i) to (iv) following it. Also write the maximum and the minimum values that can be assigned to the variable NUM.
Note:

– Assume all required header files are already being includedin the program.
– random(n) function generates an integer between 0 and n-1.

void main()
{
  randomize();
  int NUM;
  NUM=random(3)+2;
  char TEXT[]=”ABCDEFGHIJK”;
  for (int I=1;I<=NUM; I++)
  {
    for (int J=NUM;J<=7;J++)
    cout<<TEXT[J];
    cout<<end1;
  }
}
(i)FGHI    (ii) BCDEFGH   (iii) EFGH   (iv) CDEFGH
   FGHI         BCDEFGH         EFGH        CDEFGH
   FGHI                         EFGH
   FGHI                         EFGH


Q.20   Exam - CBSE12D-2015/01E/3

Write the output of the following C++ program code:
Note: Assume all the required header files are already being included in the program.

class Calc
{
  char Grade;
  int Bonus;
public:
  Calc(){Grade='E' ; Bonus=0;}
  void Down(int G)
  {
  Grade-=G;
  }
  Void Up(int G)
  {
    Grade+=G;
    Bonus++;
  }
  void Show()
  {
    cout<<Grade<<"#"<<Bonus<<end1;
  }
};
void main()
{
  Calc c;
  C.Down(2);
  C.Show();
  C.Up(7);
  C.Show();
  C.Down(2)
  C.Show();
}


Q.21   Exam - CBSE12D-2015/01D/2

Write the output of the following C++ program code:
Note: Assume all required header files are already being included in the program .

void Position (int &C1, int C2=3)
{
  C1+=2;
  C2+=2;   //Original paper had this incorrectly written as Y
}
void main()
{
  int P1=20, P2=4;
  Position(P1);
  cout<<P1<<","<<P2<<endl;
  Position(P2,P1);
  cout<<P1<<","<<P2<<endl;
}


Q.22   Exam - CBSE12A-2017/04C/1

Find the output of the following C++ code considering that the binary file CLIENTS.DAT exists on the hard disk with a data of 200 clients.

class CLIENTS
{
  int CCode;char CName[20];
public:
  void REGISTER();void DISPLAY();
};
void main()
{
  fstream File;
  File.open("CLIENTS.DAT",ios::binary|ios::in);
  CLIENTS C;
  File.seekg(6*sizeof(C));
  File.read((char*)&C, sizeof(C));
  cout<<"Client Number:"<<File.tellg()/sizeof(C) + 1;
  File.seekg(0,ios::end);
  cout<<" of "<<File.tellg()/sizeof(C)<<endl;
  File.close();
}


Q.23   Exam - CBSE12A-2018/04C/1

Find the output of the following C++ code considering that the binary file SCHOOLS.DAT exists on the hard disk with the following records of 10 schools of the class SCHOOLS as declared in the previous question (4 b).

SCode SName NOT
1001 Brains School 100
1003 Child Life School 115
1002 Care Share School 300
1006 Educate for Life School 50
1005 Guru Shishya Sadan 195
1004 Holy Education School 140
1010 Rahmat E Talim School 95
1008 Innovate Excel School 300
1011 Premier Education School 200
1012 Uplifted Minds School 100

 

void main()
{
  fstream SFIN;
  SFIN.open("SCHOOLS.DAT",ios::binary|ios::in);
  SCHOOLS S;
  SFIN.seekg(5*sizeof(S));
  SFIN.read((char*)&S, sizeof(S));
  S.Display();
  cout<<"Record :"<<SFIN.tellg()/sizeof(S) + 1<<endl;
  SFIN.close();
}


Q.24   Exam - CBSE12A-2016/04C/1

Find the output of the following C++ code considering that the binary file CLIENT.DAT exists on the hard disk with a data of 1000 clients.

class CLIENT
{
  int Ccode;char CName[20];
  public:
  void Register();void Display();
};
void main()
{
  fstream CFile;
  CFile.open(“CLIENT.DAT”,ios::binary|ios::in);
  CLIENT C;
  CFile.read((char*)&C, sizeof(C));
  cout<<”Rec:”<<CFile.tellg()/sizeof(C)<<endl;
  CFile.read((char*)&C, sizeof(C));
  CFile.read((char*)&C, sizeof(C));
  cout<<”Rec:”<<CFile.tellg()/sizeof(C)<<endl;
  CFile.close();
}


Q.25   Exam - CBSE12A-2016/01F/2

Look at the following C++ code and find the possible output(s) from the options (i) to (iv) following it. Also, write the maximum and the minimum values that can be assigned to the variable PICKER.

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 PICKER.
  PICKER=1+random(3).
  char COLOR[][5]={"BLUE","PINK","GREEN","RED"}.
  for(int I=0;I<=PICKER;I++)
  {
    for(int J=0;J<=I;J++)
      cout<<COLOR[J].
    cout<<endl.
  }
}
(i) (ii) (iii) (iv)
PINK BLUE GREEN BLUE
PINKGREEN BLUEPINK GREENRED BLUEPINK
PINKGREENRED BLUEPINKGREEN BLUEPINKGREEN
BLUEPINKGREENRED


Q.26   Exam - CBSE12A-2016/01E/3

Find and write the output of the following C++ program code:
Note: Assume all required header files are already being included in the program.

class Share
 {
 long int Code;
 float Rate;
 int DD;
 public:
 Share(){Code=1000;Rate=100;DD=1;}
 void GetCode(long int C,float R)
 {
  Code=C;
  Rate=R;
 }
 void Update(int Change,int D)
 {
  Rate+=Change;
  DD=D;
 }
 void Status()
 {
  cout<<"Date:"<<DD<<endl;
  cout<<Code<<"#"<<Rate<<endl;
 }
};
void main()
{
 Share S,T,U;
 S.GetCode(1324,350);
 T.GetCode(1435,250);
 S.Update(50,28);
 U.Update(25,26);
 S.Status();
 T.Status();
 U.Status();
}


Q.27   Exam - CBSE12A-2016/01D/2

Find and write the output of the following C++ program code:
Note: Assume all required header files are already included in the program.

typedef char TEXT[80];
void JumbleUp(TEXT T)
{
  int L=strlen(T);
  for (int C=0;C<L1;C+=2)
{
  char CT=T[C];
  T[C]=T[C+1]
  T[C+1]=CT;
}
  for (C=1;C<L;C+=2)
  if (T[C]>='M' && T[C]<='U')
  T[C]=’@’;
}
void main()
{
  TEXT Str="HARMONIOUS";
  JumbleUp(Str);
  cout<<Str<<endl;
}



Write down the output of the program.

struct three_d{int x,y,z;};

void movein(three_d &t,int step=1) 
{ 
  t.x+=step; t.y-=step; t.z+=step;
} 
void moveout(three_d &t,int step=2) 
{ 
  t.x-=step; t.y+=step; t.z-=step;
} 

int main()
{
  three_d t1={10,20,5},t2={30,10,40};
  movein(t1);
  moveout(t2,5);
  cout<<t1.x<<","<<t1.y<<","<<t1.z<<endl;
  cout<<t2.x<<","<<t2.y<<","<<t2.z<<endl;  
  movein(t2,10);
  cout<<t2.x<<","<<t2.y<<","<<t2.z<<endl;  
  return 0;
}





Go through the C++ code below and find out the possible outputs from the suggested options (i) to (iv). Assume all the required header files are already being included in the code.

void main()
{
  const int LOW=25;
  randomize();
  int p=5, number;
  for(int i=1; i<=4; i++)
  {
    number=LOW+random(p);
    cout<<number<<":";
    p--;
  }
}

(i)   29:26:25:25:             (ii)   24:28:25:26
(iii) 29:26:24:28             (iv)  29:26:25:25:




Find and write the output of the following C++ program code.




Write the output of the following code. Assume all header files are included.

int main()
{
  int i;
  for(i=10; i>6; i=i-2) cout<<i<<" ";
  cout<<endl;
  for(i=-5; i> -8; i--) cout<<i+1<<" ";
  cout<<endl;
  for(i=-3,sum=0; i<3; i--) cout<<sum++<<" "; 
  cout<<endl;
  return 0;
}



Write output of the following code. Assume that related header files are included.

int main()
{
  int a=10,b=13,c;
  cout<<(c=a+b/a)<<" ";
  cout<<(a=b+c);
  return 0 ;
}


Q.33   Exam - CBSE12A-2017/01F/2

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 N and M.

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 N=random(3),M=random(4);
  int DOCK[3][3] = {{1,2,3},{2,3,4},{3,4,5}};
  for(int R=0; R<N; R++)
  {
    for(int C=0; C<M; C++)
      cout<<DOCK[R][C]<<" ";
    cout<<endl;
  }
}

(i)
1 2 3
2 3 4
3 4 5

(ii)
1 2 3
2 3 4

(iii)
1 2
2 3

(iv)
1 2
2 3
3 4



Q.34   Exam - CBSE12A-2017/01E/3

Find and write the output of the following C++ program code: Note: Assume all required header files are already being included in the program.

void main()
{
  int *Point, Score[]={100,95,150,75,65,120};
  Point = Score;
  for(int L = 0; L<6; L++)
 {
    if((*Point)%10==0)
      *Point /= 2;
    else
      *Point -= 2;
    if((*Point)%5==0)
      *Point /= 5;
    Point++;
  }
  for(int L = 5; L>=0; L--)
    cout<<Score[L]<<"*";
}


Q.35   Exam - CBSE12A-2017/01D/2

Find and write the output of the following C++ program code:
Note: Assume all required header files are already included in the program.

#define Diff(N1,N2) ((N1>N2)?N1-N2:N2-N1)
void main()
{
  int A,B,NUM[] = {10,23,14,54,32};
  for(int CNT =4; CNT>0; CNT--)
  {
    A=NUM[CNT];
    B=NUM[CNT-1];
    cout<<Diff(A,B)<<'#';
  }
}

 




Write output of the following code. Assume inclusion of related header files.

int &min(int &a, int &b)
{
  if (a<b) return a;
  else return b;
}

int main()
{
  int x=2,y=3;
  min(x,y)=10; 
  cout<<"x-y = "<<(x-y)<<endl;
  cout<<"y-x = "<<(y-x)<<endl;
  return 0;
}


Q.37   Exam - CBSE12A-2018/01F/2

Look at the following C++ code and find the possible output(s) from the options (i) to (iv) following it. Also, write the highest and lowest values that can be assigned in the array A.
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 A[4], C;
  for(C=0; C<4; C++)
  A[C]=random(C+1)+10;
  for(C=3; C>=0; C--)
  cout<<A[C]<<"@";
}

 

(i)   13@10@11@10@             (ii)   15$14$12$10$
(iii) 12@11@13@10@             (iv)  12@11@10@10@



Q.38   Exam - CBSE12A-2018/01E/2

Find and write the output of the following C++ program code:
Note : Assume all required header files are already included in the program.

 

#define Modify(N) N*3+10
void main()
{
  int LIST[]={10,15,12,17};
  int *P=LIST, C;
  for(C=3; C>=0; C--)
    LIST[I]=Modify(LIST[I]);
  for (C=0; C<=3; C++)
  {
    cout<<*P<<":";
    P++;
  }
}

 



Q.39   Exam - CBSE12A-2018/01D/3

Find and write the output of the following C++ program code: Note : Assume all required header files are already included in the program.

void Revert(int &Num, int Last=2)
{
  Last=(Last%2==0)?Last+1:Last-1;
  for(int C=1; C<=Last; C++)
  Num+=C;
}

void main()
{
  int A=20,B=4;
  Revert(A,B);
  cout<<A<<"&"<<B<<endl;
  B--;
  Revert(A,B);
  cout<<A<<"#"<<B<<endl;
  Revert(B);
  cout<<A<<"#"<<B<<endl;
}



Write output of the following code.

int main()
{
  int *striker, track[] = {10,20,30,40};
  striker=track;
  track[1]+=30;
  cout<<"striker"<<*striker<<endl;
  *striker-=10;
  striker++;
  cout<<"Next@"<<*striker<<endl;
  striker+=2;
  cout<<"Last@"<<*striker<<endl;
  cout<<"Rest to"<<track[0]<<endl;
  return 0;
}



Write output of the following code. Assume that all relevant header files have been added.

int main()
{
  char *text = "AJANTA";
  int *p, num[]={1,5,7,9};
  p=num;
  cout<<*p<<text<<endl;
  text++;
  p++;
  cout<<*p<<text<<endl;
}



Write output of the following code. Assume that required header files are included.

int main()
{
  int x=10,y=20;
  if(x=0) cout<<"Hello"<<endl;
  else cout<<"Sorry"<<endl;
  if(y=10) cout<<"Hello"<<endl;
  else cout<<"Sorry"<<endl;
  if(x+y==10) cout<<"Hello"<<endl;
  else cout<<"Sorry"<<endl;
  return 0;
}



Write the output of the following program and explain.

int main( )
{
int a=1,b=0;
int c=!a && b;
cout<<(c || b+a)<<endl;
cout<<(-c && a+b)<<endl;
return 0 ;
}



Write output of the following program if the input given is R

int main()
{
  char x, y=32;
  cout<<"Input an uppercase alphabet: ";
  cin>>x;
  char c=x+y;
  int d=x+y;
  cout<<"Output 1 would be "<<c<<endl;
  cout<<"Output 2 would be "<<d<<endl;
  return 0;
}



Write down the output of the program and give steps in arriving at such output.

struct Pix {int x,y;};
void show(Pix &p)
{
  cout<<p.x++<<","<<++p.y<<endl;
}
int main()
{
  Pix P={50,60},Q,R;
  R=P;
  show(R);
  P.x+=10;P.y+=30;
  Q=R;
  show(P); show(Q); show(R);
  return 0;
}

 




Write the output of the following program depicting structure instances being called as value and called as reference to a function.

struct Sale {int ID; float value;};
void sc(Sale a,Sale &b)
{
a.ID=a.ID+1;
a.value=a.value+100;
b=a;
}
int main()
{
  Sale zone1={1,400.50},zone2;
  sc(zone1,zone2);
  cout<<"Zone 1 (ID, value) = "<<zone1.ID<<", "<<zone1.value<<endl;
  cout<<"Zone 2 (ID, value) = "<<zone2.ID<<", "<<zone2.value<<endl;
  return 0;
}



Write the output of the following program. Assume that required header files are present.

struct Game {
  char Magic[20];int Score;
};

int main()
{
  Game M={"Tiger",500};
  char a[20];
  cout<<M.Magic<<", "<<M.Score<<endl;
  strcpy(a,M.Magic);
  a[0]='L'; a[2]='o'; a[3]='n'; a[4]='';
  strcpy(M.Magic,a);
  M.Score++;
  cout<<M.Magic<<", "<<M.Score<<endl;
  return 0;
}



Write the output of the following code based on the switch-case selection when the user input is B, L, D or S. Assume inclusion of appropriate header files.

int main ( )
{ 
  char m;
  cout<<"Enter meal type (B/L/D): ";
  cin>>m;
  switch (m)
  {
    case 'B': 
    case 'b':cout<<"Have some thing. ";
    case 'L':
    case 'l':cout<<"Come to Dining Table.";break;
    case 'D':
    case 'd':cout<<"Let's go outside."; break;
    default: cout <<"Error in input";
  }
  return 0 ;
}



Solve the following program to show its output. Assume that required header files are included

int main() 
{
  int a,b;
  a=(b=10);
  for(int i=10;i<30;i+=10)
  {
    cout<<a++ + i<<" "<<(b=++b -i)<<endl ;
  } 
  return 0;
}




Write output of the following program using the ternary operation logic.

#include <iostream.h>
int main()
{
  int a=10,b=23;
  int c=a>b?a=b:b=a;
  cout<<c<<endl;
  return 0;
}



Find the output of the program given below. Assume all relevant header files are included

int main( )
{
  int a,b,c=101,d=102;
  a=(c=d);
  cout<<a<<endl;
  b=(c==d);
  cout<<b<<endl;
  return 0 ;
}



Write the output of the following program. Assume that required header files are included.

int main()
{
  for(int i=1;i<=30;++i)
  {
    if(i%2==0 || i%3==0) continue;
    else cout<<i<<" ";
  }
  return 0 ;
}



Write the output of the following code. Assume that required header files are included.

int main() 
{
  for(int i=10;i<=50;i+=10)
  cout<<i++/2<<" ";
  return 0;
}



Write the output of the following c++ program when the user input value are -1 and 1.

int main()
{
  int n;
  cout<<"Enter and integer :";
  cin>>n;
  if(n++ >= ++n)
    cout<<n<<" if";
  else
    cout<<++n<<" else";
  return 0;
}



Show the output of the following program. Assume that required header files are present.

int main()
{
  int n=10;
  cout<< n << endl ;
  cout<< ++n << endl ;
  cout<< n++ << endl ;
  cout<< n << endl ;
  cout<< - n << endl ;
  cout<< - - n << endl ;
  cout<< -- n << endl ;
  cout<< n << endl ;
  cout<< n-- << endl ;
  cout<< n << endl ;
  cout<< - --n <<endl;
  cout<< (n+=1) <<endl;
  cout<< (n-=1) <<endl;
  cout<< (n%=2) <<endl;
  return 0 ;
}