Question
class Test
{
private: static int x;
public: static void fun()
{
cout << ++x << “ ”;
}
};
int Test :: x =20;
void main()
{
Test x;
x.fun();
x.fun();
}
a.
20 22
b.
20 21
c.
21 22
d.
22 23
Posted under Object Oriented Programming
Engage with the Community - Add Your Comment
Confused About the Answer? Ask for Details Here.
Know the Explanation? Add it Here.
Q. What is the output of the following program?
Similar Questions
Discover Related MCQs
Q. Whenever any static data member is declared in a class ______________________
View solution
Q. If object of class are created, then the static data members can be accessed ____________
View solution
Q. Which among the following is wrong syntax related to static data members?
View solution
Q. Which among the following is correct definition for static member functions?
View solution
Q. The static member functions __________________
View solution
Q. The static member functions ____________________
View solution
Q. Which is correct syntax to access the static member functions with class name?
View solution
Q. Which among the following is not applicable for the static member functions?
View solution
Q. Which among the following is true ?
View solution
Q. The static members are ______________________
View solution
Q. Which among the following is true ?
View solution
Q. The static member functions _______________
View solution
Q. Which keyword should be used to declare the static member functions?
View solution
Q. The keyword static is used _______________
View solution
Q. Which among the following can’t be used to access the members in any way?
View solution
Q. We can use the static member functions and static data member __________________
View solution
Q. The static data member _________________
View solution
Q. If static data member are made inline, ______________
View solution
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!
Java Programming
Level up your coding skills with our Java Programming MCQs. From object-oriented...
Cyber Security
Understand the fundamentals of safeguarding digital assets with our Cyber Security...