C++ Programming - OOPS Concepts
Exercise :: OOPS Concepts - General Questions
- OOPS Concepts - General Questions
51. |
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
Explanation:
|
52. |
Which of the following statements is correct in C++? |
A. |
Classes cannot have data as protected members. | B. |
Structures can have functions as members. | C. |
Class members are public by default. | D. |
Structure members are private by default. |
Answer: Option B
Explanation:
|
53. |
Which of the following is used to make an abstract class? |
A. |
Declaring it abstract using static keyword. | B. |
Declaring it abstract using virtual keyword. | C. |
Making at least one member function as virtual function. | D. |
Making at least one member function as pure virtual function. |
Answer: Option D
Explanation:
|
54. |
Which of the following access specifier is used as a default in a class definition? |
A. |
protected | B. |
public | C. |
private | D. |
friend |
Answer: Option C
Explanation:
|
55. |
What is correct about the static data member of a class? |
A. |
A static member function can access only static data members of a class. | B. |
A static data member is shared among all the object of the class. | C. |
A static data member can be accessed directly from main(). | D. |
Both A and B. |
Answer: Option D
Explanation:
|