Core Java - Interview Questions and Answers for 'Jvm' | Search Interview Question - javasearch.buggybread.com
Javasearch.buggybread.com

Search Interview Questions


 More than 3000 questions in repository.
 There are more than 900 unanswered questions.
Click here and help us by providing the answer.
 Have a video suggestion.
Click Correct / Improve and please let us know.
Label / Company      Label / Company / Text

   



Interview Questions and Answers - Order By Newest

   
 Q31. What is Byte Code ? Why Java's intermediary Code is called Byte Code ?
Ans. Bytecode is a highly optimized set of instructions designed to be executed by the Java run-time system. Its called Byte Code because each instruction is of 1-2 bytes.

Sample instructions in Byte Code -

1: istore_1
2: iload_1
3: sipush 1000
6: if_icmpge 44
9: iconst_2
10: istore_2

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

   Like         Discuss         Correct / Improve     java   jvm   interpreter   platform independent   byte code


 Q32. Difference between PATH and CLASSPATH ?Operating System
Ans. PATH is the variable that holds the directories for the OS to look for executables. CLASSPATH is the variable that holds the directories for JVM to look for .class files ( Byte Code ).

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

   Like         Discuss         Correct / Improve     java   path   classpath   byte code   jvm   basic interview question     Asked in 3 Companies      intermediate        rare


 Q33. Should we create system software ( e.g Operating system ) in Java ?Core Java
Ans. No, Java runs on a virtual machine called JVM and hence doesn't embed well with the underlying hardware. Though we can create a platform independent system software but that would be really slow and that's what we would never need.

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

   Like         Discuss         Correct / Improve     java   system software java   jvm   yes-no   yes no   java operating system   architecture


 Q34. What is OutOfMemoryError in Java?Core Java
Ans. OutOfMemoryError in Java is a subclass of VirtualMachineError and is thrown by JVM when it runs out of heap memory.

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

   Like         Discuss         Correct / Improve     outofmemoryerror   error   exceptions   jvm   java   heap memory   heap


 Q35. Which is of the following is NOT TRUE for JVM ?

a. JVM reads Byte Code and generates Machine Code.
b. JVM is a virtual Machine that acts as a intermediary between Java Application and Host Operating System.
c. JVM reads Source Code and generates Byte Code.
d. JVM acts as a translator that translates different Machine code ( on the basis of Host Machine ) for a common Byte Code.
Ans. JVM reads Source Code and generates Byte Code.

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

   Like         Discuss         Correct / Improve     java   jvm


 Q36. What are the disadvantages of running multiple apps in single JVM ?Core Java
Ans. 1. Issue with Jar and ClassPath Conflicts

2. Killing JVM will terminate all applications

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

   Like         Discuss         Correct / Improve     JVM     Asked in 1 Companies


 Q37. How can one determine if JVM is 32-bit or 64-bit from Java Program ?Core Java
Ans. There is a Java system property "sun.arch.data.model" that can tell if JVM is 32 bit of 64 bit

System.getProperty("sun.arch.data.model") can be used to get that property.

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

   Like         Discuss         Correct / Improve     jvm      intermediate        rare


 Q38. How can we find the memory usage of JVM from Java code?Core Java
Ans. Using Runtime object.

Runtime runtime = Runtime.getRuntime();

runtime.totalMemory();
runtime.freeMemory();

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

   Like         Discuss         Correct / Improve     jvm  memory management        rare


Frequently asked in Alibaba (Based on 2 feedback)
 Q39. What is the best Memory setting for JVM ?Core Java
Ans. In Java JVM memory settings is done by use the arguments -Xms -Xmx. Use M or G after the numbers for indicating Megs and Gigs of bytes respectively. -Xms indicates the minimum and -Xmx the maximum.

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

   Like         Discuss         Correct / Improve     jvm  memory management  jvm best memory setting     Asked in 1 Companies      intermediate


 Q40. What is Shutdown hook ?Core Java
Ans. Shutdown hook is a thread that is invoked before the JVM is shut down. we can use it perform resource cleaning task.

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

   Like         Discuss         Correct / Improve     shutdown hook  jvm

Try 1 Question(s) Test


 Q41. What is an execution engine within JVM ?Core Java
Ans. Execution engine contains interpreter and JIT compiler, which covert byte code into machine code.


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

   Like         Discuss         Correct / Improve     jvm  execution engine  compiler     Asked in 1 Companies


 Q42. What is JVM ?Core Java
Ans. JVM (Java Virtual Machine) is an abstract machine. It is a specification that provides runtime environment in which java bytecode can be executed.JVMs are available for many hardware and software platforms (i.e. JVM is platform dependent).Runtime Instance Whenever you write java command on the command prompt to run the java class, an instance of JVM is createdThe JVM performs following operation:Loads codeVerifies codeExecutes codeProvides runtime environment

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

   Like         Discuss         Correct / Improve     memory management  jvm     Asked in 3 Companies      basic        frequent


 Q43. Can we compile and execute a Java class without main method ?Core Java
Ans. No without main method can not be executed it will throw an error illegal start of type. Main method is the entry point of application.

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

   Like         Discuss         Correct / Improve     jvm  compilation  main method      Basic


 Q44. Is JDK required on each machine where a Java application needs to be run ?Core Java
Ans. No, to run application, machine needs just a JRE (Java Runtime Environment)

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

   Like         Discuss         Correct / Improve     jvm  jdk      Basic


 Q45. In which memory segment - heap or stack, the following stored by JVM

1. static members
2. objects
3. object references
4. local or method variables

Core Java
Ans. static members are stored in method area of heap

objects are stored on heap

object references are stored on stack

local or method variables are stored on stack

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

   Like         Discuss         Correct / Improve     jvm  memory management  stack  heap


 Q46. Why is JVM called Virtual machine ?Core Java
 This question is still unanswered. Can you please provide an answer.


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

   Like         Discuss         Correct / Improve     jvm


 Q47. What are different methods to get the permanent gen space of running application?Core Java
 This question was recently asked at 'Apcolite'.This question is still unanswered. Can you please provide an answer.


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

   Like         Discuss         Correct / Improve     jvm  memory management     Asked in 1 Companies      advanced


previous 30   

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: