Question 2 of 509
Object-Oriented ProgrammingeasyMultiple ChoiceObjective-mapped

Quick Answer

The correct answer is that the variable 'value' is not declared. This is because Java requires every variable to be explicitly declared with a type and name before it can be used; when the compiler encounters a reference to 'value' without a prior declaration in the current scope, it cannot resolve the symbol and throws a "cannot find symbol" error. On the Oracle Java Foundations 1Z0-811 exam, this error frequently appears in code snippets where a variable is used but never declared, testing your understanding of Java’s strict compile-time checking. A common trap is assuming a variable exists because it appears in a nearby line, but the compiler only sees what is formally declared. Remember the mnemonic: "Declare before you dare" — every variable must be introduced with a type and name before it can be referenced.

1Z0-811 Object-Oriented Programming Practice Question

This 1Z0-811 practice question tests your understanding of object-oriented programming. The scenario asks you to isolate a root cause — eliminate options that address a different problem before choosing. After answering, compare your reasoning against the explanation and wrong-answer breakdown below. Once you have made your selection, read the full explanation to reinforce the concept and understand why each distractor is designed to mislead on exam day.

Exhibit

javac Test.java
Test.java:5: error: cannot find symbol
    System.out.println(value);
                        ^
  symbol:   variable value
  location: class Test

Refer to the exhibit.

What is the likely cause?

Question 1easymultiple choice
Full question →

Exhibit

javac Test.java
Test.java:5: error: cannot find symbol
    System.out.println(value);
                        ^
  symbol:   variable value
  location: class Test

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

The variable 'value' is not declared

Option B is correct because the error message indicates that the variable 'value' has not been declared before use. In Java, every variable must be declared with a type and name before it can be referenced. The compiler cannot find a declaration for 'value' in the current scope, so it reports a 'cannot find symbol' error, which is the typical symptom of an undeclared variable.

Key principle: Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

Answer analysis

Option-by-option breakdown

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

  • The package is missing

    Why it's wrong here

    A missing package would cause a different error, not 'cannot find symbol'.

  • The variable 'value' is not declared

    Why this is correct

    The error indicates that the symbol 'value' cannot be found, meaning it is not declared in the class.

    Related concept

    Read the scenario before looking for a memorised answer.

  • The class name is misspelled

    Why it's wrong here

    A misspelled class name would cause a different error.

  • The variable 'value' is out of scope

    Why it's wrong here

    A scope issue would typically produce a different error, but if not declared, it's not a scope issue.

  • The variable 'value' is declared but not initialized

    Why it's wrong here

    An uninitialized variable would cause a 'variable might not have been initialized' error, not 'cannot find symbol'.

Common exam traps

Common exam trap: answer the scenario, not the keyword

Oracle often tests the difference between 'undeclared', 'out of scope', and 'uninitialized' by presenting an error message that could be interpreted in multiple ways, and the trap is that candidates confuse 'undeclared' with 'out of scope' because both produce a 'cannot find symbol' error, but only the former means the variable was never declared at all.

Detailed technical explanation

How to think about this question

In Java, variable declaration is a compile-time contract: the compiler builds a symbol table from all declarations in the current scope. If a variable name is used without a prior declaration, the compiler cannot resolve it to any symbol, resulting in a 'cannot find symbol' error. This is distinct from scope issues, where the variable is declared but not accessible from the current block, or initialization issues, where the variable exists but has no assigned value. Understanding this distinction is crucial for debugging compilation errors in real-world Java development, especially when refactoring code or working with nested scopes.

KKey Concepts to Remember

  • Read the scenario before looking for a memorised answer.
  • Find the constraint that changes the correct option.
  • Eliminate answers that are true in general but not in this case.

TExam Day Tips

  • Watch for words such as best, first, most likely and least administrative effort.
  • Review why wrong options are wrong, not only why the correct option is correct.

Key takeaway

Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

Real-world example

How this comes up in practice

A practitioner preparing for the 1Z0-811 exam encounters this exact type of scenario on the job. The correct answer here is not the most general option — it is the best answer for the specific constraint described. Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option. Real exam questions reward reading the full scenario before eliminating options, because the constraint defines which answer fits.

What to study next

Got this wrong? Here's your next step.

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

Related practice questions

Related 1Z0-811 practice-question pages

Use these pages to review the topic behind this question. This is how one missed question becomes focused revision.

Practice this exam

Start a free 1Z0-811 practice session

Short sessions build daily habit. Longer sessions build exam-day stamina. Try a timed session to simulate real conditions.

FAQ

Questions learners often ask

What does this 1Z0-811 question test?

Object-Oriented Programming — This question tests Object-Oriented Programming — Read the scenario before looking for a memorised answer..

What is the correct answer to this question?

The correct answer is: The variable 'value' is not declared — Option B is correct because the error message indicates that the variable 'value' has not been declared before use. In Java, every variable must be declared with a type and name before it can be referenced. The compiler cannot find a declaration for 'value' in the current scope, so it reports a 'cannot find symbol' error, which is the typical symptom of an undeclared variable.

What should I do if I get this 1Z0-811 question wrong?

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

What is the key concept behind this question?

Read the scenario before looking for a memorised answer.

About these practice questions

Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Last reviewed: Jun 30, 2026

Question Discussion

Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.

Loading comments…

Sign in to join the discussion.

This 1Z0-811 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-811 exam.