Logo educatepk.com
MCQs & Books free for all subjects and educational help  
Subscribe email alerts:
MCQs Online
MCQs on Object Oriented C++ Programming
Books
MCQs on Object Oriented C++ Programming
MCQ related to Object Oriented programming using C++ for general use and also for job preparation of Public Service Commission
Option image

Q No.1 of 3

#include ‘’iostream.h’’

int a(int m)

{ return ++m; }

int   b(int &m)

{ return   ++m; }

int c(char &m)

{ return ++m; }

void main(  )

{

  int   p=0, q=0 , r=0;

  p+=a (b(p));

  q+ =b(a (q));

  r+=a (c(r));

  cout <<p<<q<<r;

}

If the statement:

q+=b(a(q)): is replaced by the statement

q+=b(a(p)); then the above program:


Option 1

Prints 111


Option 2

Results in compilation error


Option 3

Prints 322


Option 4

Prints 352


Q No.2 of 3

the following program

class abc ;

class def

{

    int  i1;      // statement   1

    protected: int i2;    // statement  2

   public : int i3;    // statement  3

friend abc;

} ;

class abc

{

public:

void main (def A)

{

cout<<( A.i1=3) ;

cout<<( A.i2=4);

cout<<( A.i3=5);

}

void main ( )

{

   def x1;

  abc   x2;

  x2.mn(x1) ;

}


Option 1

Will compile successuflly if statement 1 is removed


Option 2

Will compile successfully if statement 2 is removed


Option 3

Will compile successfully if statement 3 is removed


Option 4

Will run successfully and print 345


Q No.3 of 3

 

class mho

{ public:

  mho(void)

{

  cout<< “there was“ ;

}

mho(mho  &x }

{

 cout<< “a certain man“ ;

}

  mho operator - ( mho y)

{

  mho ohm;

  return (ohm) ;

}

};

  If the function main is coded as

  mho   a, b;

  the output will be


Option 1

there was there was


Option 2

nothing


Option 3

a run time error


Option 4

there was a certain man there was a certain man



Correct Answers