Courseiva
Java I/O API and Securing ApplicationshardMultiple ChoiceObjective-mapped

1Z0-829 Java I/O API and Securing Applications Practice Question

A serialized object has an explicitly declared serialVersionUID of 123L. After a code change, a new field is added to the class but the serialVersionUID is left unchanged. What happens when deserializing an old stream?

⚠ Common exam trap

It's easy for candidates to assume any class change (like adding a field) will break deserialization, but the exam tests that a matching serialVersionUID allows the new field to be silently defaulted, not that it causes an exception.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

Deserialization succeeds and the new field is set to its default value.

When a serialized object has an unchanged serialVersionUID, the Java deserialization mechanism treats the class as compatible. The new field is not present in the old stream, so it is simply initialized to its default value (e.g., null for objects, 0 for primitives) without throwing an exception. This behavior is defined by the Java Object Serialization Specification, which allows forward compatibility as long as the serialVersionUID matches.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Deserialization succeeds and the new field is set to its default value.

    Why this is correct

    With matching serialVersionUID, deserialization maps fields; new fields get default values.

  • Deserialization succeeds only if the new field is marked transient.

    Why it's wrong here

    Transient fields are not serialized, but the new field will be default even if not transient.

  • Deserialization throws StreamCorruptedException due to missing field.

    Why it's wrong here

    StreamCorruptedException indicates corruption, not compatibility issues.

  • Deserialization throws InvalidClassException because the class definition has changed.

    Why it's wrong here

    InvalidClassException occurs only if serialVersionUID mismatches, which it does not here.

About these practice questions

One of 513 original 1Z0-829 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This 1Z0-829 practice question is part of Courseiva's free Oracle certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the 1Z0-829 exam.