C Programming Multiple Choice Questions (MCQ) | IT Developer <?php echo $page_title; ?>
IT Developer

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
Correct: B

 


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
View Answer
Correct: B

 



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
Correct: C

 


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
View Answer
Correct: B

 



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
Correct: B

 


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