IT Certifications · 1Z0-811

Oracle Java Foundations (also available in CHS for Taiwan) Exam Practice Test

Oracle Java Foundations (1Z0-811) practice focuses on core Java syntax and code behavior. The available questions sample fundamentals such as String operations, variable declarations, methods, imports, constants, and exception handling. They ask you to interpret short code fragments and distinguish how Java constructs affect values, control flow, and class-level behavior.

Exam overview

Exam providerOracle
Exam code1Z0-811
CategoryIT Certifications

About the Oracle Java Foundations (also available in CHS for Taiwan) Exam

Foundational Java programming requires tracing how declarations and expressions establish and change program state. Practice recognizing method signatures, parameter types, return values, and the role of `return`; distinguish local variables from constants declared with `final`; and identify how `static` members relate to a class. String questions exercise method selection and text checks, while import questions test package and class naming. Exception-handling items focus on control flow, including when cleanup code runs. These skills support reading small Java programs, catching type or syntax misunderstandings, and explaining what a statement does before applying it in code. The available practice bank reflects these areas, but its topics are question-bank signals rather than a confirmed outline of exam coverage.

Sample Practice Questions

Review a selection from this exam's published US Practice Tests practice bank.

Question 1

What is the value of `length` after this code runs? `String word = "code"; int length = word.length();`

  1. A3
  2. B4
  3. C5
  4. DThe code does not compile because strings have no length method
Show answerCorrect answer: B

The `String.length()` method returns the number of UTF-16 code units in the string. The word `code` has four characters, so the returned length is 4.

Question 2

Which expression checks whether the String variable name contains the text "Ada"?

  1. Aname == "Ada"
  2. Bname.equals("Ada")
  3. Cname = "Ada"
  4. Dname.compare("Ada")
Show answerCorrect answer: B

For String content comparison, use equals. The == operator compares object references, and = performs assignment.

Question 3

Which statement about a Java `final` local variable is correct?

  1. AIt cannot be assigned a value at any point
  2. BIt can be assigned once, after which it cannot be reassigned
  3. CIt is automatically shared by all objects of its class
  4. DIt must always contain a reference to an object
Show answerCorrect answer: B

A `final` local variable may be assigned once, either when declared or later before it is used. After assignment, it cannot be reassigned.

Question 4

Which statement correctly imports the ArrayList class from Java's collections package?

  1. Aimport java.util.ArrayList;
  2. Binclude java.util.ArrayList;
  3. Cusing java.util.ArrayList;
  4. Dpackage java.util.ArrayList;
Show answerCorrect answer: A

Java uses an import declaration with the fully qualified class name to make a class available by its simple name.

Question 5

Which method header declares a method named `multiply` that accepts two `int` parameters and returns an `int`?

  1. A`int multiply(int a, int b)`
  2. B`void multiply(int a, int b)`
  3. C`int multiply()`
  4. D`multiply(int a, int b) : int`
Show answerCorrect answer: A

A Java method header gives the return type before the method name, then lists parameter types and names in parentheses. This header returns an `int` and accepts two `int` parameters.

Question 6

Which declaration creates a constant named `MAX_USERS` with the value 50?

  1. A`final int MAX_USERS = 50;`
  2. B`constant int MAX_USERS = 50;`
  3. C`int final = MAX_USERS 50;`
  4. D`static MAX_USERS int = 50;`
Show answerCorrect answer: A

The `final` modifier prevents a variable from being assigned again after initialization. Java does not use a `constant` keyword for this purpose.

Question 7

Which exception-handling block is used to run cleanup code whether or not an exception occurs?

  1. Acatch
  2. Bfinally
  3. Cthrow
  4. Dthrows
Show answerCorrect answer: B

A finally block is intended for cleanup that should run after the try/catch processing, whether an exception occurred or not.

How to use this practice test

Access is free. Each practice session presents up to 20 random questions from the available 50-question bank, then shows your results. Use the session to test code-reading accuracy: trace each declaration or method call, choose an answer, and review which Java concept led to any missed response.

Preparation tips

  • Trace String expressions such as `length()` and `contains()` by identifying the receiver object, argument, and returned value.
  • Write method headers with parameter types and return types, then verify that each non-`void` path returns a compatible value.
  • Compare local variables and `final` declarations; check where reassignment is permitted and how a named constant is initialized.
  • Practice reading `try`/`finally` flow and identify which cleanup statements run when an exception is thrown or not thrown.
  • For parameter questions, distinguish Java's pass-by-value behavior from changes to the caller's variable, and identify how `static` members are accessed through a class.
Official sourceOfficial exam page ↗