1Z0-811 · topic practice

Java Basics and Syntax practice questions

Practise Oracle Java Foundations 1Z0-811 Java Basics and Syntax practice questions — original exam-style scenarios with answer choices, explanations, and analysis of common mistakes.

Courseiva uses original exam-style practice questions designed for learning and revision. The goal is to understand the concepts, recognise exam patterns, and improve through explanations — not memorise copied exam dumps.

Reviewed byJohnson Ajibi· MSc IT Security
19 questionsDomain: Java Basics and Syntax

What the exam tests

What to know about Java Basics and Syntax

Java Basics and Syntax questions test whether you can apply the concept in context, not just recognise a definition.

How the topic appears in realistic exam-style scenarios.

Which detail in the question changes the correct answer.

How to eliminate plausible but wrong options.

How to connect the question back to the wider exam objective.

Watch out for

Common Java Basics and Syntax exam traps

  • Answering from memory before reading the full scenario.
  • Missing a constraint such as cost, availability, security, scope or command context.
  • Choosing a broad answer when the question asks for the most specific fix.
  • Ignoring why the wrong options are tempting.

Practice set

Java Basics and Syntax questions

19 questions · select your answer, then reveal the explanation

A developer writes the following code: int x = 5; System.out.println(x++); What is the output?

A team decides to use a single Java source file for a small application. Which statement is true about the file structure?

Given the code: String s1 = "Java"; String s2 = new String("Java"); if (s1 == s2) { System.out.print("Equal"); } else { System.out.print("Not Equal"); } What is the output?

Which primitive data type should be used to store a single character?

A method is declared as: public static void main(String[] args) { }. Which statement is true?

Which code snippet correctly creates a two-dimensional array with 3 rows and 4 columns?

What is the value of the expression (10 > 5) && (3 < 2)?

Which loop construct guarantees that the body executes at least once?

Given the code: int[] arr = {1,2,3}; for(int x : arr) { if(x==2) continue; System.out.print(x); } What is the output?

Which access modifier makes a member visible only within its own class?

What is the result of the expression 10 % 3?

Which TWO are valid identifiers in Java? (Choose two.)

Which THREE are valid ways to declare and initialize an integer variable in Java? (Choose three.)

Which TWO keywords are used for decision-making in Java? (Choose two.)

Which THREE statements about the main method are correct? (Choose three.)

What is the output of this program?

Exhibit

Refer to the exhibit.
public class Test {
    public static void main(String[] args) {
        int a = 10;
        int b = 20;
        System.out.println(a + b);
        System.out.println("Sum: " + a + b);
    }
}

What is the value printed?

Exhibit

Refer to the exhibit.
public class LoopTest {
    public static void main(String[] args) {
        int count = 0;
        for (int i = 0; i < 5; i++) {
            if (i % 2 == 0) {
                continue;
            }
            count++;
        }
        System.out.println(count);
    }
}

You are developing a Java application for a library management system. The system must track the number of books in each genre. You need to store genre names (String) and their counts (int). The data will be accessed frequently and modified rarely. Which Java data structure should you use to store this mapping efficiently, while ensuring that genre names are unique?

You are writing a program that processes a list of transactions. Each transaction has a timestamp (long), amount (double), and type (String). The program needs to iterate through the transactions in the order they were added. Which collection should you use to maintain insertion order and allow fast iteration?

Free account

Track your progress over time

Create a free account to save your results and see which topics improve across sessions.

Focused Java Basics and Syntax sessions

Start a Java Basics and Syntax only practice session

Every question in these sessions is drawn from the Java Basics and Syntax domain — nothing else.

Related practice questions

Related 1Z0-811 topic practice pages

Move into related areas when this topic feels solid.

Frequently asked questions

What does the 1Z0-811 exam test about Java Basics and Syntax?
Java Basics and Syntax questions test whether you can apply the concept in context, not just recognise a definition.
How should I use these practice questions?
Select your answer before revealing the explanation. Then read why each option is right or wrong — this active recall approach builds retention far faster than re-reading notes.
Can I practise just Java Basics and Syntax questions in a focused session?
Yes — the session launcher on this page draws every question from the Java Basics and Syntax domain. Use a 10-question session first to gauge your baseline, then move to 20 or 30 once the weak spots are clear.
Where can I practise other 1Z0-811 topics?
Use the topic links above to move to related areas, or go back to the 1Z0-811 question bank to see all topics.
Are these real exam questions or dumps?
These are original practice questions written to test the same concepts the 1Z0-811 exam covers. They are not copied from any real exam or dump site.