This section contains more frequently asked Programming In C++ Basics Objective Questions Answers in the various University Level and Competitive Examinations.
1. What will be the result of the expression 13 & 25?
- 38
- 25
- 9
- 12
C. 9
2. Which of the following operator can be overloaded through friend function?
- ->
- =
- ( )
- *
D. *
3. To access the public function fbase() in the base class, a statement in a derived class function fder() uses the statement.fbase();
- fbase();
- fder();
- base::fbase();
- der::fder();
A. fbase();
4. If a base class destructor is not virtual, then
- It can not have a function body.
- It can not be called.
- It can not be called when accessed from pointer.
- Destructor in derived class can not be called when accessed through a pointer to the base class.
D. Destructor in derived class can not be called when accessed through a pointer to the base
class.
5. Maximum number of template arguments in a function template is
- one
- two
- three
- many
D. many
6. In access control in a protected derivation, visibility modes will change as follows:
- private, public and protected become protected
- only public becomes protected.
- public and protected become protected.
- only private becomes protected.
C. public and protected become protected.
7. Which of the following statement is valid?
- We can create new C++ operators.
- We can change the precedence of the C++ operators.
- We can change the associativity of the C++ operators.
- We can not change operator templates.
D. We can not change operator templates.
8. What will be the output of the following program? #include iostream.h void main() { float x=5,y=2; int result; result=x % y; cout result; }
- 1
- 1.0
- Error message
- 2.5
C. Error message
9. Which can be passed as an argument to a function?
- constant
- expression
- another function
- all of the above.
A. constant
10. Member functions, when defined within the class specification:
- are always inline.
- are not inline.
- are inline by default, unless they are too big or too complicated.
- are not inline by default.
A. are always inline.