Consider the following two C++ programs P​1​ and P​2​ and two statements S​1​ and S​2​ about the programs:

P1

P2

void f(int a, int*b, int &c)

{     a = 1;

       *b =2;

       c = 3;

}

int main ()

      int i = 0;

      f(i, &i, i):

      cout ≪ i;

}

double a = 1, b =2;

double &f(double &d)

{       d = 4;

         return b;

}

int main ()

{

      f(a) = 5;

      cout ≪ a ≪ “:” ≪b;

}

S1: P1 prints out 3

S2: P2 prints out 4:2

What can you say about the statement S1 and S2

1
Neither S1​ nor S2​ is true
2
Only S​1​ is true
3
Only S2​ is true
4
Both S1​ and S​2​ are true

Sponsored

hivanix.in

Visit

This quiz is brought to you by hivanix.in

🌐 Web App Development

Quick Navigation