Is it possible to return an entire linked list object from a method in C++ without running the destructor?

1 Answer

Answer :

Your description in the problem doesn’t really describe what you want it to do that you would call right, nor does it explain how it uses its linked list. If you haven’t figured out exactly what you want it to do in a consistent way that you can express, then no, you can’t do it right, because there’s nothing right to do. Once you do have a model of what you want to do that you can describe clearly, then yes, there will be a right way to do it.

Related questions

Description : State True or False i) A destructor never takes any argument nor does it return any value. ii) It releases memory space for future use. A) True, True B) True, False C) False, True D) False, False

Last Answer : A) True, True

Description : Implicit return type of a class constructor is: (A) not of class type itself (B) class type itself (B) a destructor of class type (D) a destructor not of class type 

Last Answer : (B) class type itself

Description : Write a program to declare class having data member as hrs, mins, secs. Write constructor to assign values and destructor to destroy values. Accept & display data for one object.

Last Answer : #include<iostream.h> #include<conio.h> class time { private: int hrs, mins,sec; public: time(int h,int m,int s) { hrs=h; mins=m; sec=s; } ~time() { cout<< hours ... } }; void main() { time t(2,43,56); t.display(); getch(); }

Description : What is the difference between the destructor and the Finalize() method? When does the Finalize() method get called?

Last Answer : Finalize() corresponds to the .Net Framework and is part of the System.Object class. Destructors are C#'s implementation of the Finalize() method. The functionality of both Finalize() and the destructor is the same

Description : Which of the following statement is true? i) Using singly linked lists and circular list, it is not possible to traverse the list backwards. ii) To find the predecessor, it is required to traverse the list from the first ... linked list. A) i-only B) ii-only C) Both i and ii D) None of both

Last Answer : C) Both i and ii

Description : The end of your world is upon you, and you are the one to choose how it all goes down. Which form of the destructor do you choose?

Last Answer : I would choose instant painless death of all sentient creatures via things like rapid brain aneurysms, followed by the planet collapsing into a black hole. I’m not sure what the most gruesome way would be, but imposing this on everyone seems like a decent start.

Description : What is Destructor?

Last Answer : A destructor is just opposite to constructor. it has same as the class name, but with prefix ~ (tilde). They do not have return types

Description : Is constructor or destructor inheritance explicit or implicit? What does this mean?

Last Answer : Constructor or destructor inheritance is explicit…. Public Extended : base() this is called the constructor initializer.

Description : What is a destructor?

Last Answer : A C# destuctor is not like a C++ destructor. It is actually an override for Finalize(). This is called when the garbage collector discovers that the object is unreachable. Finalize() is called before any memory is reclaimed.

Description : Which of the following is true about Java. A) Java does not support overloading. B) Java has replaced the destructor function of C++ C) There are no header files in Java. D) All of the above.

Last Answer : D) All of the above

Description : Write any two characteristics of destructor.

Last Answer : Characteristics: 1. It is used to destroy objects created by a constructor. 2. Name of destructor and name of the class is same. 3. Its name is preceded with tilde (~) symbol. 4. It ... the compiler upon exit from the program (or block or function) i.e when scope of object is over.

Description : What is destructor? How destructor is declared? When destructor is invoked?

Last Answer : Destructor: A destructor is a special member function used to destroy the objects that are created by a constructor. Declaration: Destructor is declared in public section of a class. It is member function ... from the program (or block or function) to clean up storage that is no longer accessible. 

Description : Explain destructor with suitable example. 

Last Answer : Destructor: 1. A destructor is a special member function whose task is to destroy the objects that have been created by constructor. 2. It does not construct the values for the data members of the class. 3. It is invoked ... main() { time t(2,43,56); t.display(); getch(); }

Description : Differentiate between constructor and destructor. 

Last Answer : Differentiate between constructor and destructor.

Description : Which of the following, in C++, is inherited in a derived class from base class ? (A) constructor (B) destructor (C) data members (D) virtual methods

Last Answer : (C) data members

Description : State the rules for writing destructor function.

Last Answer : Rules for writing destructor function are: 1) A destructor is a special member function which should destroy the objects that have been created by constructor. 2) Name of destructor and name of the class should ... should not be classified in any types. 7) A class can have at most one destructor. 

Description : An 80 year old multi millionare,man/woman,invites you to spend the weekend with them as their lover.In return you will inherit their entire estate worth a small fortune.Would you accept their invitation?

Last Answer : Go in a second. I can bear almost anything for a couple of days.

Description : An incision biopsy of an ulcerated and intruded clinically suspicious lesion in a 50 years-old female reveals chronic inflammation; you would:** A. Inform the patient and her physician of ... . Dismiss the patient with instructions for warm saline rinses and re-examination D. Repeat the biopsy

Last Answer : D. Repeat the biopsy

Description : A taxi driver make a trip from the plains to ooty which are 340km apart at an average speed of 60km/hr. In the return trip, he covers the speed distance at an average of 30 km/hr. the average speed of the taxi over the entire distance of 680 km is a) 30 b) 40 c) 50 d) 60 

Last Answer : B Average speed =(2xy/( x+y)) km/hr Given x =60 km/hr y = 30km/hr Average speed = (2*60*30/ (60+30)) km/hr =(3600/ 90) =40 km/hr

Description : Some people clean their kitchens/bathrooms with the tapwater running the entire time. Isn't that a selfish waste of water?

Last Answer : Yes it is.

Description : Three friends X, Y and Z run a running race, Y finished 12 meters ahead of Z and 18 m ahead of X, while Z finished 8m ahead of X. If each friends runs the entire distance at their respective constant speeds, what is the length of the race? a) 16m b) 48m c) 24m d) 12m 

Last Answer : B Let the length of the race track be 'd'. When Y finished the race, X and Z would have run (d−18) and (d−12) meters respectively. When Z finishes the race, X would have run (d-8) meters. The ratio of ... d2 -20d+96= d2 -18d 20d-18d=96 d=96/2=48m hence the length of the race track is 48m

Description : Which of the following condition is true for an object used as a function argument. i) A copy of the entire objects is passed to the function. ii) Only the address of the object is transferred to the function. A) Only i B) Only ii C) Both i and ii D) None of them

Last Answer : C) Both i and ii

Description : Which of the following is true about the static member variable in C++. i) It is initialized to zero when the first object of its class is created. Other initialization is also permitted. ii) It is visible only within ... , ii-True B) ii-False, ii-True C) i-True, ii-False D) i-False, iii-False

Last Answer : B) ii-False, ii-True

Description : The “part-whole”, or “a-part-of”, relationship in which objects representing the components of something associated with an object representing the entire assembly is called as (A) Association (B) Aggregation (C) Encapsulation (D) Generalisation

Last Answer : (B) Aggregation

Description : In ............ allocation method for disk block allocation in a file system, insertion and deletion of blocks in a file is easy. (A) Index (B) Linked (C) Contiguous (D) Bit Map

Last Answer : (B) Linked

Description : Can you please help me figure out how my work computer is linked to my cell phone, so I can "un-link" them?

Last Answer : answer:Now that I have an iphone and that icloud thingy it's bazaar how my ipad and iphone link up some things. You can try to disable the email you are talking about on your phone or computer and ... rid of that email. Before you do I would wait for more tech savvy jellies to answer obviously. GQ.

Description : How can I delete linked email addresses in Gmail?

Last Answer : answer:Not 100% sure this is what you're referring to, but I think if you click on the gear wheel (under that right-hand corner icon), select Settings, then go to the Accounts and Import tab, ... !). You may want to do a bit more research about this before proceeding - perhaps on Google forums.

Description : Are the amount of chemicals in the food you eat (or don't eat) an issue to you (for example the McDonald's McRib Sandwich ingredient list, articles linked here)?

Last Answer : No. And the photo is just what meat looks like when it's flash frozen. Any meat will look like that. The fact that it's been chopped and pressed into that shape isn't particularly appealing to ... we do it with hamburgers too. Past too. Wendy's presses their hamburger into squares or they used to.

Description : Which is/are correctly linked here? `{:(,"List I",,"List II"),((a),E_(1)Cb,(a),"Carbanion formation"),((b),E_(2),(b),"Stereo specific"),((c),S_(N^(1))

Last Answer : Which is/are correctly linked here? `{:(,"List I",,"List II"),((a),E_(1)Cb,(a),"Carbanion formation" ... "),((d),E_(1),(d),"Carbocation formation"):}`

Description : A system wherein items are added from one and removed from the other end. a) Stack b) Queue c) Linked List d) Array

Last Answer : Answer: b Explanation: In a queue, the items are inserted from the rear end and deleted from the front end

Description : Define what is linked list?

Last Answer : A linked list is composed of nodes that are connected with another. In C programming, linked lists are created using pointers. Using linked lists is one efficient way of utilizing memory for storage.

Description : Linked Lists -- Can you tell me how to check whether a linked list is circular?

Last Answer : Create two pointers, and set both to the start of the list. Update each as follows: while (pointer1) { pointer1 = pointer1->next; pointer2 = pointer2->next; if (pointer2) pointer2=pointer2->next ... before pointer1, or the item before that. Either way, its either 1 or 2 jumps until they meet.

Description : Tell how to check whether a linked list is circular.

Last Answer : Create two pointers, each set to the start of the list. Update each as follows: while (pointer1) { pointer1 = pointer1->next; pointer2 = pointer2->next; if (pointer2) pointer2=pointer2->next; if (pointer1 == pointer2) { print (\"circular\n\"); }

Description : How do you write a function that can reverse a linked-list?

Last Answer : if(head==0) return; if(head->next==0) return; if(head->next==tail) { head->next = 0; tail->next = head; } else { node* pre = head; node* cur = head->next; node* curnext = cur->next; ... cur->next = pre; pre = cur; cur = curnext; curnext = curnext->next; } curnext->next = cur; } }

Description : How do you find out if a linked-list has an end? (i.e. the list is not a cycle)

Last Answer : You can find out by using 2 pointers. One of them goes 2 nodes each time. The second one goes at 1 nodes each time. If there is a cycle, the one that goes 2 nodes each time will eventually meet the one that goes slower. If that is the case, then you will know the linked list is a cycle.

Description : Suppose you want to delete the name that occurs before “Vivek” in an alphabetical listing. Which of the following data structures shall be most efficient for this operation? (A) Circular linked list (B) Doubly linked list (C) Linked list (D) Dequeue

Last Answer :  (B) Doubly linked list 

Description : If the queue is implemented with a linked list, keeping track of a front pointer and a rear pointer, which of these pointers will change during an insertion into a non-empty queue? (A) Neither of ... (B) Only front pointer changes (C) Only rear pointer changes (D) Both of the pointers changes

Last Answer : (C) Only rear pointer changes

Description : Consider an implementation of unsorted single linked list. Suppose it has its representation with a head and a tail pointer (i.e. pointers to the first and last nodes of the linked list). Given the ... the front node of the linked list. (D) Deletion of the last node of the linked list.

Last Answer : (D) Deletion of the last node of the linked list. 

Description : Is it true is only credit card that can be linked to paypal account? And it's not possible with debit card?

Last Answer : One thing that I am sure about PayPal is the fact that they are one of the best international money transaction company that we have out there. This is to say that as a mode of operation, they ... at before deciding that it is not cool to allow users to link their debit cards to their accounts.

Description : Study the pedigree chart given below. What does it show? (a) Inheritance of a condition like phenylketonuria as an autosomal recessive trait. (b) The pedigree chart is wrong as this is ... disease like haemophilia. (d) Inheritance of a sex-linked inborn error of metabolism like phenylketonuria

Last Answer : (a) Inheritance of a condition like phenylketonuria as an autosomal recessive trait.

Description : 25 buses are running between two places P and Q. In how many ways can a person go from P to Q and return by a different bus? a) 300 b) 625 c) 600 d) 650

Last Answer : c) 600

Description : There is a limit to the increase in length or increase in volume beyond which the object does not return to its previous shape. What is this limit ?

Last Answer : There is a limit to the increase in length or increase in volume beyond which the object does not return to its previous shape. This limit is called elastic limit.

Description : The act of obtaining a desired object from someone by offering something in return is called 1. Transaction 2. Exchange 3. Relationship 4. Value 5. None of these

Last Answer : Exchange

Description : The act of obtaining a desired object from someone by offering something in return is called ? 1. Transaction 2. Exchange 3. Relationship 4. Value 5. none of these

Last Answer : Exchange

Description : The object of portfolio is to reduce ……by diversification A . Return B. Risk C. Uncertainty D. Percentage

Last Answer : Answer: B 

Description : A business that adopts the proactive strategy to social responsibility: A)assumes responsibility for its actions and responds to accusations without outside pressure B)tries to minimise or avoid additional ... )allows a condition or potential problem to go unresolved until the public learns about it

Last Answer : A)assumes responsibility for its actions and responds to accusations without outside pressure

Description : When multiple instances of a program are running (but windows are closed) in Windows 7, is there a way to have the program open by clicking the taskbar button (without having to take the extra step of clicking a thumbnail)?

Last Answer : Right click on the taskbar. Click properties, you should see something that says “Taskbar buttons”. You can choose to have it “Never combine” or to only combine when full. This would make it handle windows the same way vista did.

Description : Every year, sometimes during winter and sometimes in the springtime, an elderly woman takes 12 pieces of food, each in its own separate colorful container, and strategically places them outside in her front and ... is there some method to her madness ----- and what animal does she blame? -Riddles

Last Answer : The elderly woman has many grandchildren who she invites to her house each year to her annual Easter egg hunt! She challenges them to find the 12 colorful eggs the Easter Bunny has hidden for them.

Description : What method can be used to separate parts of a liquid mixture if the entire mixture can pass through a filter?

Last Answer : YOu

Description : Pick up the correct statement from the following: A. The maximum rate of storm runoff is called peak drainage discharge B. Rational method of estimating peak run off, may be used precisely for ... entire area starts contributing to the runoff, is called the time of concentration D. All the above

Last Answer : ANS: D