Sail E0 Webinar

MCQs

Total Questions : 10
Question 1.

Which is used to pass the large objects in c++?


  1.    pass by value
  2.    pass by reference
  3.    both a & b
  4.    None of the mentioned
 Discuss Question
Answer: Option B. -> pass by reference

Because by using pass by reference we need to pass only address location, So it can save 

Question 2.

In linux, how does the heaps and stacks are managed?


  1.    ram
  2.    secondary memory
  3.    virtual memory
  4.    None of the mentioned
 Discuss Question
Answer: Option C. -> virtual memory

In virtual memory, We can keep track of all the objects and access them much faster than 

any another.


Question 3.

How to unlimit the size of the stack?


  1.    setrlimit()
  2.    unlimit()
  3.    both a & b
  4.    None of the mentioned
 Discuss Question
Answer: Option A. -> setrlimit()

None.


Question 4.

What is the size of the heap?


  1.    10MB
  2.    500MB
  3.    1GB
  4.    Size of the heap memory is limited by the size of the RAM and the swap memory
 Discuss Question
Answer: Option D. -> Size of the heap memory is limited by the size of the RAM and the swap memory

None.


Question 5.

Which option is best to eliminate the memory problem?


  1.    use smart pointers
  2.    use smart pointers
  3.    use virtual destructor
  4.    both a & c
 Discuss Question
Answer: Option D. -> both a & c

Explanation: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.


Question 6.

How to stop your program from eating so much ram?


  1.    Find a way to work with the data one at a time.
  2.    Declare it in program memory, instead of on the stack.
  3.    Use the hard drive, instead of RAM.
  4.    All of the mentioned
 Discuss Question
Answer: Option D. -> All of the mentioned

None.


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
  1.    X::operator=(X const &)
  2.    X::X( X const & )
  3.    X::X()
  4.    None of the mentioned
 Discuss Question
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()


Question 8.

When we are using heap operations what do we need to do to save the memory?


  1.    rename the objects
  2.    delete the objects after processing
  3.    both a & b
  4.    None of the mentioned
 Discuss Question
Answer: Option B. -> delete the objects after processing

when 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.


Question 9.

How to store the large objects in c++ if it extents its allocated memory?


  1.    memory heap
  2.    stack
  3.    queue
  4.    None of the mentioned
 Discuss Question
Answer: Option A. -> memory heap

None.


Question 10.

Which container in c++ will take large objects?


  1.    string
  2.    class
  3.    vector
  4.    None of the mentioned
 Discuss Question
Answer: Option C. -> vector

Because vector is mainly used to store large objects for game
programming and other operations etc.


Latest Videos

Latest Test Papers