Java Programming Fundamentals

By Devin Park · Updated May 25, 2026

Questions26
Passing Score70%
Format58% Multiple Choice
Sessions Logged2,841
Your progressLog in / Register to track times taken, best score, questions mastered, and coverage on this quiz.
Rating
Community rating 4.4 out of 5 from 33 ratings.
4.4 (33)

Topics covered

This quiz

Uncategorized26 (100%)

Uncategorized26 questions

Question catalog for this preview

Catalog listing of the 5 preview questions for this quiz.

Question 1

What is the output of this Java code?

```java

public class Test {

public static void main(String[] args) {

int i = 0;

while (i < 3) {

System.out.print(i + " ");

i++;

}

}

}

```

Answer choices

  • A. 0 1 2 3

  • B. 1 2 3

  • C. 0 1 2

  • D. 0 1 2 3 (with a trailing space)

Question 2

**Statement:** In Java, the `StringBuilder` class is preferred over `String` concatenation in loops because `String` objects are immutable and each concatenation creates a new `String` object in memory.

Answer choices

  • A. True

  • B. False

Question 3

Which of the following Java statements about **checked vs. unchecked exceptions** is CORRECT?

Answer choices

  • A. Unchecked exceptions must be declared in method signatures using `throws`

  • B. Checked exceptions extend `RuntimeException` and do not require explicit handling

  • C. Checked exceptions must be caught or declared with `throws`; unchecked exceptions (RuntimeException subclasses) do not

  • D. All exceptions in Java are checked by default unless annotated with @Unchecked

Question 4

In Java, a class that cannot be instantiated directly and may contain both abstract methods and concrete methods is called an [[blank1]] class.

Question 5

In Java, what does the `volatile` keyword guarantee when applied to a variable?

Answer choices

  • A. Only one thread can access the variable at a time (mutual exclusion)

  • B. The variable is stored only in CPU cache for faster access

  • C. All threads always read the most recently written value from main memory, ensuring visibility

  • D. The variable cannot be modified after initialization