Java multiple choice questions and answers on Java MCQ questions quiz on Java objectives questions.

Java MCQ Questions and Answers Quiz

1. Which of the following is TRUE?

  1. In java, an instance field declared public generates a compilation error
  2. int is the name of a class available in the package java.lang
  3. Instance variable na mes may only contain letters and digits
  4. A class has always a constructor (possibly automatically supplied by the java compiler).

2. A constructor

  1. must have the same name as the class it is declared within.
  2. is used to create objects.
  3. may be declared private
  4. A, B and C

3. Which of the following may be part of a class definition?

  1. instance variables
  2. instance methods
  3. constructors
  4. all of the above

4. What is different between a Java applet and a Java application?

  1. An application can in general be trusted whereas an applet cant
  2. An applet must be executed in a browser environment
  3. An applet is not able to access the files of the computer it runs on
  4. A, B, and C

5. What is byte code in the context of Java?

  1. The type of code generated by a Java compiler
  2. The type of code generated by a Java Virtual Machine
  3. It is another name for a Java source file
  4. It is the code written within the instance methods of a class

6. What is garbage collection in the context of Java?

  1. The operating system periodically deletes all of the java files available on the system
  2. Any package imported in a program and not used is automatically deleted.
  3. When all references to an object are gone, the memory used by the object is automatically reclaimed
  4. The JVM checks the output of any Java program and deletes anything that doesnt make sense

7. JDK stands for

  1. Java Debugging Kit
  2. Java Developers Kit
  3. None of these
  4. Java Decompilation Kit

8. JVM is a

  1. Debugger
  2. Assembler
  3. Interpreter
  4. Compiler

9. Bytecode is given as input to

  1. JRE
  2. linker
  3. JVM
  4. Assembler

10. Output of Java Compiler is

  1. Non executable code
  2. Executable code
Tags

MCQ Multiple Choice Questions and Answers on Java

Java Question and Answer