Oracle 1z0-803 Exam Practice Questions (P. 4)
- Full Access (216 questions)
- Six months of Premium Access
- Access to one million comments
- Seamless ChatGPT Integration
- Ability to download PDF files
- Anki Flashcard files for revision
- No Captcha & No AdSense
- Advanced Exam Configuration
Question #16
Given the code fragment:
int a = 0;
a++;
System.out.printIn(a++);
System.out.printIn(a);
What is the result?
int a = 0;
a++;
System.out.printIn(a++);
System.out.printIn(a);
What is the result?
- A1
- B0
- C1
- D2
Correct Answer:
A
The first println prints variable a with value 1 and then increases the variable to 2.
A
The first println prints variable a with value 1 and then increases the variable to 2.
send
light_mode
delete
Question #17
Given:

What is the result?

What is the result?
- AThere is no output
- Bd is output
- CA StringIndexOutOfBoundsException is thrown at runtime
- DAn ArrayIndexOutOfBoundsException is thrown at runtime
- EA NullPointException is thrown at runtime
- FA StringArrayIndexOutOfBoundsException is thrown at runtime
Correct Answer:
C
There are only 11 characters in the string "Hello World". The code the String.charAt(11) retrieves the 12th character, which does not exist. A
StringIndexOutOfBoundsException is thrown.
Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 11
C
There are only 11 characters in the string "Hello World". The code the String.charAt(11) retrieves the 12th character, which does not exist. A
StringIndexOutOfBoundsException is thrown.
Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 11
send
light_mode
delete
Question #18
Given a java source file:

What changes will make this code compile? (Select Two)

What changes will make this code compile? (Select Two)
- AAdding the public modifier to the declaration of class x
- BAdding the protected modifier to the x() constructor
- CChanging the private modifier on the declaration of the one() method to protected
- DRemoving the Y () constructor
- ERemoving the private modifier from the two () method
Correct Answer:
CE
Using the private protected, instead of the private modifier, for the declaration of the one() method, would enable the two() method to access the one() method.
CE
Using the private protected, instead of the private modifier, for the declaration of the one() method, would enable the two() method to access the one() method.
send
light_mode
delete
Question #19
Given:

What three modifications, made independently, made to class greet, enable the code to compile and run?

What three modifications, made independently, made to class greet, enable the code to compile and run?
- Aline 6 replaced with handy.dandy.keystroke stroke = new KeyStroke ( );
- Bline 6 replaced with handy.*.KeyStroke = new KeyStroke ( );
- Cline 6 replaced with handy.dandy.KeyStroke Stroke = new handy.dandy.KeyStroke();
- Dimport handy.*; added before line 1
- Eimport handy.dandy.*; added after line 1
- Fimport handy.dandy,KeyStroke; added after line 1
- Gimport handy.dandy.KeyStroke.typeException(); added before line 1
Correct Answer:
CEF
Three separate solutions:
C: the full class path to the method must be stated (when we have not imported the package)
D: We can import the hold dandy class
F: we can import the specific method
CEF
Three separate solutions:
C: the full class path to the method must be stated (when we have not imported the package)
D: We can import the hold dandy class
F: we can import the specific method
send
light_mode
delete
Question #20
Given:

What is the result?

What is the result?
- AThey match They really match
- BThey really match
- CThey match
- DNothing Prints
- EThey really match
Correct Answer:
B
The strings are not the same objects so the == comparison fails. See note #1 below.
As the value of the strings are the same equals is true. The equals method compares values for equality.
Note: #1 ==
Compares references, not values. The use of == with object references is generally limited to the following:
Comparing to see if a reference is null.
Comparing two enum values. This works because there is only one object for each enum constant.
You want to know if two references are to the same object.
B
The strings are not the same objects so the == comparison fails. See note #1 below.
As the value of the strings are the same equals is true. The equals method compares values for equality.
Note: #1 ==
Compares references, not values. The use of == with object references is generally limited to the following:
Comparing to see if a reference is null.
Comparing two enum values. This works because there is only one object for each enum constant.
You want to know if two references are to the same object.
send
light_mode
delete
All Pages