C++ Programming Questions Answers - Set 2 Online Quiz Test
-
1. What is data hiding ?
- It is related with hiding internal object details
- It is related with showing internal object details
- It is related with datatypes
- None of above
-
2. What is class in c++ ?
- When you define a class, you define a blueprint for a data type.
- When you define a class, you make get more funtionality.
- When you define a class, you define the logic.
- When you define a class, you make debugging.
-
3. What is object in C++ ?
- Object is part of syntax of a class.
- Object is datatype of a class.
- Object is an instance of a class.
- Object is function of a class.
-
4. What is purpose of abstract class ?
- to provide help with database connectivity.
- to provide data input to other classes.
- to provide security to other classes.
- to provide an appropriate base class from which other classes can inherit.
-
5. Classes that can be used to instantiate objects are called concrete classes.
- True
- False
-
6. What is default visibility mode for members of classes in C++ ?
- Private
- Public
- Protected
- Depends
-
7. Which is more memory efficient ?
- structure
- union
- both use same memory
- depends on a programmer
-
8. Which among following is not a valid visibility mode in c++ program ?
- Private
- Public
- Protected
- Limited
-
9. Even if we define a function in a class, then also we need to declare it first.
- True
- False
-
10. How we can define member function outside the class ?
- Using union
- Using structure
- Using pointers
- Using scope resolution
-
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;
-
12. How we can access data members using objects ?
- object@datamember
- object*datamember
- object->datamember
- object.datamember
-
13. Can we define array of classes in c++ ?
- Yes
- No
-
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.
-
15. What is actual syntax of destructor in c++ ?
- !Classname( )
- @Classname( )
- $Classname( )
- ~Classname( )
-
16. We can do constructor overloading in C++ ?
- True
- False
-
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.
-
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
-
19. Which of the following keywords are used to control access to a class member ?
- protected
- switch
- goto
- for
-
20. Which of the following cannot be passed to a function ?
- Array
- Reference variable
- Object
- File