Courseiva

1Z0-811 · topic practice

Primitives, Strings and Operators practice questions

Practise Oracle Java Foundations 1Z0-811 Primitives, Strings and Operators 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: Primitives, Strings and Operators

What the exam tests

What to know about Primitives, Strings and Operators

Primitives, Strings and Operators 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 Primitives, Strings and Operators 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

Primitives, Strings and Operators questions

19 questions · select your answer, then reveal the explanation

Given the following Java code:

```java

public class Main {
    public static void main(String[] args) {
        int a = 10, b = 5, c = 15;
        int result = (a > b) ? (a > c) ? a : c : (b > c) ? b : c;

System.out.println(result == 15 ? "Yes" : "No");

}
}

```

What is the output?

Exhibit

Refer to the exhibit.

String str = "Hello";
if (str instanceof String) {
    System.out.println("Yes");
} else {
    System.out.println("No");
}

Refer to the exhibit. What is the output?

Exhibit

public class Test {
    public static void main(String[] args) {
        String s1 = "Java";
        String s2 = new String("Java");
        String s3 = "Java";
        System.out.println(s1 == s2);
        System.out.println(s1.equals(s2));
        System.out.println(s1 == s3);
    }
}

Match each primitive data type to its default value.

Drag a concept onto its matching description — or click a concept then click the description.

Concepts
Matches

0

false

0.0d

'\u0000'

0L

What is the output of the program?

Exhibit

Refer to the exhibit.
public class Test {
    public static void main(String[] args) {
        int a = 10;
        int b = 20;
        boolean result = a > b ? a < b : a == b;
        System.out.println(result);
    }
}

A developer wants to compare two String objects for content equality. Which code snippet will work correctly?

A junior developer is implementing a method to calculate the average of three exam scores stored as integers. The method should return a double representing the average, rounded to one decimal place. The developer writes: double avg = (score1 + score2 + score3) / 3; However, the result is always an integer. Which of the following modifications ensures the correct result?

Given the code snippet: int x = 5; int y = 2; double result = x / y; What is the value of result?

A developer writes: String s = "Hello"; s.concat(" World"); System.out.println(s); What is the output?

Given: String str = "Java"; str = str.concat(" SE"); str.replace('a', 'A'); System.out.println(str); What is the output?

Which operator is used to compare two strings for value equality in Java?

What is the result of: System.out.println(10 + 20 + "30");

Given: boolean a = false; boolean b = true; boolean c = true; System.out.println(a || b && c); What is the output?

Which of the following is a valid Java identifier?

What is the output of: int i = 1; i = i++; System.out.println(i);

Which primitive type can store a single character?

Given: double d = 5.0; int i = d; What is the result?

What is the default value of a boolean variable in Java?

Which TWO of the following are valid ways to create a String?

Which THREE of the following are valid Java operators?

Free account

Track your progress over time

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

Focused Primitives, Strings and Operators sessions

Start a Primitives, Strings and Operators only practice session

Every question in these sessions is drawn from the Primitives, Strings and Operators 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 Primitives, Strings and Operators?
Primitives, Strings and Operators 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 Primitives, Strings and Operators questions in a focused session?
Yes — the session launcher on this page draws every question from the Primitives, Strings and Operators 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.