MCQ on JVM and Java Memory management


Q) Compiler converts
  1. Java program to byte code
  2. Java program to machine code
  3. Java program to octal code
  4. Java program to hexadecimal code

Answer: 1
Compiler compile java program and convert in byte code (class file) and interpreter convert byte code to machine code.


Q) Which one is reference type?
  1. Int
  2. Float
  3. Double
  4. Class

Answer: 4
Int, float and double all are primitive type and a class is of reference type


Q) True statements about object of Insurance class is/are
class Insurance{
	int policyNumber;
	
}

public class Bank {

	
	public static void main(String[] args) {
		
		Insurance policy = new Insurance();
		
	}

}
  1. Class object will be garbage collected when it goes out of scope from main ()
  2. In the middle of main () function, class object can also be set for garbage collection by using statement “policy = NULL;”
  3. Both A & B are true
  4. None

Answer: 3


Q) ____________ provides run time environment for java byte code to be executed
  1. JDK
  2. JRE
  3. JVM
  4. JAVAC

Answer: 3


Related Posts