C++ Programming Questions Answers - Set 2
-
8. Which among following is not a valid visibility mode in c++ program ?
- Private
- Public
- Protected
- Limited
Answer And Explanation
Answer: Option D
-
9. Even if we define a function in a class, then also we need to declare it first.
- True
- False
Answer And Explanation
Answer: Option B
Explanation:
If we define a function in a class, then also we do not need to declare it first.
-
10. How we can define member function outside the class ?
- Using union
- Using structure
- Using pointers
- Using scope resolution
Answer And Explanation
Answer: Option D
-
11. Which among following is correct way of declaring object of a class ?
- Classname Objectname;
- Class Classname Objectname;
- Class Classname Object Objectname;
- Classname Object Objectname;
Answer And Explanation
Answer: Option A
-
12. How we can access data members using objects ?
- object@datamember
- object*datamember
- object->datamember
- object.datamember
Answer And Explanation
Answer: Option D
-
14. What is true about Constructor ?
- Its name is plural of class name.
- Its name has * symbol before it.
- Its name is same as of class name.
- Its name has # symbol before it.
Answer And Explanation
Answer: Option C