CPP All : Pointer and Arrays

Exam Papers Problems

#### Output writing – Pointer to array #5204

( As In Exam - CBSE12A-2018 )

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

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++;
}
}```

#### Output writing with pointer based traversing of an array #5318

( As In Exam - CBSE12A-2017 )

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

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]<<"*";
}```
Solved Problems

#### Output Writing Based on char and int array reference #5051

Write output of the following code. Assume that all relevant header files hav

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;
}```

#### Output Writing – Modifying and Reading int array using a pointer variable #5054

Write output of the following code.

```int main()
{
int *striker, t

```

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;
}```

#### Output writing – Pointer to string and integer array #5376

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

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

#### Output writing – pointer and pointer value increment for array #7500

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

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

Exam Paper Problems:2  Solved Problems:4
×