Large Objects(C++ Programming ) Questions and Answers
Explanation:-
Answer: Option B. -> pass by referenceBecause by using pass by reference we need to pass only address location, So it can save
Explanation:-
Answer: Option C. -> virtual memoryIn virtual memory, We can keep track of all the objects and access them much faster than
any another.
Explanation:-
Answer: Option A. -> setrlimit()None.
Explanation:-
Answer: Option D. -> Size of the heap memory is limited by the size of the RAM and the swap memoryNone.
Explanation:-
Answer: Option D. -> both a & cExplanation:Virtual destructor means is that the object is destructed in reverse order in which
it was constructed and the smart pointer will delete the object from memory when the object
goes out of scope.
Explanation:-
Answer: Option D. -> All of the mentionedNone.
Question 7.
What is the output of this program?
1.
#include
2.
using namespace std;
3.
class sample
4.
{
5.
public:
6.
sample()
7.
{
8.
cout
- X::operator=(X const &)
- X::X( X const & )
- X::X()
- None of the mentioned
Explanation:-
Answer: Option C. -> X::X()As we are passing the object without any attributes it will return as X::X().
Output:
$ g++ large.cpp
$ a.out
X::X()
Explanation:-
Answer: Option B. -> delete the objects after processingwhen you allocate memory from the heap, you must remember to clean up objects when you're
done! Failure to do so is called a memory leak.
Explanation:-
Answer: Option A. -> memory heapNone.
Explanation:-
Answer: Option C. -> vectorBecause vector is mainly used to store large objects for game
programming and other operations etc.