adplus-dvertising

Welcome to the Access Specifiers MCQs Page

Dive deep into the fascinating world of Access Specifiers with our comprehensive set of Multiple-Choice Questions (MCQs). This page is dedicated to exploring the fundamental concepts and intricacies of Access Specifiers, a crucial aspect of Object Oriented Programming. In this section, you will encounter a diverse range of MCQs that cover various aspects of Access Specifiers, 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 Access Specifiers. 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 Access Specifiers. You can click on an option to test your knowledge before viewing the solution for a MCQ. Happy learning!

Access Specifiers MCQs | Page 3 of 6

Discuss
Answer: (c).Constructor will keep number of objects created
Q22.
Which option is false for the following code?
class A
{
 private : int sum(int x, int y)
 { 
  return x+y; 
 }
 public: A()
 {  
 }
 A(int x, int y)
 { 
  cout<<sum(x,y);  
 }
};
Discuss
Answer: (d).Constructor will take 0 as default value of parameters if not passed
Q23.
Which member will never be used from the following class?
class A()
{ 
 int marks; char name[20];
 public : A()
 { 
  marks=100; 
 }
 void disp()
 { 
  cout<<”Marks= ”&lt'<marks;
  cout<<”Student”;
 }
};
Discuss
Answer: (a).name variable will never be used
Q24.
Private member functions can be overloaded.
Discuss
Answer: (a).True
Q25.
Which data member in following code will be used whenever an object is created?
Class A
{ 
   int x; int y; int z;
   public : A()
   { 
      y=100; x=100*y; 
   }
};
Discuss
Answer: (c).z will be used
Q26.
Which member can be considered most secure in the code below?
class A()
{
 int a;
 private : int b;
 protected : int c;
 public : int d;
};

a.

a

b.

b

c.

c

d.

d

Discuss
Answer: (b).b
Q27.
Which among the following is correct for the code given below?
class A
{
 private : A()
 { 
 }
 public : A(int x)
 {  
 }
};
A a;
A b(100);
Discuss
Answer: (a).Program will give compile time error
Discuss
Answer: (c).Members are secure as private, but can be inherited
Discuss
Answer: (a).It’s instance can be created inside the subclasses
Q30.
For the following code, choose the correct option:
class A
{  
 int marks;
 protected : A()
 { 
  marks=100; 
 }
 public : A( int x)
 { 
  marks=x;  
 }
};
Discuss
Answer: (d).The instances can be created anywhere in the program
Page 3 of 6

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!