Object Oriented Programming - Classes

6. Choose the correct statements from the following:

Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *


7. The fields in a class, of a C++ program are by default

Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *


8. Class A

{

int  i1;

protected :

int  i2;

public :

int i3;

}

class B : public A

{

public :

int i4;

};

class C :B

{

};

The variable i2 is accessible

Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *


9. Class A

{

int  i1;

protected :

int  i2;

public :

int i3;

}

class B : public A

{

public :

int i4;

};

class C :B

{

};

Which variable(s) is/are accessible from the main function?    

Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *


10. 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 : D
  • Explanation : Since abc is a friend of def, it can access all its data, does not matter whether it is declared private, protected or public.
Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *


  • Class in Object Oriented Programming Questions can be used to give quizzes by any candidate who is preparing for UGC NET Computer Science
  • This Class in Object Oriented Programming Questions section will help you test your analytical skills in a tricky method, thereby giving you an edge over other students
  • Any student who wants to prepare for DOEACC A Level, DOEACC B Level, and DOEACC C level can also use these Objective Type Questions Answer.
  • All candidates who have to appear for the Kendriya Vidyalaya Entrance exam can also refer to this mcq section.
  • You can also get access to the Class in Object Oriented Programming MCQ ebook.
  • Class in Object Oriented Programming Questions can be used in the preparation of JRF, CSIR, and various other exams.
  • You can also download pdf for these Class in Object Oriented Programming multiple-choice questions Answers.
  • This Class in Object Oriented Programming Multiple Choice Questions Answers section can also be used for the preparation of various competitive exams like UGC NET, GATE, PSU, IES, and many more.
  • Class in Object Oriented Programming Questions can be used to gain a credit score in various undergraduate and postgraduate courses like BSc, MSc and MCA
  • Class in Object Oriented Programming Questions for UGC NET Computer Science

    Class in Object Oriented Programming MCQ

    Class in Object Oriented Programming Multiple choice questions