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 is the difference between #import and #include?

0 Answers  


Are there any special rules about inlining?

0 Answers  


What are the 2 main types of data structures?

0 Answers  


How can an improvement in the quality of software be done by try/catch/throw?

0 Answers  


What is the iunknown interface?

0 Answers  


What is a c++ class?

0 Answers  


What do you mean by Stack unwinding?

1 Answers  


To what does “event-driven” refer?

0 Answers  


What is c strings syntax?

0 Answers  


Which function should be used to free the memory allocated by calloc()?

0 Answers  


What is split a string in c++?

0 Answers  


What is general format for a prototype?

0 Answers  


Categories