Java Introduction Quiz

Welcome to the Introduction to Java Quiz collection! This quiz set contains 30 multiple-choice questions based on Java introductory topics such as:

  • Features of Java
  • History of Java
  • JVM, JRE, and JDK
  • Java program structure
  • Compilation and execution process
  • Object-Oriented Programming basics
  • Platform independence
  • Java keywords and syntax basics

This quiz is designed for beginners as well as students preparing for exams, interviews, and coding tests. Each question includes four multiple-choice options, the correct answer, and an explanation to help you understand the concept clearly.

Whether you are a school or college student or a coding beginner, this quiz will help you test your basic Java knowledge and improve your understanding step by step. The explanations provided after each answer make learning simple, interactive, and effective. There is no time limit. At the end of the quiz, you will get the scorecard, which will show the performance in the quiz.

Let’s start the quiz and check how well you know the basics of Java programming!

Who developed Java programming language?
A. Bill Gates
B. James Gosling
C. Dennis Ritchie
D. Guido van Rossum
James Gosling
Java was developed by James Gosling at Sun Microsystems. It was introduced in 1995.
What was Java originally called?
A. Oak
B. Sun Java
C. Coffee
D. JavaScript
Oak
Java was originally called Oak, named after an oak tree outside James Gosling’s office at Sun Microsystems. It was later renamed Java due to trademark issues.
Which company currently owns the Java platform and technologies?
A. Microsoft
B. Google
C. Oracle
D. IBM
Oracle
Java was originally developed by Sun Microsystems in 1995. In 2010, Oracle Corporation acquired Sun Microsystems and now owns the Java platform.
Which Java feature enables the same compiled program to run on different operating systems without modification?
A. Multithreading
B. Object-Oriented Programming
C. Platform Independence
D. Dynamic Binding
Platform Independence
Java source code is compiled into bytecode. The JVM converts bytecode into machine-specific instructions. This supports Write Once, Run Anywhere (WORA).
Which of the following feature makes Java secure?
A. Pointer usage
B. Automatic memory allocation
C. No pointers
D. Manual memory management
No pointers
Java avoids direct memory access by not using explicit pointers. This improves security and reduces the risk of memory corruption.
Java supports which of the following programming concept?
A. Procedural only
B. Object-Oriented Programming
C. Functional only
D. Assembly programming
Object-Oriented Programming
Java uses classes and objects. It also supports inheritance, polymorphism, encapsulation, and abstraction.
Which extension is used for Java source files?
A. .class
B. .java
C. .exe
D. .txt
.java
Java source code files use the .java extension.
Which extension is used for bytecode files?
A. .java
B. .exe
C. .class
D. .doc
.class
Compiled Java code becomes bytecode and is stored in .class files, which are executed by the JVM.
Which of the following command is used to compile Java code?
A. java
B. javac
C. compile
D. run
javac
javac is the Java compiler command. It converts Java source code (.java files) into bytecode (.class files).
Which command is used to run Java program?
A. execute
B. javac
C. java
D. runjava
java
The java command is used to run compiled bytecode through the Java Virtual Machine.
JDK stands for:
A. Java Development Kit
B. Java Deployment Kit
C. Java Design Kit
D. Java Debug Kit
Java Development Kit
JDK includes all tools required for Java development such as the compiler and standard libraries.
JRE stands for:
A. Java Runtime Environment
B. Java Run Engine
C. Java Runtime Editor
D. Java Ready Environment
Java Runtime Environment
JRE provides the runtime environment needed to run Java applications, including the JVM and core libraries.
JVM stands for:
A. Java Virtual Machine
B. Java Visual Machine
C. Java Variable Method
D. Java Verified Machine
Java Virtual Machine
JVM (Java Virtual Machine) executes Java bytecode, enabling Java’s platform independence.
Which of the following is responsible for generating bytecode in Java?
A. JVM
B. JRE
C. Java Compiler
D. Interpreter
Java Compiler
The Java compiler (javac) converts Java source code (.java file) into bytecode (.class file), which is then executed by the Java Virtual Machine.
Which of the following Java components is responsible for interpreting bytecode?
A. JDK
B. JRE
C. JVM
D. Java Compiler
JVM
The Java Virtual Machine interprets and executes Java bytecode, making Java platform-independent.
Java is known as a robust programming language. What does ‘robust’ mean?
A. It only works on Windows.
B. It is weak and slow.
C. It is secure, reliable, and handles errors effectively.
D. It cannot manage memory.
It is secure, reliable, and handles errors effectively.
Java is called robust because it has strong memory management, exception handling, type checking, and security features that make programs reliable.
Which package is automatically imported in every Java program?
A. java.util
B. java.io
C. java.lang
D. java.net
java.lang
The java.lang package is automatically imported by default in every Java program, so you don’t need to import it manually. It includes fundamental classes like String, Math, and Object.
Which method is the entry point of a Java program?
A. start()
B. run()
C. main()
D. execute()
main()
Java program execution starts from the public static void main(String[] args) method. This is the entry point that the JVM looks for when running a Java program.
Java follows which principle to achieve platform independence?
A. Write Once, Run Anywhere
B. Compile Once, Run Once
C. Write Everywhere, Run Once
D. Code Once, Debug Everywhere
Write Once, Run Anywhere
Java follows the Write Once, Run Anywhere (WORA) principle because Java bytecode can run on any system that has a Java Virtual Machine installed.
Which keyword is used to create objects of a class in Java?
A. class
B. this
C. new
D. object
new
In Java, the new keyword is used to create an object (instance) of a class. For example: MyClass obj = new MyClass();
Which of the following IDEs is commonly used for Java development?
A. Eclipse IDE
B. Adobe Photoshop
C. Microsoft Excel
D. Notepad
Eclipse IDE
Eclipse is a popular IDE for Java development. Other commonly used Java IDEs include IntelliJ IDEA and Apache NetBeans.
Which memory area stores objects in Java?
A. Stack Memory
B. Heap Memory
C. Register Memory
D. Cache Memory
Heap Memory
In Java, objects are stored in Heap Memory, while local variables and method calls are stored in Stack Memory.
Which component of Java is platform-dependent?
A. Java source code
B. Bytecode
C. JVM
D. Java program
JVM
Java bytecode is platform-independent, but the Java Virtual Machine is platform-dependent because each operating system needs its own JVM implementation.
Which command creates bytecode in Java?
A. java filename
B. javac filename.java
C. compile filename
D. run filename
javac filename.java
The javac filename.java command uses the Java compiler to compile Java source code (.java file) into bytecode, which is stored in a .class file.
Which command executes bytecode in Java?
A. javac filename.java
B. java filename.java
C. java filename
D. compile filename
java filename
The java filename command runs the compiled bytecode through the Java Virtual Machine. You use only the class name without the .class extension.
Which tool checks Java syntax errors during compilation?
A. JVM
B. Interpreter
C. javac
D. Browser
javac
The Java compiler (javac) checks Java source code for syntax errors during compilation. If the code is correct, it converts the .java file into bytecode. If there are syntax errors, compilation fails and error messages are shown.
What will happen if the main() method is missing in a Java program?
A. Program runs normally
B. Compilation error
C. Runtime error stating main() method not found
D. JVM automatically creates main()
Runtime error stating main() method not found
If the Java code is syntactically correct, the compiler can still compile it. However, when the JVM tries to run it, it looks for public static void main(String[] args). If it is missing, a runtime error occurs: “Error: Main method not found in class…”
Which feature of Java eliminates explicit memory deallocation by programmers?
A. Encapsulation
B. Inheritance
C. Garbage Collection
D. Polymorphism
Garbage Collection
Java automatically removes unused objects from memory through Garbage Collection, reducing memory leaks and eliminating the need for manual memory deallocation.
Which of the following best explains Java’s robustness?
A. It only works on one operating system
B. It has strong memory management, exception handling, and type checking
C. It does not support object-oriented programming
D. It cannot detect errors
It has strong memory management, exception handling, and type checking
Java is considered robust because features like automatic garbage collection, exception handling, and strong type checking help make programs reliable and less prone to crashes.
Which feature allows Java programs to load classes during execution?
A. Static typing
B. Dynamic class loading
C. Inheritance
D. Compilation
Dynamic class loading
The JVM supports dynamic class loading, which allows classes to be loaded into memory at runtime when needed, rather than loading all classes at the beginning. This improves flexibility and efficiency.

DEEPAK GUPTA

DEEPAK GUPTA

Deepak Gupta is the Founder of Scientech Easy, a Full Stack Developer, and a passionate coding educator with 8+ years of professional experience in Java, Python, web development, and core computer science subjects. With strong expertise in full-stack development, he provides hands-on training in programming languages and in-demand technologies at the Scientech Easy Institute, Dhanbad.

He regularly publishes in-depth tutorials, practical coding examples, and high-quality learning resources for both beginners and working professionals. Every article is carefully researched, technically reviewed, and regularly updated to ensure accuracy, clarity, and real-world relevance, helping learners build job-ready skills with confidence.