C++ programming language
21. If you wanted to sort many large objects or structures, it would be most efficient to
- place them in an array & sort the array.
- place pointers to them in an array & sort the array.
- place them in a linked list and sort the linked list.
- place references to them in an array and sort the array.
Correct answer: (C)
place them in a linked list and sort the linked list.
22. In C++, dynamic memory allocation is accomplished with the operator _________
- new
- this
- malloc( )
- delete
23. In multiple inheritance
- the base classes must have only default constructors
- cannot have virtual functions
- can include virtual classes
- None of the above.
Correct answer: (C)
can include virtual classes
24. In which case is it mandatory to provide a destructor in a class?
- Almost in every class
- Class for which two or more than two objects will be created
- Class for which copy constructor is defined
- Class whose objects will be created dynamically
Correct answer: (D)
Class whose objects will be created dynamically
25. It is possible to declare as a friend
- a member function
- a global function
- a class
- all of the above
Correct answer: (D)
all of the above
26. Mechanism of deriving a class from another derived class is known as _________
- Polymorphism
- Single Inheritance
- Multilevel Inheritance
- Message Passing
Correct answer: (C)
Multilevel Inheritance
27. Overloading the function operator
- requires a class with an overloaded operator.
- requires a class with an overloaded [ ] operator.
- allows you to create objects that act syntactically like functions.
- usually make use of a constructor that takes arguments.
Correct answer: (A)
requires a class with an overloaded operator.
28. Pure virtual functions
- have to be redefined in the inherited class.
- cannot have public access specification.
- are mandatory for a virtual class.
- None of the above.
Correct answer: (A)
have to be redefined in the inherited class.
29. RunTime Polymorphism is achieved by _________
- friend function
- virtual function
- operator overloading
- function overloading
Correct answer: (B)
virtual function
30. The address of a variable temp of type float is
- *temp
- &temp
- float & temp
- float temp &