Java - Interview Questions and Answers for 'Java memory management' | Search Java Interview Question - javasearch.buggybread.com
Javasearch.buggybread.com
Share

Search Java Interview Questions


 2137 questions in repository.
 There are more than 200 unanswered questions.
Click here and help us by providing the answer.
Label / Company      Label / Company / Text

   



Interview Questions and Answers for 'Java memory management' - 6 question(s) found - Order By Newest

 Q1. Does garbage collection guarantee that a program will not run out of memory?Core Java
Anonymous
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

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     java   garbage collection   java memory management   advanced

Try 1 Question(s) Test


Advanced level question usually asked in High end product companies. Have been asked in Google and Amazon (Based on 1 Feedback)
  Q2. Describe, in general, how java's garbage collector works ?Core Java
Anonymous
Ans. The Java runtime environment deletes objects when it determines that they are no longer being used. This process is known as garbage collection. The Java runtime environment supports a garbage collector that periodically frees the memory used by objects that are no longer needed. The Java garbage collector is a mark-sweep garbage collector that scans Java dynamic memory areas for objects, marking those that are referenced. After all possible paths to objects are investigated, those objects that are not marked (i.e. are not referenced) are known to be garbage and are collected.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     java   garbage collection   java memory management   advanced     LinkedIn  Infosys  Google  Netflix  Amazon  Huawei Technologies  JP Morgan  enGenius  CitiusTech  Goldman Sachs  Bank Of America India  Salesforce  Addteq  Criteo  Capgemini  Horizon Solutions  Way dot com      intermediate        frequent

Try 4 Question(s) Test


 Q3. What is a class loader ? What are the different class loaders used by JVM ?Core Java
Anonymous
Ans. Part of JVM which is used to load classes and interfaces.

Bootstrap , Extension and System are the class loaders used by JVM.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     java   class loaders  classloaders   jvm   java memory management   advanced     Snycon Software Solutions


 Q4. Should we override finalize method ?
Anonymous
Ans. Finalize is used by Java for Garbage collection. It should not be done as we should leave the Garbage Collection to Java itself.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     java   garbage collection   java memory management   finalize

Try 2 Question(s) Test


 Q5. Can we call the garbage collector explicitly ?Core Java
Admin
info@buggybread.com
Ans. Yes, We can call garbage collector directly but it doesn't guarantees that the gc will start executing immediately. This gc( ) method appears in both Runtime and System classes of java.lang package.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     java   garbage collection   java memory management   jvm   gc   yes no     Hewlett Packard (HP)  eGain  Egen Solutions  Computer Sciences Corporation (CSC)      expert

Try 1 Question(s) Test


 Q6. Java doesn't provide exclusive access to memory like C/C++ and other lower level languages ? What are the advantanges and disadvantages ?Core Java2017-05-20 16:22:05

Ans. Yes, doesn't provide exclusive access as we cannot allocate and deallocate memory exclusively as Java internally manages it. The advantage of this is that it relieves the coder for such tasks and helps protect from many bugs that may get introduced with imperfect coding. Moreover as java garbage collector collects all unclaimed memory or objects, it helps the application from memory leaks.

On the flip side , as coder doesn't have extensive excess to memory , it is upto java to decide on the state for programming construct and data storage and hence may introduce some security risks. For example - Java keeps string literals in string pool and there is no exclusive way to remove it and hence may stay and sensitive data in string pool may introduce security issues. Moreover when we overwrite a value or object for a variable / reference, it is upto java to purge those values and hence it may stay in memory for a while till java decide that it is no longer referenced and hence should be removed and hence makes it vulnerable for inappropriate access.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     disadvantages of garbage collection  advantages and disadvantages of java memory management  java for security applications  java with sensitive data  memory management




Subscribe to Java News and Posts. Get latest updates and posts on Java from Buggybread.com
Enter your email address:
Delivered by FeedBurner



comments powered by Disqus
 

Help us and Others Improve. Please let us know the questions asked in any of your previous interview.

Any input from you will be highly appreciated and It will unlock the application for 10 more requests.

Company Name:
Questions Asked:
         

X Close this

X Close this

Help Us Improve.
Please share your
interview experience.

Company Name:   


Questions Asked: