Topic Wise Solved Problems Question – Computer Sir Ki Class

Login


Lost your password?

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


Shop
siteicon
CPP All :Topicwise Exam Questions: pointer-and-arrays siteicon
Output writing – Pointer to array 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++;
  }
}

 

CBSE12A-2018

Output writing with pointer based traversing of an array 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]<<"*";
}
CBSE12A-2017