MCQOPTIONS
Bookmark
Saved Bookmarks
→
C++ Programming
→
Constructors And Destructors in C++ Programming
→
How many access specifiers are there in c++?..
1.
How many access specifiers are there in c++?
A.
4
B.
3
C.
2
D.
1
E.
None of these
Answer» C. 2
Show Answer
Discussion
No Comment Found
Post Comment
Related MCQs
What is the output of this program?<br><pre class="prettyprint lang-c">#include <iostream><br> using namespace std; <br> struct N<br> {<br> int k;<br> char ch;<br> float p;<br> void function();<br> };<br> void N :: function() {}<br> struct M <br> {<br> public:<br> int k;<br> char ch;<br> float p;<br> void function();<br> };<br> void M :: function() {}<br> int main() <br> {<br> N obj1; M obj2;<br> obj1.k = obj2.k = 2; <br> obj1.ch = obj2.ch = 'U';<br> obj1.p = obj2.p = 5.125;<br> obj1.function();<br> obj2.function();<br> cout << "Value Allocated in memory..."; <br> return 0;<br> }<br></pre>
What is the output of this program?<br><pre class="prettyprint lang-c">#include <iostream><br> using namespace std;<br> class Employee<br> {<br> public:<br> int IdNo , Salary , bonus ;<br> protected:<br> void get()<br> {<br> IdNo = 101, Salary = 15000, bonus = 5000;<br> }<br> };<br> class Extra<br> {<br> public:<br> int Gift;<br> void getGift()<br> {<br> Gift = 4000;<br> }<br> };<br> class statement : public Employee, public Extra<br> {<br> int GrandTotal, Average;<br> public:<br> void display()<br> {<br> GrandTotal = (Salary + bonus);<br> Average = GrandTotal / 2;<br> cout << GrandTotal << " ";<br> cout << Average;<br> }<br> void setObject()<br> {<br> get();<br> }<br> };<br> int main()<br> {<br> statement object;<br> object.setObject();<br> object.getGift();<br> object.display();<br> }<br></pre>
What is the output of this program?<br><pre class="prettyprint lang-c">#include <iostream><br> using namespace std;<br> class Abhay<br> {<br> public:<br> int age;<br> };<br> int main()<br> {<br> Abhay obj;<br> obj.age = 24;<br> <br> cout << "Abhay is " ;<br> cout << obj.age << " years old.";<br> }<br></pre>
What is the output of this program?<br><pre class="prettyprint lang-c">#include <iostream><br> using namespace std;<br> struct A;<br> struct B <br> {<br> void fun1(A*);<br> };<br> struct A <br> {<br> private:<br> int k;<br> public:<br> void initialize(); <br> friend void fun2(A* , int);<br> friend void B :: fun1(A*);<br> friend struct C;<br> friend void fun3();<br> };<br> void A :: initialize() <br> {<br> k = 0;<br> }<br> void fun2(A* a, int k) <br> {<br> a -> k = k;<br> }<br> void B :: fun1(A * a) <br> {<br> a -> k = 35;<br> cout << a->k;<br> }<br> struct C<br> {<br> private:<br> int L;<br> public:<br> void initialize();<br> void fun2(A* a);<br> };<br> void C::initialize() <br> {<br> L = 45;<br> }<br> void C::fun2(A* a) <br> {<br> a -> k += L;<br> }<br> void fun3() <br> {<br> A a;<br> a.k = 150;<br> cout << a.k;<br> }<br> int main() <br> {<br> A a;<br> C c;<br> c.fun2(&a);<br> cout << "Data accessed";<br> }<br></pre>
What is the output of this program?<br><pre class="prettyprint lang-c">#include <iostream><br> using namespace std;<br> struct N <br> {<br> private:<br> int p, q, s;<br> public:<br> int fun1();<br> void fun2();<br> };<br> int N :: fun1() <br> {<br> return p + q + s;<br> }<br> void N :: fun2() <br> {<br> p = q = s = 0;<br> }<br> class M <br> {<br> int p, q, s;<br> public:<br> int fun1();<br> void fun2();<br> };<br> int M :: fun1() <br> {<br> return p + q + s; <br> }<br> void M :: fun2() <br> {<br> p = q = s = 0;<br> }<br> int main() <br> {<br> N obj1;<br> M obj2;<br> obj1.fun1(); <br> obj1.fun2();<br> obj2.fun1(); <br> obj2.fun2();<br> cout << "Identical results...";<br> }<br></pre>
What is the importance of mutable keyword?
What is the default access level to a block of data?
How many access specifiers are there in c++?
Reply to Comment
×
Name
*
Email
*
Comment
*
Submit Reply