PRACTICE • LEARN • GROW
Module 1: Introduction to Java - Final Quiz MCQs
Solve topic-wise placement questions and improve your skills.
Module 1: Introduction to Java - Final Quiz Progress
0 of 11 completed
0%
Topic Track
You are viewing MCQs in preview mode. Log in to select options, submit answers, and track your progress.
Log In to Answer
1
Who originally created the Java programming language at Sun Microsystems in 1995, and what was its original design target?
A.
Dennis Ritchie for the UNIX operating system
B.
James Gosling and his team for interactive television and embedded consumer devices
C.
Bjarne Stroustrup for high-performance graphics engines
D.
Guido van Rossum for scientific scripting
Explanation & Key
Correct Answer:
2
What is the core technical mechanism that makes Java's "Write Once, Run Anywhere" (WORA) possible?
A.
Java compiles directly to universal x86 CPU machine code
B.
The javac compiler outputs platform-independent bytecode (.class), which is executed by an OS-specific Java Virtual Machine (JVM)
C.
Java programs are interpreted directly from .java text files by the operating system kernel
D.
Java bundles a complete Linux emulation layer inside every application
Explanation & Key
Correct Answer:
3
Which component relationship accurately describes the layering of Java's runtime and development tools?
A.
JVM contains JRE, and JRE contains JDK
B.
JDK contains JRE, which bundles the JVM and core class libraries
C.
JRE contains JDK, which executes bytecode on the physical machine
D.
JVM, JRE, and JDK are three independent, non-overlapping tools
Explanation & Key
Correct Answer:
4
Why must the main method in Java be declared with the static keyword?
public class Hello {
public static void main(String[] args) {
System.out.println("Hello");
}
}
A.
To allow the method to return multiple values to the operating system
B.
So the JVM can invoke the entry point directly on the class without having to instantiate an object of that class first
C.
To prevent other threads from accessing the method concurrently
D.
Because non-static methods cannot print to System.out
Explanation & Key
Correct Answer:
5
If a public class is named
PaymentGateway, what must its source file be named?
A.
PaymentGateway.class
B.
paymentgateway.java
C.
PaymentGateway.java
D.
Any valid filename ending with .java
Explanation & Key
Correct Answer:
6
What is the function of the Just-In-Time (JIT) compiler inside the modern JVM?
A.
It converts .java source code into .class bytecode files during development
B.
It translates frequently executed ('hot') bytecode paths into native machine instructions at runtime for near-native execution speed
C.
It automatically formats code according to style guides before running
D.
It decompiles binary class files back to source code for debugging
Explanation & Key
Correct Answer:
7
Which of the following is NOT one of the core architectural features that makes Java robust and secure?
A.
Strong compile-time type checking
B.
Automatic memory management via garbage collection
C.
Unrestricted raw pointer arithmetic and direct memory manipulation
D.
Sandboxed bytecode execution within the JVM without direct hardware access
Explanation & Key
Correct Answer:
8
What will happen when attempting to compile and run this code?
public class Test {
public void main(String[] args) {
System.out.println("ReadyToGo");
}
}
A.
It prints 'ReadyToGo' without issues
B.
It compiles without errors, but throws a NoSuchMethodError / runtime error stating the main method is not static
C.
Compile-time error: main method must be static
D.
It prints null
Explanation & Key
Correct Answer:
9
What will happen if the main method arguments are declared with variable-length argument syntax (varargs)?
public class App {
public static void main(String... args) {
System.out.println("Varargs Main: " + args.length);
}
}
A.
Compile-time error: main method must accept String[] args exactly
B.
It compiles and executes successfully as a valid application entry point, printing 'Varargs Main: 0'
C.
Runtime error: main method not found
D.
It compiles but requires at least one command line argument to run
Explanation & Key
Correct Answer:
10
Which ClassLoader in the Java Virtual Machine is responsible for loading the core Java runtime classes (such as
java.lang.Object and java.lang.String) from the JDK runtime?
A.
Application ClassLoader (System ClassLoader)
B.
Extension ClassLoader (Platform ClassLoader)
C.
Bootstrap ClassLoader (Primordial ClassLoader)
D.
Thread Context ClassLoader
Explanation & Key
Correct Answer:
11
What is the rule in Java regarding the number of classes declared in a single source code file and the
public access modifier?
A.
A file can contain as many public classes as desired as long as their names differ
B.
A file can contain multiple classes, but at most ONE class can be declared public, and that class name must match the .java filename
C.
Every class inside a .java file must be public
D.
A .java file cannot contain more than one class under any circumstances
Explanation & Key
Correct Answer:
Question Palette
Answered
Current
Not Attempted
Wrong