Our website is made possible by displaying online advertisements to our visitors. Please consider supporting us by whitelisting our website.

Cpp Programming

Cpp Programming Quiz 45 – Which of the following is correct about class and structure?

Question: Which of the following is correct about class and structure?
[A]. class can have member functions while structure cannot.
[B]. class data members are public by default while that of structure are private.[C]. Pointer to structure or classes cannot be declared.
[D]. class data members are private by default while that of structure are public by default.

Answer: Option D

Cpp Programming Quiz 45 – Which of the following is correct about class and structure? Read More »

Cpp Programming, OOPs Concepts

Cpp Programming Quiz 48 – Which one of the following options is correct?

Question: Which one of the following options is correct?
[A]. Friend function can access public data members of the class.
[B]. Friend function can access protected data members of the class.[C]. Friend function can access private data members of the class.
[D]. All of the above.

Answer: Option D

Cpp Programming Quiz 48 – Which one of the following options is correct? Read More »

Cpp Programming, OOPs Concepts

Cpp Programming Quiz 49 – In which of the following a virtual call is resolved at the time of compilation?

Question: In which of the following a virtual call is resolved at the time of compilation?
[A]. From inside the destructor.
[B]. From inside the constructor.[C]. From inside the main().
[D]. Both A and B.

Answer: Option D

Cpp Programming Quiz 49 – In which of the following a virtual call is resolved at the time of compilation? Read More »

Cpp Programming, OOPs Concepts

Cpp Programming Quiz 50 – Which of the following is the correct way of declaring a function as constant?

Question: Which of the following is the correct way of declaring a function as constant?

[A]. const int ShowData(void) { /* statements */ }
[B]. int const ShowData(void) { /* statements */ }[C]. int ShowData(void) const { /* statements */ }

[D]. Both A and B 

Answer: Option C

Cpp Programming Quiz 50 – Which of the following is the correct way of declaring a function as constant? Read More »

Cpp Programming, OOPs Concepts