- Home
- Java Programming MCQ
- Introduction to Java
- Beginners
- Introduction to Java - Set 1
- Introduction to Java - Set 2
- Introduction to Java - Set 3
- Introduction to Java - Set 4
- Introduction to Java - Set 5
- Introduction to Java - Set 6
- Introduction to Java - Set 7
- Introduction to Java - Set 8
- Introduction to Java - Set 9
- Introduction to Java - Set 10
- Introduction to Java - Set 11
- Introduction to Java - Set 12
- Introduction to Java - Set 13
- Introduction to Java - Set 14
- Introduction to Java - Set 15
- Introduction to Java - Set 16
- Introduction to Java - Set 17
- Introduction to Java - Set 18
- Introduction to Java - Set 19
- Introduction to Java - Set 20
- Introduction to Java - Set 21
- Introduction to Java - Set 22
- Introduction to Java - Set 23
- Introduction to Java - Set 24
- Introduction to Java - Set 25
- Introduction to Java - Set 26
- Introduction to Java - Set 27
- Introduction to Java - Set 28
- Introduction to Java - Set 29
- Introduction to Java - Set 30
- Introduction to Java - Set 31
- Introduction to Java - Set 32
- Introduction to Java - Set 33
- Intermediate
- Introduction to Java - Set 34
- Introduction to Java - Set 35
- Introduction to Java - Set 36
- Introduction to Java - Set 37
- Introduction to Java - Set 38
- Introduction to Java - Set 39
- Introduction to Java - Set 40
- Introduction to Java - Set 41
- Introduction to Java - Set 42
- Introduction to Java - Set 43
- Introduction to Java - Set 44
- Introduction to Java - Set 45
- Advanced Level
- Introduction to Java - Set 46
- Introduction to Java - Set 47
- Introduction to Java - Set 48
- Introduction to Java - Set 49
- Introduction to Java - Set 50
- Introduction to Java - Set 51
- Introduction to Java - Set 52
- Introduction to Java - Set 53
- Introduction to Java - Set 54
- Introduction to Java - Set 55
- Data Types & Variables
- Operators in Java
- Control Statements
- Arrays
- Strings
- Object-Oriented Programming (OOP)
- Interfaces & Abstract Classes
- Exception Handling
- Multithreading
- Collections Framework
- File Handling
- JDBC (Database Connectivity)
- Java MCQ - Loops, Decisions and Mathematical functions
- Loops, Decisions and Mathematical functions MCQ
- Loops, Decisions and Mathematical functions MCQ - Set 1
- Loops, Decisions and Mathematical functions MCQ - Set 2
- Loops, Decisions and Mathematical functions MCQ - Set 3
- Loops, Decisions and Mathematical functions MCQ - Set 4
- Loops, Decisions and Mathematical functions MCQ - Set 5
- Loops, Decisions and Mathematical functions MCQ - Set 6
- Loops, Decisions and Mathematical functions MCQ - Set 7
- Loops, Decisions and Mathematical functions MCQ - Set 8
- Java MCQ - Methods and Arrays
- Methods and Arrays MCQ
- Methods and Arrays MCQ - Set 1
- Methods and Arrays MCQ - Set 2
- Methods and Arrays MCQ - Set 3
- Methods and Arrays MCQ - Set 4
- Methods and Arrays MCQ - Set 5
- Methods and Arrays MCQ - Set 6
- Methods and Arrays MCQ - Set 7
- Methods and Arrays MCQ - Set 8
- Methods and Arrays MCQ - Set 9
- Java MCQ - Objects and Classes
- Objects and Classes MCQ
- Objects and Classes MCQ - Set 1
- Objects and Classes MCQ - Set 2
- Objects and Classes MCQ - Set 3
- Objects and Classes MCQ - Set 4
- Objects and Classes MCQ - Set 5
- Objects and Classes MCQ - Set 6
- Objects and Classes MCQ - Set 7
- Java MCQ - Objects Oriented Programming
- Java MCQ - Exception Handling, I/O, Abstract classes and Interfaces
- Java MCQ - JAVAFX basics and Event-driven programming and animations
- Java MCQ - JAVAFX UI controls and multimedia
- Java MCQ - Binary I/O ,Recursion and Generics
- Java MCQ - List, Stacks, Queues and Priority Queues
- Java MCQ - Sets and Maps
- Java MCQ - Concurrency
============================================================================
Java Programming Multiple Choice Questions (MCQ)
Introduction to Java - Multiple Choice Questions (MCQ) - Set 5
![]() Share with a Friend |
Multiple Choice Questions
Java - Introduction to Java - Multiple Choice Questions (MCQ) - Set 5
21. What does JVM stand for?A). Java Variable Machine
B). Java Virtual Machine
C). Java Verified Machine
D). Java Visual Machine
View Answer
Explanation
Answer: B. Java Virtual Machine
✔ Correct Explanation:
JVM (Java Virtual Machine) is a runtime engine that executes Java bytecode. It provides platform independence by acting as an intermediary between compiled Java code and the operating system, allowing “write once, run anywhere.”
❌ Incorrect Options:
- A. Java Variable Machine
This is a misleading term. JVM does not specifically manage variables; it handles execution, memory management, and runtime environment. - C. Java Verified Machine
JVM does perform bytecode verification for security, but that is just one function—not its definition. - D. Java Visual Machine
No such concept exists in Java. “Visual” relates to GUI, not runtime execution.
22. What is Java mainly known as?
A). Procedural language
B). Object-Oriented language
C). Assembly language
D). Machine language
Explanation
Java is mainly known as an Object-Oriented language.
The correct answer is B). Object-Oriented language.
Why Java is Object-Oriented
Java is a high-level, class-based language designed to have as few implementation dependencies as possible. Key characteristics that define it as an object-oriented programming (OOP) language include:
Classes and Objects: As noted by Oracle, Java organizes software as a combination of different types of objects that incorporate both data and behavior.
Core Pillars: It follows the four fundamental principles of OOP: Encapsulation, Inheritance, Polymorphism, and Abstraction.
Modular Code: This approach allows developers to create modular and reusable code, making large-scale software development more manageable.
Analysis of Other Options
A). Procedural language: Unlike procedural languages (such as C or Pascal), which focus on sequences of actions or functions, Java focuses on objects and data.
C). Assembly language: This is a low-level language specific to a particular computer architecture. Java is a high-level language that is platform-independent.
D). Machine language: This consists of binary code (0s and 1s) directly executed by a computer's CPU. Java code is compiled into bytecode, which is then interpreted or compiled by the Java Virtual Machine (JVM).
23. Which company originally developed Java?
A). Microsoft
B). Apple
C). Sun Microsystems
D). IBM
View Answer
Explanation
The Java programming language was originally developed by Sun Microsystems.
- Key Developer:James Gosling, often referred to as the "father of Java," led the team (known as the "Green Team") that created the language starting in 1991.
- Initial Name:It was initially called "Oak" before being renamed to Java in 1995.\
- Release:Sun Microsystems officially released Java in 1995.
- Acquisition:Oracle Corporation acquired Sun Microsystems in 2010, taking over the management of Java.
Therefore, the correct answer is C). Sun Microsystems.
24. Java source code is written in files with extension:
A). .class
B). .java
C). .exe
D). .txt
Explanation
The correct answer is B). .java.
In Java development, the different file extensions represent various stages of the code lifecycle:
- .java: This is the extension for source code These are human-readable text files where programmers write their instructions (e.g., HelloWorld.java).
- .class: This extension is for compiled bytecode. When you use a compiler like javac, it converts the .javasource file into a .class file that the Java Virtual Machine (JVM) can execute.
- .exe: This is a standard extension for executable fileson Windows. While Java programs can be wrapped into an .exe, they are natively distributed as .jar files or run through the java.exe
- .txt: This is a generic plain text While Java source code is technically plain text, the compiler specifically requires the .javaextension to recognize and process the code correctly.
25. Which tool compiles Java source code?
A). java
B). javac
C). jvm
D). jre
View Answer
Explanation
The tool that compiles Java source code is javac.
- javac(Java Compiler): This is the primary tool used to read class and interface definitions written in the Java programming language and compile them into bytecode class files (e.g., Oracle Docs). It is an essential component of the Java Development Kit (JDK).
- java: This tool is the launcher for Java applications. It is used to execute the compiled bytecode by starting a Java Virtual Machine (JVM).
- jvm(Java Virtual Machine): This is the engine that provides the runtime environment for executing Java bytecode. It does not compile source code but rather translates the compiled bytecode into machine-specific instructions at runtime
- jre(Java Runtime Environment): This is a software package that provides the libraries and the JVM required to run Java applications. It does not include development tools like the compiler (IBM).
The correct answer is B). javac.
