Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Document preview thumbnail
Preview 4 out of 65 pages
Exam (elaborations)

Oracle Java SE Developer Certification: Practice Questions with Answers & Rationales

Document preview thumbnail
Preview 4 out of 65 pages

Oracle Java SE Developer Certification: Practice Questions with Answers & Rationales

Content preview

Oracle Java SE Developer
Certification: Practice Questions
with Answers & Rationales




Section 1: Java Fundamentals (Questions 1-15)



Q1. Which of the following correctly describes the output of this code?

```java

String s1 = "Java";

String s2 = "Java";

String s3 = new String("Java");

System.out.println(s1 == s2);

System.out.println(s1 == s3);

```

A) true, true

B) true, false

C) false, true

,D) false, false



Answer: B



Rationale: String literals are interned—s1 and s2 reference the same object in the String pool, so
`==` returns true. `new String()` creates a new object in heap memory, so s3 references a
different object, making `==` false. Use `.equals()` for content comparison.




Q2. What is the output of this code?

```java

int x = 5;

int y = 2;

System.out.println(x / y);

System.out.println(x / (double) y);

```

A) 2, 2.5

B) 2.5, 2.5

C) 2, 2.0

D) Compilation error



Answer: A



Rationale: Integer division truncates the remainder, so 5/2 = 2. When one operand is a double,
numeric promotion occurs, yielding 2.5.

,Q3. Which of the following is a valid identifier in Java?

A) 1stPlace

B) _private

C) int

D) my-value



Answer: B



Rationale: Identifiers can start with a letter, underscore (_), or dollar sign ($). `1stPlace` starts
with a digit; `int` is a reserved keyword; `my-value` contains a hyphen (-), which is not allowed.




Q4. What does this code print?

```java

int a = 10;

int b = 20;

boolean result = a++ > 10 && ++b > 20;

System.out.println(a + ", " + b);

```

A) 10, 20

B) 11, 21

C) 11, 20

D) 10, 21

, Answer: C



Rationale: `a++` is post-increment (returns 10, then increments to 11). The first condition (10 >
10) is false, so short-circuit evaluation prevents `++b` from executing. b remains 20.




Q5. Which statement about text blocks in Java is true?

A) Text blocks can only contain ASCII characters

B) Text blocks preserve all whitespace by default

C) Text blocks are delimited by `"""` and can span multiple lines

D) Text blocks cannot contain escape sequences



Answer: C



Rationale: Text blocks (`""" ... """`) were introduced for multi-line strings. They preserve
indentation relative to the closing delimiter and can contain escape sequences. They support all
Unicode characters.




Q6. What is the output?

```java

System.out.println(10 + 20 + "30");

System.out.println("10" + 20 + 30);

```

Document information

Uploaded on
July 15, 2026
Number of pages
65
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers
$25.99

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
BestwriterGuru
4.8
(721)
Sold
222
Followers
32
Items
5055
Last sold
1 day ago



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions