C++ Programming Questions Answers - Chapter 1 Online Quiz Test
-
1. All members of class have which access to its members
- private
- public
- protected
- depends
-
2. Which operator is used to define a member of a class from outside the class definition
- ->
- ::
- .
- >>
-
3. Constructor is
- A class automatically called whenever a new object of this class is created
- A class automatically called whenever a new object of this class is destroyed
- A function automatically called whenever a new object of this class is created
- A function automatically called whenever a new object of this class is destroyed
-
4. If no constructor is there, then compiler assumes the class to have a default constructor with no arguments
- True
- False
-
5. How to define a destructor
- X~() {}
- X() {}~
- X() ~{}
- ~X() {}
-
6. Can we overload constructors in C++
- Yes
- No
-
7. Every class has atleast one construtor
- True
- False
-
8. Declaring pointer more than one can cause
- Trap
- abort a program
- error
- none of above
-
9. Meaning of deed copy is
- A deep copy creates a copy of the dynamically allocated objects too
- A deep copy just copies the values of the data as they are
- A deep copy creates a copy of the statically allocated objects too
- Both A and C
-
10. Which is not a correct variable type
- float
- int
- double
- real
-
11. Which is boolean operator for logical and
- &
- ||
- &|
- &&
-
12. Difference between static and dynamic memory allocation is
- In static memory allocation memory to be allocated in preknown
- In dynamic memory allocation memory to be allocated in preknown
- There is no differnece
- Not exact difference is mentioned
-
13. What is getline() in c++
- getline() extract the delimeter newline character from the input stream
- getline() does not extract the delimeter newline character from the input stream
- None of above
-
14. expression x.y represents as
- member x of object y
- member y of object x
- member y of object pointed by x
- all of above
-
15. Which of the following cannot be inherited from the base class
- Constructor
- Friend
- Both A and B cannot be inherited
- Both A and B can be inherited
-
16. cout is declared in the _____ standard file within the std namespace
- outstream
- stdin
- iostream
- None of above
-
17. How we mark the end of c++ statement
- ;
- :
- >>
- <<
-
18. Dereference operator is also called as
- pointer
- Reference operator
- Offset operator
- Deoffset operator
-
19. ios::ate is used for
- Set the initial position at the start of the file
- Set the last position at the end of the file
- Set the initial position at the end of the file
- Set the last position at the start of the file
-
20. Which class has only one unique value for all the objects of class
- this
- friend
- static
- none of above