Objective Assessment
(Full Version Exam)
Introduction to Programming in Java
Western Governors University
This document provides a focused
OA
• This Exam is structured to help students
reinforce understanding, identify weak
areas, and prepare confidently for the
assessment.
• you can review quickly and walk into exam
confident and prepared.
,PREVIEW PAGES BELOW
Get the Complete PDF
After Purchase
"If you require further clarification or in need of
any study resources, feel free to Message me."
,Question 1: Which Java component is responsible for actually executing compiled
bytecode on a specific machine?
A. Java Development Kit (JDK)
B. Java Runtime Environment (JRE)
C. Java Virtual Machine (JVM)
D. Java Application Programming Interface (API)
Correct Answer: C. Java Virtual Machine (JVM)
Expert Rationale: The JVM is the part of the Java platform that interprets and executes
the bytecode instructions produced by the compiler on a particular device.
Question 2: Which statement best describes the relationship between the JDK and the
JRE?
A. The JRE includes the JDK so programs can be compiled and run.
B. The JDK includes the JRE so programs can be compiled and run.
C. The JVM includes both the JDK and the JRE.
D. The JDK and JRE are unrelated and installed separately by design.
Correct Answer: B. The JDK includes the JRE so programs can be compiled and run.
Expert Rationale: The JDK is the full development kit that contains tools such as the
compiler and also bundles the JRE so compiled programs can be executed.
Question 3: In a Java IDE, which action most directly checks for syntax errors and
translates source code to bytecode?
A. Running the program
B. Debugging the program
C. Compiling the program
D. Formatting the program
Correct Answer: C. Compiling the program
Expert Rationale: The compile step parses the Java source, flags compile-time
syntax/type errors, and generates bytecode if the code is valid.
, Question 4: A student writes int x = ; and tries to run the program. The code
compiles without error. What will happen at runtime?
A. The program prints 0.
B. The program throws an arithmetic exception.
C. The program exits normally with no output.
D. The program enters an infinite loop.
Correct Answer: B. The program throws an arithmetic exception.
Expert Rationale: Integer division by zero is not detected at compile time; at runtime the
JVM throws an ArithmeticException, which is a runtime error.
Question 5: Which statement about compile-time errors in Java is true?
A. They occur only while the JVM executes bytecode.
B. They are usually caused by incorrect logic.
C. They prevent the compiler from producing a .class file.
D. They always cause the program to crash after some output.
Correct Answer: C. They prevent the compiler from producing a .class file.
Expert Rationale: Compile-time errors such as syntax mistakes or type mismatches stop
compilation, so no bytecode is generated until they are fixed.
Question 6: Which of the following is a valid Java variable declaration and initialization
for an immutable value?
A. final int DAYS_IN_WEEK = 7;
B. constant int DAYS_IN_WEEK = 7;
C. static DAYS_IN_WEEK = 7;
D. immutable int DAYS_IN_WEEK = 7;
Correct Answer: A. final int DAYS_IN_WEEK = 7;
Expert Rationale: The final keyword marks a variable so its value cannot be changed
once initialized, matching the concept of an unchangeable constant.
Question 7: Which of these is a primitive data type in Java?
A. String