What is a Garbage collection?

1 Answer

Answer :

Garbage collection is the mechanism that reclaims the memory resources of an object when it is no longer referenced by a variable. And Net Runtime performs automatically performs garbage collection

Related questions

Description : What is Interface?

Last Answer : An Interface is a group of constants and method declaration interface like classes, define a set of properties, methods, and events. But unlike classes, interfaces do not provide implementation

Description : How many types of Access Modifiers?

Last Answer : Public – Allows the members to be globally accessible. Private – Limits the member’s access to only the containing type. Protected – Limits the member’s access to the containing type and all classes derived from the containing type. Internal – Limits the member’s access to within the current project

Description : Whait is Method overriding?

Last Answer : Method overriding occurs when child class declares a method that has the same type arguments as a method declared by one of its superclass. By declaring base class function as virtual, we allow the function to be overridden in any of derived class

Description : What is a Method Overloading?

Last Answer : Method with same name but with different arguments is called method overloading

Description : What is Polymorphism?

Last Answer : Polymorphism means same operation may behave differently on different classes. Example : 1. Method Overloading and Method Overriding

Description : Is .NET C# supports Multiple inheritance?

Last Answer : Multiple inheritance of classes is not allowed in C#. but In C# you can implements more than one interface, thus multiple inheritance is achieved through interface

Description : Can you allow a class to be inherited, but prevent the method from being overridden?

Last Answer : Yes. Just leave the class public and make the method sealed

Description : Can you prevent your class from being inherited by another class?

Last Answer : Yes. The keyword “sealed” will prevent the class from being inherited.

Description : What are Sealed Classes in C#?

Last Answer : The sealed modifier is used to prevent derivation from a class

Description : What is an Inheritance?

Last Answer : The process of sub-classing a class to extend its functionality is called Inheritance. Advantage : It provides idea of reusability.

Description : What is ref keyword & out keyword?

Last Answer : Refrence Variable “must” be initialized before it is passed into a method.

Description : What is Value Type and Reference Type?

Last Answer : A variable is value type or reference type is solely determined by its data type. Ex: int, float, char, decimal, bool, decimal, struct, etc are value types As name suggest Reference Type stores reference to the ... ; Y = X; Console.writeline(Y.value); Y.value = 50; Console.writeline(X.value);

Description : What is Enumeration?

Last Answer : Enumeration improves code readability. It also helps in avoiding typing mistake

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 : 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 : What is Finalize() Method of Object class?

Last Answer : Each class in C# is automatically (implicitly) inherited from the Object class which contains a method Finalize(). This method is guaranteed to be called when your object is garbage collected

Description : What is Static Constructor?

Last Answer : In C# it is possible to write a static no-parameter constructor for a class. Such a class is executed once, when first object of class is created. Class MyClass { static MyClass() { //Initialization Code for static fields and properties. } }

Description : What is Static Method of the class?

Last Answer : Methods that you can call directly without first creating an instance of a class. 1. As static methods may be called without any reference to object

Description : What is static member of a calss?

Last Answer : Static members belong to the whole class rather than to individual object Static members are accessed with the name of class rather than reference to objects

Description : What is Constructor?

Last Answer : A constructor is a special method whose task is to initialize the object of its class. 1. It is special because its name is the same as the class name 2. They do not have return ... can call the base class constructor 4. Constructor is invoked whenever an object of its associated class is created

Description : Whar are properties?

Last Answer : Attribute of object is called properties Example:- A car has color as property.

Description : What is an encapsulation?

Last Answer : Wrapping up of data and function into a single unit is known as Encapsulation.

Description : What is an Object?

Last Answer : Instance of Class is called object. An object is created in memory using keyword “new”.

Description : What is a Class?

Last Answer : A user-defined data structure that groups properties and methods. Class doesn’t occupies memory.

Description : Briefly describe how garbage collection works.

Last Answer : The garbage collector is a thread that runs in the background of managed .NET applications. It constantly traces the reference tree and attempts to find objects that are no longer referenced. When a nonreferenced object is found, its memory is reclaimed for later use.

Description : Describe garbage collection (in simple terms).

Last Answer : Garbage collection eliminates uneeded objects. 1. the new statement allocates memory for an object on the heap. 2. When no objects reference the object it may be removed from the heap (this is a non deterministic process). 3. Finalize is called just before the memory is released.

Description : Does garbage collection guarantee that a program will not run out of memory?

Last Answer : Ans. Garbage collection does not guarantee that a program will not run out of memory. It is possible for programs to use up memory resources faster than they are garbage collected. It is also possible for programs to create objects that are not subject to garbage collection

Description : Describe the java garbage collection mechanism?

Last Answer : Since objects are dynamically allocated by using the new operator, you might be wondering how such objects are destroyed and their memory released for later reallocation. The technique that accomplishes this is ... to be no longer needed, and the memory occupied by the object can be reclaimed.

Description : ______ involves traversing the entire file system, marking everything that can be accessed. (1) Index pointer (2) Garbage collection (3) File system (4) Stack pointer

Last Answer : Garbage collection

Description : Other than raccoons what likes to go through garbage, if not well secured?

Last Answer : Dumpster divers.

Description : Do you throw out the garbage everyday or only when it is full?

Last Answer : Our trash is picked up twice a week, and our recycle once a week. Usually, I have one bag of trash for each pick up twice a week. My recycle doesn't go out every week, but pribablybits 3 times ... doesn't fit I'll put it in a small plastic bag from the supermarket. This very rarely happens though.

Description : Do garbage trucks dump their loads at the end of each day (so they start out the next day with an empty truck)?

Last Answer : It depends. Hard to generalize on this, because some trash companies are small, some large. Some have transfer stations or dumps that are close; some are a long way away. Some trucks are full by ... if necessary, over night or in the morning. Plus, it keeps the truck from being infested overnight.

Description : Where are the garbage flies until the garbage comes out?

Last Answer : Seriously, they’re attracted to the smell. Even if your garbage doesn’t smell to you, it’s attractive to the fries. Trash cans can become extremely smelly (and attractive) in the heat. A little moisture is all that will clinch it for them.

Description : Home: 14 years and 3 garbage disposals?

Last Answer : It doesn’t turn on ? Or it’s jamming up? Or motors burning out?

Description : Do the garbage men leave the roll-out bin open just to be assertive?

Last Answer : Our trash service does that to. I’d imagine it’s a time saving thing, probably paired with laziness.

Description : What do you do with your nasty leftovers if the garbage disposal is out?

Last Answer : I have no garbage disposal in my apartment, so I take leftovers that are likely to smell directly to the dumpster. My mother, who lives in an area with regular trash pick up rather than a dumpster ... trash day-she puts any garbage that she doesn't want inside the house directly into that trash can.

Description : Can you live without a dishwasher, microwave, stove or garbage disposal ?

Last Answer : answer:I don't have a garbage disposal so I definitely could live without that. I also don't have a microwave, so I definitely could live without that. Someone gave me one for Christmas, I didn't use it ... . I probably could live without a dishwasher if I didn't have one, but it's a nice luxury.

Description : What is the proper way to burn garbage?

Last Answer : Are you living in the U.S.? Is it legal to burn garbage in your town/state?

Description : How does the garbage man pick up the smaller trash can?

Last Answer : I don’t know how they do it in San Diego, here they use a cable attached to a winch on the smaller cans that don’t fit their equipment, unless they are light enough to lift by hand.

Description : Garbage disposal under a bathtub drain. Good idea? Or whacked?

Last Answer : answer:I won’t say it can’t be done, but I have two key questions. Will a garbage disposal handle the hair and gunk that normally clogs a tub drain? How hard would it be to get to when it needs to be serviced?

Description : Can I stop the garbage from smelling really bad?

Last Answer : You might want to start off by washing out the garbage can after trash pick up. Pour some ammonia in it and let it sit for about 30 minutes. Scrub it, then rinse in out well. After you have ... bag all garbage that you throw away in plastic bags. That should take care of the smell in your room.

Description : Why is my garbage chute so dang windy?

Last Answer : The air pressures in your building are not being properly balanced, so that the pressure inside the building is lower than the outside pressures. Usually there are ventilation systems in large buildings like yours to prevent this. Here’s a very technical but very thorough explanation.

Description : I feel like no matter what I do, my garbage is always stinky. How do you keep your garbage from reeking?

Last Answer : What the heck are you throwing in there? My trash can doesn’t stink.

Description : Has the Pacific Garbage Patch been affected by the tsunami's movement across the Pacific?

Last Answer : Yes, it is still there. Out in the open ocean a tsunami is almost unnoticeable. The amplitude (height) of the wave is many times lower, and it has a much longer wavelength. If you were ... movement of water in shallow areas. The plastic atlantis will hardly budge when a tsunami goes through it.

Description : How would you solve the garbage problems in big cities?

Last Answer : Which particular problem about garbage?

Description : To the people who refuse plastic bags at the grocery store: what do you put your garbage out in?

Last Answer : Garbage bags that we buy in the store. They have to be different colors anyway for recycling purposes and we have much bigger garbage cans – those small plastic bags are useless.

Description : Is it more eco-friendly to put garbage in the trash or use a disposal?

Last Answer : answer:Of course composting is best. If you can't do that then putting it in a garbage can is best. The in-sink garbage disposal uses water. It then sends the sludge into more water which eventually ... as much food waste as possible to the birds and other critters in my area. The rest I discard.)

Description : The Real L Word; before I give it a go (and watch it), is it any good, or garbage?

Last Answer : It’s no better than any other reality tv show meaning it’s crap that you can’t stop watching.

Description : I think my garbage was stolen. Should I freak out now?

Last Answer : Maybe a raccoon got into your garbage. They are notorious scavengers. Or it could’ve been a dog. Neither of which will be stealing your identity.

Description : Do you have a lot of garbage to throw out every week?

Last Answer : Even with kids, that's hard for me to imagine. I take a 30-gallon bag with a knot pretty far down from the top of it to the dump about once every four or five weeks. Granted I live alone, but ... us it wasn't much different. Do you separate your recyclables, etc? What the heck is in those bags?!?