C++ Programming Questions Answers - Set 2
-
15. What is actual syntax of destructor in c++ ?
- !Classname( )
- @Classname( )
- $Classname( )
- ~Classname( )
Answer And Explanation
Answer: Option D
-
16. We can do constructor overloading in C++ ?
- True
- False
Answer And Explanation
Answer: Option B
Explanation:
constructor overloading can be done in C++.
-
17. A variable is defined within a block in a body of a function. Which of the following are true ?
- It is visible from the point of definition to the end of the program.
- It is visible throughout the function.
- It is visible from the point of definition to the end of the block.
- It is visible throughout the block.
Answer And Explanation
Answer: Option B
-
18. The major goal of inheritance in C++ is ?
- To facilitate the reusability of code
- To help modular programming
- To facilitate the conversion of data types
- To extend the capabilities of a class
Answer And Explanation
Answer: Option A
-
19. Which of the following keywords are used to control access to a class member ?
- protected
- switch
- goto
- for
Answer And Explanation
Answer: Option A
-
20. Which of the following cannot be passed to a function ?
- Array
- Reference variable
- Object
- File
Answer And Explanation
Answer: Option D
-
21. Among following which will give the size of object or type ?
- Calloc
- Malloc
- Sizeof
- Realloc
Answer And Explanation
Answer: Option C