MENU

Chapter 6 Data File Handling Solutions

Question - 41 : -
Obtain the output of the following C+ + program as expected to appear on the screen after its execution.
Important Note :
All the desired header files are already included in the code, which are required to run the code.

void main()
{
char *Text="AJANTA"; int *P, Num[]={l,5,7,9}
P=Num;
cout <<*p<< Text <
Text++;
P++;
cout<<*P<
}

Answer - 41 : -

1AJANTA
5JANTA

Question - 42 : -
Obtain the output from the following C+ + program as expected to appear on the screen after its execution.
Important Note :
• Adi the desired header files are already included in the code, which are required to run the code.

void main()
{
char *String="SARGAM"; 
int *Ptr, a[]={1,5,7,9}; 
ptr=a;
cout<<*ptr<
String++; 
ptr+=3;
cout<<*ptr<
}

Answer - 42 : -

1 SARGAM
9ARGAM

Question - 43 : -
Give the output of the following program segment: (Assuming all desired header file(s) are already included)

void main()
{
float *Ptr, Points[] = {20,50,30,40,10};
Ptr = points; 
cout<<*Ptr<
Ptr+=2;
Points[2]+=2.5; 
cout<<*Ptr<
Ptr++;
(*Ptr)+=2.5; 
cout<
}

Answer - 43 : -

20.00 32.5
42.50

Question - 44 : -
Find the output of the following code :
Important Note :
All the header files are already included in the code, which are required to run the code.

void main()
{
char *String="SHAKTI";
int*Point,Value[]={10,15,70,19};
Point=Value;
cout<<*Point<
String++;
Point++;
cout<<*Point<
}

Answer - 44 : -

10SHAKTI
15HAKTI

Question - 45 : -
Find the output of the following program :

#include
void in(int x,int y,int &z)
{
x+=y; 
y--;
z*=(x-y);
}
void out(int z,int y,int &x)
{
x*=y;
y++;
z/=(x+y);
}
void main()
{
int a=20, b=30, c=10;
out(a,c,b);
cout<
in(b,c, a) ;
cout<
out(a,b,c);
cout<
}

Answer - 45 : -

20#300#10#
620@300@10@
620$300$3000$

Question - 46 : -
Find the output of the following code:

#include 
void main()
{
int *Striker;
int Track[]={10,25,30,55}; 
Striker=Track; 
Track[1]+=30;
cout<<"Striker"<<*Striker<
*Striker=-10;
Striker++;
cout<<"Next@"<<*Striker<
Striker+=2;
cout<<"Last@"<<*Striker<
cout<<"Rest To"<<*Track[0]<
}

Answer - 46 : -

Striker 10
Next@55
Last@55
Rest To 0

Question - 47 : -
Find the output of the following code :

#include 
void main()
int *Queen;
Moves[]={ll,22,33,44};
Queen=Moves;
Moves[2]+=22;
cout<<"Queen@"<<*Queen<
*Queen-=ll;
Queen+=2;
cout<<”Now@"<<*Queen<
Queen++;
×