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 #include sstream?

0 Answers  


Why cout is used in c++?

0 Answers  


What are c++ stream classes?

0 Answers  


What are the various access specifiers in c++?

0 Answers  


I need to find a specific string between two strings how do I do it?

1 Answers   Infosys,


What happens if a pointer is deleted twice?

0 Answers   Flextronics,


Describe the syntax of single inheritance in C++?

0 Answers   Fidelity,


Why is c++ not purely object oriented?

0 Answers  


what is importance of data sturture in a programming language?

22 Answers   L&T, TCS, Wipro,


Does c++ have foreach?

0 Answers  


How does a C++ structure differ from a C++ class?

0 Answers   NIIT,


what is the size of a class which contains no member variables but has two objects??? is it 1 or 2??

4 Answers  


Categories