SlideShare una empresa de Scribd logo
1 de 2
.Net Interview Questions on Garbage Collection

Garbage Collection in .Net
.Net Framework's -Memory Management Garbage Collector which manages allocation and release of memory
from application.Now developers no need to worry about memory allocated for each object which is created
on application . garbage collector automatically manages memory on application

Garbage Collection Interview Questions

I would like share this horrible experience which I faced in one of the big IT multinational company. Even though I
have 8 years of experience, I flunked very badly and I flunked due to 1 topic "Garbage collector". I hope the below
discussion will help some one down the line when facing c sharp and dot net interviews. I just hope dot net interviews
get more matured down the line and ask practical questions rather than asking questions which we do not use on day
to day to basis.

The interviewer started with a basic question which I knew pretty well

.NET Interview Questions and answers on Garbage Collector

What is a garbage collector?

Garbage collector is a background process which checks for unused objects in the application and cleans them up.


After that answer my guess was the interviewer will not probe more....but fate turned me down ,
came the bouncer.

What are generations in garbage collector?

Generation define the age of the object.


Well i did not answer the question , i have just written down by searching in google....

How many types of Generations are there in GC garbage collector?

There are 3 generations gen 0 , gen 1 and gen 2.


Then came a solid tweak questions which i just slipped by saying Yes...

Does garbage collector clean unmanaged objects ?

No.


Then came the terror question...which i never knew...

When we define clean up destructor , how does it affect garbage collector?

If you define clean up in destructor garbage collector will take more time to clean up the objects and more and more
objects are created in Gen 2..
How can we overcome the destructor problem ?

By implementing "Idisposable" interface.


The above question was tricky , you can search in google for finalize and dispose patterns.

Where do we normally put unmanaged code clean up?.

In finalize a.k.a destructor.


One thing i learnt from this interview experience is one thing but we also should know core
concepts in detail to crack Dot net interviews .

By ShivPrasad Koirala

For more Queries please visit : http://www.questpond.com

Más contenido relacionado

Destacado

Destacado (10)

Object-oriented Programming in Python
Object-oriented Programming in PythonObject-oriented Programming in Python
Object-oriented Programming in Python
 
Python Tricks That You Can't Live Without
Python Tricks That You Can't Live WithoutPython Tricks That You Can't Live Without
Python Tricks That You Can't Live Without
 
Introduction to python for Beginners
Introduction to python for Beginners Introduction to python for Beginners
Introduction to python for Beginners
 
Python Advanced – Building on the foundation
Python Advanced – Building on the foundationPython Advanced – Building on the foundation
Python Advanced – Building on the foundation
 
Introduction to Python
Introduction to Python Introduction to Python
Introduction to Python
 
Python 101: Python for Absolute Beginners (PyTexas 2014)
Python 101: Python for Absolute Beginners (PyTexas 2014)Python 101: Python for Absolute Beginners (PyTexas 2014)
Python 101: Python for Absolute Beginners (PyTexas 2014)
 
Inversion Of Control: Spring.Net Overview
Inversion Of Control: Spring.Net OverviewInversion Of Control: Spring.Net Overview
Inversion Of Control: Spring.Net Overview
 
Python Worst Practices
Python Worst PracticesPython Worst Practices
Python Worst Practices
 
Learn 90% of Python in 90 Minutes
Learn 90% of Python in 90 MinutesLearn 90% of Python in 90 Minutes
Learn 90% of Python in 90 Minutes
 
Introduction to Python
Introduction to PythonIntroduction to Python
Introduction to Python
 

Último

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Último (20)

Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 

Questpond Net interview questions on garbage collection

  • 1. .Net Interview Questions on Garbage Collection Garbage Collection in .Net .Net Framework's -Memory Management Garbage Collector which manages allocation and release of memory from application.Now developers no need to worry about memory allocated for each object which is created on application . garbage collector automatically manages memory on application Garbage Collection Interview Questions I would like share this horrible experience which I faced in one of the big IT multinational company. Even though I have 8 years of experience, I flunked very badly and I flunked due to 1 topic "Garbage collector". I hope the below discussion will help some one down the line when facing c sharp and dot net interviews. I just hope dot net interviews get more matured down the line and ask practical questions rather than asking questions which we do not use on day to day to basis. The interviewer started with a basic question which I knew pretty well .NET Interview Questions and answers on Garbage Collector What is a garbage collector? Garbage collector is a background process which checks for unused objects in the application and cleans them up. After that answer my guess was the interviewer will not probe more....but fate turned me down , came the bouncer. What are generations in garbage collector? Generation define the age of the object. Well i did not answer the question , i have just written down by searching in google.... How many types of Generations are there in GC garbage collector? There are 3 generations gen 0 , gen 1 and gen 2. Then came a solid tweak questions which i just slipped by saying Yes... Does garbage collector clean unmanaged objects ? No. Then came the terror question...which i never knew... When we define clean up destructor , how does it affect garbage collector? If you define clean up in destructor garbage collector will take more time to clean up the objects and more and more objects are created in Gen 2..
  • 2. How can we overcome the destructor problem ? By implementing "Idisposable" interface. The above question was tricky , you can search in google for finalize and dispose patterns. Where do we normally put unmanaged code clean up?. In finalize a.k.a destructor. One thing i learnt from this interview experience is one thing but we also should know core concepts in detail to crack Dot net interviews . By ShivPrasad Koirala For more Queries please visit : http://www.questpond.com