Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


class Alpha {
public:
char data[10000];
Alpha();
~Alpha();
};
class Beta {
public:
Beta() { n = 0; }
void FillData(Alpha a);

private:
int n;
};
How do you make the above sample code more efficient?
a) If possible, make the constructor for Beta private to
reduce the overhead of public constructors.
b) Change the return type in FillData to int to negate the
implicit return conversion from "int" to "void".
c) Make the destructor for Alpha virtual.
d) Make the constructor for Alpha virtual.
e) Pass a const reference to Alpha in FillData

Answers were Sorted based on User's Feedback



class Alpha { public: char data[10000]; Alpha(); ~Alpha(); }; class Beta { ..

Answer / guest

pass a const reference to Alpha in FillData i.e Ans e)

Is This Answer Correct ?    16 Yes 4 No

class Alpha { public: char data[10000]; Alpha(); ~Alpha(); }; class Beta { ..

Answer / mpoleg

c)
all other options are not valid c++

Is This Answer Correct ?    1 Yes 3 No

Post New Answer

More C++ General Interview Questions

What are the methods of exporting a function from a dll?

0 Answers  


Write is a binary search tree? Write an algo and tell complexity?

0 Answers   Axtria,


What is c++ w3school?

0 Answers  


When the constructor of a base class calls a virtual function, why doesn't the override function of the derived class gets called?

0 Answers  


Which programming language is best to learn first?

0 Answers  


What is copy constructor? Can we make copy constructor private in c++?

0 Answers  


Give 2 examples of a code optimization?

4 Answers  


What is the use of 'using' declaration in c++?

0 Answers  


What is the most common mistake on c++ and oo projects?

0 Answers  


What is cin clear () in c++?

0 Answers  


What is code reusability in c++?

0 Answers  


implement stack using stack.h headerfile functions

1 Answers   Exilant, GMG, Subex, University,


Categories