adplus-dvertising

Welcome to the Class Members MCQs Page

Dive deep into the fascinating world of Class Members with our comprehensive set of Multiple-Choice Questions (MCQs). This page is dedicated to exploring the fundamental concepts and intricacies of Class Members, a crucial aspect of Object Oriented Programming. In this section, you will encounter a diverse range of MCQs that cover various aspects of Class Members, from the basic principles to advanced topics. Each question is thoughtfully crafted to challenge your knowledge and deepen your understanding of this critical subcategory within Object Oriented Programming.

frame-decoration

Check out the MCQs below to embark on an enriching journey through Class Members. Test your knowledge, expand your horizons, and solidify your grasp on this vital area of Object Oriented Programming.

Note: Each MCQ comes with multiple answer choices. Select the most appropriate option and test your understanding of Class Members. You can click on an option to test your knowledge before viewing the solution for a MCQ. Happy learning!

Class Members MCQs | Page 8 of 9

Q71.
What is the output of the following program?
class Test
{
 private: static int x;
 public: static void fun()
 {
  cout << ++x << “ ”;
 }
};
int Test :: x =20;
void main()
{
 Test x;
 x.fun();
 x.fun();
}
Discuss
Answer: (c).21 22
Discuss
Answer: (a).Only one copy of the data is created
Q73.
If object of class are created, then the static data members can be accessed ____________
Discuss
Answer: (d).Using dot or arrow operator
Q74.
What will be the output of the following program?
class Test
{
 public: Test() 
 { 
  cout  << "Test's Constructor is Called " << endl;  
 }
};
 
class Result
{
 static Test a;
 public:
 Result() 
 { 
  cout  << "Result's Constructor is Called " << endl; 
 }
}; 
 
void main() 
{ 
 Result b; 
}
Discuss
Answer: (b).Result’s Constructor is Called
Discuss
Answer: (d).className : dataType -> memberName;
Discuss
Answer: (b).Functions made to maintain single copy of member functions for all objects
Discuss
Answer: (c).Have access to only the static members of a class
Discuss
Answer: (a).Can be called using class name
Q79.
Which is correct syntax to access the static member functions with class name?
Discuss
Answer: (d).className :: functionName;
Q80.
Which among the following is not applicable for the static member functions?
Discuss
Answer: (c).this pointer
Page 8 of 9

Suggested Topics

Are you eager to expand your knowledge beyond Object Oriented Programming? We've curated a selection of related categories that you might find intriguing.

Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!