Oracle Test-Inside 1z0-808 v2020-05-13 by James 121q PDF
Oracle Test-Inside 1z0-808 v2020-05-13 by James 121q PDF
Number: 1z0-808
Passing Score: 800
Time Limit: 120 min
File Version: 1
1z0-808
https://www.gratisexam.com/
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
Exam A
QUESTION 1
Which statement is true about the switch statement?
https://www.gratisexam.com/
Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
QUESTION 2
Given the code fragment:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
A. Sum is 600
B. Compilation fails at line n1.
C. Compilation fails at line n2.
D. A ClassCastException is thrown at line n1.
E. A ClassCastException is thrown at line n2.
Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
QUESTION 3
What is the name of the Java concept that uses access modifiers to protect variables and hide them within a class?
A. Encapsulation
B. Inheritance
C. Abstraction
D. Instantiation
E. Polymorphism
Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
Explanation:
Using the private modifier is the main way that an object encapsulates itself and hide data from the outside world.
Reference: http://www.tutorialspoint.com/java/java_access_modifiers.htm
QUESTION 4
Given:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
What is the result?
Correct Answer: A
Section: (none)
Explanation
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
Explanation/Reference:
QUESTION 5
Given these two classes:
Any amount of electricity used by a customer (represented by an instance of the Customer class) must contribute to the customer's bill (represented by the member
variable bill) through the useElectricity method.
An instance of the Customer class should never be able to tamper with or decrease the value of the member variable bill.
How should you write methods in the ElectricAccount class at line n1 so that the member variable bill is always equal to the value of the member variable
kwh multiplied by the member variable rate?
A.
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
B.
C.
D.
Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
QUESTION 6
Given the code fragment:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
What is the result?
A. Match 1
B. Match 2
C. No Match
D. A NullPointerException is thrown at runtime.
Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
QUESTION 7
Given:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
And given the code fragment:
A. Option A
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
B. Option B
C. Option C
D. Option D
Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
QUESTION 8
Given the code fragment:
Which option can replace xxx to enable the code to print 135?
A.
B.
C.
D.
Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
QUESTION 9
Which statement best describes encapsulation?
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
A. Encapsulation ensures that classes can be designed so that only certain fields and methods of an object are accessible from other objects.
B. Encapsulation ensures that classes can be designed so that their methods are inheritable.
C. Encapsulation ensures that classes can be designed with some fields and methods declared as abstract.
D. Encapsulation ensures that classes can be designed so that if a method has an argument MyType x, any subclass of MyType can be passed to that method.
Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
QUESTION 10
Given this class:
Which three lines, when inserted independently at line n1, cause the program to print a 0 balance? (Choose three.)
A. acct.setAmount(-acct.getAmount());
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
B. acct.amount = 0; <option D earlier>
C. acct.setAmount(0);
D. acct.getAmount() = 0; <option E earlier>
E. this.amount = 0; <option A earlier>
F. acct.changeAmount(0); <option F earlier>
G. acct.changeAmount(-acct.amount); <option G earlier>
Explanation/Reference:
QUESTION 11
Given the code fragment:
A.
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
B.
C.
D.
Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
QUESTION 12
Given the code fragment:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
What is the result?
A.
Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
QUESTION 13
Given the code fragment:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
What is the result?
A. Sum is 600
B. Compilation fails at line n1.
C. Compilation fails at line n2.
D. A ClassCastException is thrown at line n1.
E. A ClassCastException is thrown at line n2.
Correct Answer: E
Section: (none)
Explanation
Explanation/Reference:
QUESTION 14
Given the code fragment:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
What is the result?
Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
QUESTION 15
Given:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
What is the result?
A. CBA
B. C
C. ABC
D. Compilation fails at line n1 and line n2
Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
QUESTION 16
Given the code fragment:
Which code fragment, when inserted at line 3, enables the code to print 10:20?
A.
B.
C.
D.
Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
Explanation:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
QUESTION 17
Given the code from the Greeting.Java file:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
Which set of commands prints Hello Duke in the console?
https://www.gratisexam.com/
A. Option A
B. Option B
C. Option C
D. Option D
Correct Answer: C
Section: (none)
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
Explanation
Explanation/Reference:
QUESTION 18
Given the code fragment:
A. 24
B. 0246
C. 024
D. Compilation fails
Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
QUESTION 19
Given the code fragment:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
Assume that the system date is June 20, 2014. What is the result?
A.
B.
C. Compilation fails.
D. An exception is thrown at runtime.
Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
QUESTION 20
Given:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
What is the result?
A. Compilation fails.
B. false true
C. true false
D. true true
E. false false
Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
QUESTION 21
Given the code fragment:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
And given the requirements:
If the value of the qty variable is greater than or equal to 90, discount = 0.5
If the value of the qty variable is between 80 and 90, discount = 0.2
Which two code fragments can be independently placed at line n1 to meet the requirements? (Choose two.)
A. Option A
B. Option B
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
C. Option C
D. Option D
E. Option E
Correct Answer: AC
Section: (none)
Explanation
Explanation/Reference:
QUESTION 22
Given:
A. Success
B. Failure
C. Compilation fails.
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
D. An exception is thrown at runtime
Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
QUESTION 23
Given:
Acc.java:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
D. p, r, and s are accessible via obj.
Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
QUESTION 24
Given:
A. Option A
B. Option B
C. Option C
D. Option D
Correct Answer: D
Section: (none)
Explanation
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
Explanation/Reference:
QUESTION 25
Given the code fragment:
A. ABC
B. ABCDE
C. ABDE
D. Compilation fails.
Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
QUESTION 26
Given the code fragment:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
What is the result?
A. true true
B. true false
C. false false
D. false true
Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
QUESTION 27
Given the code fragment:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
Which code fragment, when inserted at line n1, enables the App class to print Equal?
A. Option A
B. Option B
C. Option C
D. Option D
Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
QUESTION 28
Given the code fragment:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
What is the result?
A. 1 2 3 4
followed by an ArrayIndexOutOfBoundsException
B. 1 2 3
C. 1 2 3 4
D. Compilation fails.
Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
Explanation:
QUESTION 29
Given the definitions of the MyString class and the Test class:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
What is the result?
A.
B.
C.
Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
QUESTION 30
Given this code for a Planet object:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
A.
B.
C.
D.
E.
Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
QUESTION 31
Given this array:
Which two code fragments, independently, print each element in this array? (Choose two.)
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
A.
B.
C.
D.
E.
F.
Correct Answer: BE
Section: (none)
Explanation
Explanation/Reference:
QUESTION 32
Given:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
How many MarkList instances are created in memory at runtime?
A. 1
B. 2
C. 3
D. 4
Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
QUESTION 33
Given:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
What is the result?
A. Area is 6.0
B. Area is 3.0
C. Compilation fails at line n1
D. Compilation fails at line n2.
Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
QUESTION 34
Given:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
What is the result?
A. True false
B. True null
C. Compilation fails
D. A NullPointerException is thrown at runtime
Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
QUESTION 35
Given:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
What is the result?
Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
QUESTION 36
Given the code fragment:
A. 1:2:3:4:5:
B. 1:2:3:
C. Compilation fails.
D. An ArrayOutOfBoundsException is thrown at runtime.
Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
QUESTION 37
Given:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
What is the result?
A. true:true
B. true:false
C. false:true
D. false:false
Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
QUESTION 38
Given the code fragment:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
What is the result?
A. 1324
B. 2313
C. 3142
D. 4231
Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
QUESTION 39
Given:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
What is the result?
Correct Answer: D
Section: (none)
Explanation
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
Explanation/Reference:
QUESTION 40
Given the code fragment:
A. Answer = 0
B. Invalid calculation
C. Compilation fails only at line n1.
D. Compilation fails only at line n2.
E. Compilation fails at line n1 and line2.
Correct Answer: E
Section: (none)
Explanation
Explanation/Reference:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
QUESTION 41
Given:
A. 100 200 : 0 0 :
B. 100 200 : 100 0 :
C. 100 200 : 100 200 :
D. 0 0 : 100 0 :
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
QUESTION 42
Given:
A. a, e
i, i
B. a, e
o, o
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
C. e, e
i, i
D. a, a
o, o
Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
QUESTION 43
Given the code fragment:
A. Compilation fails.
B. 10 Hello Universe!
C. 10 Hello World!
D. 9 Hello World!
Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
QUESTION 44
Which statement will empty the contents of a StringBuilder variable named sb?
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
A. sb. deleteAll ();
B. sb. delete (0, sb. size () );
C. sb. delete (0, sb. length () );
D. sb. removeAll ();
Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
QUESTION 45
Which statement is true about the switch statement?
Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
Reference: http://www.dummies.com/programming/java/switch-statements-in-java/
QUESTION 46
Given the code fragment:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
Test.java
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
Which is the result?
C.
Correct Answer: E
Section: (none)
Explanation
Explanation/Reference:
QUESTION 47
Given the code fragments:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
Which modification enables the code to compile?
A.
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
B.
C.
D.
Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
QUESTION 48
Which three statements are true about the structure of a Java class? (Choose three.)
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
Correct Answer: ACE
Section: (none)
Explanation
Explanation/Reference:
QUESTION 49
Given:
Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
QUESTION 50
Given the code fragment:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
B. Compilation fails only at line n2.
C. Compilation fails only at line n1.
D. Jesse 25
Walter 52
Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
QUESTION 51
Given the code fragment:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
D. [1, 3, 4, null]
E. [1, 3, 4]
F. Compilation fails.
Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
Explanation:
QUESTION 52
Which two code fragments cause a compilation error? (Choose two.)
Correct Answer: AD
Section: (none)
Explanation
Explanation/Reference:
QUESTION 53
Given:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
What is the result?
A.
B.
C.
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
D.
Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
QUESTION 54
Which three statements are true about exception handling? (Choose three.)
Explanation/Reference:
QUESTION 55
Given the code fragment:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
What is the result?
Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
QUESTION 56
Which two statements are true? (Choose two.)
Correct Answer: BE
Section: (none)
Explanation
Explanation/Reference:
QUESTION 57
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
Given the code fragment:
https://www.gratisexam.com/
A. Compilation fails.
B. 0 Found
C. 1 Found
D. 3 Found
Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
QUESTION 58
Given:
A. Java SE
B. Java EE
C. Compilation fails at line n1.
D. A NullPointerException is thrown at runtime.
Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
QUESTION 59
Given the code fragment:
Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
QUESTION 60
Given:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
And given the code fragment:
A. C2C2
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
B. C1C2
C. C1C1
D. Compilation fails
Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
QUESTION 61
Given:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
Which two sets of actions, independently, enable the code fragment to print Fit?
Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
QUESTION 62
Given the code fragments:
And:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
Which statement is true?
A. After line 11, three objects are eligible for garbage collection.
B. After line 11, two objects are eligible for garbage collection.
C. After line 11, one object is eligible for garbage collection.
D. After line 11, none of the objects are eligible for garbage collection.
Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
QUESTION 63
Given the code fragment:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
What is the result?
A. 3
B. 4
C. -1
D. Compilation fails.
Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
QUESTION 64
Given the code fragment:
A. 2012-02-10
B. 2012-02-11
C. Compilation fails
D. A DateTimeException is thrown at runtime.
Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
QUESTION 65
Given:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
And given the code fragment:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
Correct Answer: E
Section: (none)
Explanation
Explanation/Reference:
QUESTION 66
Given this class:
Which two changes would encapsulate this class and ensure that the area field is always equal to length * height whenever the Rectangle class is used?
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
Correct Answer: AC
Section: (none)
Explanation
Explanation/Reference:
QUESTION 67
Given the code fragment:
A. Compilation fails.
B. Hi removed
C. An UnsupportedOperationException is thrown at runtime.
D. The program compiles, but it prints nothing.
Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
QUESTION 68
Which two class definitions fail to compile? (Choose two.)
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
A.
B.
C.
D.
E.
Correct Answer: CD
Section: (none)
Explanation
Explanation/Reference:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
QUESTION 69
Given:
A. null
Richard
Donald
B. Richard
Donald
C. Compilation fails.
D. An ArrayIndexOutOfBoundsException is thrown at runtime.
E. A NullPointerException is thrown at runtime.
Correct Answer: E
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
Section: (none)
Explanation
Explanation/Reference:
QUESTION 70
This grid shows the state of a 2D array:
Which line of code, when inserted in place of //line n1, adds an X into the grid so that the grid contains three consecutive XS?
A. grid[2][1] = ‘X’;
B. grid[3][2] = ‘X’;
C. grid[3][1] = ‘X’;
D. grid[2][3] = ‘X’;
Correct Answer: D
Section: (none)
Explanation
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
Explanation/Reference:
QUESTION 71
Given the code fragment:
Which two modifications should you make so that the code compiles successfully? (Choose two.)
Correct Answer: CE
Section: (none)
Explanation
Explanation/Reference:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
QUESTION 72
Given the code fragment:
A. 1 3 5 7
13
B. 1 3
13
C. 1 3
1300
D. 1 3
followed by an ArrayIndexOutOfBoundsException
E. Compilation fails.
Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
Explanation:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
QUESTION 73
Which is true about the switch statement?
Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
Reference: https://www.geeksforgeeks.org/switch-statement-in-java/
QUESTION 74
Given the code fragment:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
A. 3142
B. 2413
C. 1324
D. 4231
Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
Explanation:
QUESTION 75
Given:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
What is the result?
A. 95
B. 81 25
C. Compilation fails.
D. 00
Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
Explanation:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
QUESTION 76
Given the code fragments:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
What is the result?
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
Tool::export
Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
QUESTION 77
Given the code snippet from a compiled Java source file:
A. java MyFile 2
B. java MyFile 1 2 3 4
C. java MyFile 1 2 2
D. java MyFile 2 2
Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
QUESTION 78
Given the code fragment:
A. 3
B. 0
C. Compilation fails.
D. -1
Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
QUESTION 79
Given the code fragment:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
What is the result?
A. Compilation fails.
B. The program compiles, but it prints nothing.
C. HiHowAreYou removed
D. An UnsupportedOperationException is thrown at runtime.
Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
QUESTION 80
Given the code fragment:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
What is the result?
A.
B.
C. Invalid Name
D.
Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
Explanation:
QUESTION 81
Given:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
And the code fragment:
A. C1C2
B. C1C1
C. Compilation fails.
D. C2C2
Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
Explanation:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
QUESTION 82
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
Given the code fragment:
A. 24
B. 0246
C. 024
D. Compilation fails.
Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
Explanation:
QUESTION 83
Given the code fragment:
Correct Answer: BC
Section: (none)
Explanation
Explanation/Reference:
QUESTION 84
Given:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
What is the result?
A. 97 98
99 100 null null null
B. 97 98
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
99 100 101 102 103
C. Compilation fails.
D. A NullPointerException is thrown at runtime.
E. An ArraylndexOutOfBoundsException is thrown at runtime.
Correct Answer: E
Section: (none)
Explanation
Explanation/Reference:
Explanation:
QUESTION 85
Given the code fragment:
Which code fragment, when inserted at line n1, enables the App class to print Equal?
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
A. Option A
B. Option B
C. Option C
D. Option D
Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
QUESTION 86
Given the code fragment:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
What is the result?
A. ABC
B. ABCDE
C. ABDE
D. Compilation fails.
Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
QUESTION 87
Given the code fragment:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
Test.java:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
Which is the result?
C.
Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
QUESTION 88
Given:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
What is the result?
A.
B.
C.
D.
Correct Answer: A
Section: (none)
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
Explanation
Explanation/Reference:
QUESTION 89
Given the code fragment:
Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
QUESTION 90
Given:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
What is the result?
A. A
B
B. A
C
C. C
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
C
D. A ClassCastException is thrown only at line n1.
E. A ClassCastException is thrown only at line n2.
Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
QUESTION 91
Given:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
What is the result?
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
A. Base
DerivedA
B. Base
DerivedB
C. DerivedB
DerivedB
D. DerivedB
DerivedA
E. A ClassCastException is thrown at runtime.
Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
QUESTION 92
Given the definitions of the MyString class and the Test class:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
A.
B.
C.
Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
QUESTION 93
Given:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
A. Compilation fails.
B. false true
C. true false
D. true true
E. false false
Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
Explanation:
QUESTION 94
Given:
A. A B C D
B. A C D
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
C. A C D D
D. A B C C
E. A B D C
Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
Explanation:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
QUESTION 95
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
Given the definitions of the Bird class and the Peacock class:
Correct Answer: B
Section: (none)
Explanation
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
Explanation/Reference:
QUESTION 96
Given the code fragment:
A. 11
B. 10
C. 12
D. A compile time error occurs.
Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
Explanation:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
QUESTION 97
Given the code fragment:
A. 2 : 7 : 3
B. 7 : 7 : 9
C. 2 : 7 : 0
D. 7 : 2 : 3
Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
Explanation:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
QUESTION 98
Given:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
Which action fixes the compiler error?
Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
QUESTION 99
Given the code fragment:
A. 1 2 3 0 0
1 2 3 0 0
B. An Exception is thrown at run time.
C. 1 2 3 0 0
1 2 3
D. 1 2 3
1 2 3
Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
Explanation:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
QUESTION 100
Given the code fragment:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
Explanation:
QUESTION 101
Given:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
And:
A. ns = 100 s =125
ns = 0 s = 125
ns = 125 s = 125
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
B. ns = 50 s = 50
ns = 125 s = 125
ns = 0 s = 125
C. ns = 50 s = 125
ns = 125 s = 125
ns = 0 s = 125
D. ns = 50 s = 50
ns = 125 s =125
ns = 100 s =100
Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
QUESTION 102
Which two array initialization statements are valid? (Choose two.)
Correct Answer: BE
Section: (none)
Explanation
Explanation/Reference:
Reference: https://stackoverflow.com/questions/1200621/how-do-i-declare-and-initialize-an-array-in-java
QUESTION 103
Given the class definitions:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
class C1 {}
class C2 extends C1 {}
class C3 extends C2 {}
A. line 18
B. line 17
C. line 19
D. line 16
Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
Explanation:
QUESTION 104
Which two features can be implemented in a Java application by encapsulating the entity classes used? (Choose two.)
A. data validation
B. compile time polymorphism
C. data hiding
D. data abstraction
E. data memory optimization
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
Correct Answer: CD
Section: (none)
Explanation
Explanation/Reference:
Reference: https://www.geeksforgeeks.org/encapsulation-in-java/
QUESTION 105
Given the code fragment:
Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
Explanation:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
QUESTION 106
Given the code fragment:
A. [JavaForum, ExpertForum]
B. [JavaGroup, ExpertGroup]
C. [JavaForumGroup, ExpertForumGroup]
D. [JavaGroup, TechGroup ExpertGroup]
Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
Explanation:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
QUESTION 107
Examine the given definitions:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
and the code fragment:
Which statement is true about the implementation of Object-Oriented Programming concepts in the given code?
Correct Answer: C
Section: (none)
Explanation
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
Explanation/Reference:
QUESTION 108
Given:
A. true
B. false
C. -1
D. 0
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
Explanation:
QUESTION 109
Given:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
and the code fragment:
A. Child 10
Child 100
Parent 100
B. Parent 10
Child 10
Parent 1000
C. Child 10
Parent 100
Parent 100
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
D. A compile time error occurs.
Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
Explanation:
QUESTION 110
Given the code fragment:
https://www.gratisexam.com/
What is the result?
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
A. EN FR JP
B. EN FR
C. CH
D. EN FR CH
Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
Explanation:
QUESTION 111
Given:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
and the code fragment:
A. true:false:true
B. false:true:true
C. false:true:false
D. true:true:false
Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
Explanation:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
QUESTION 112
Given:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
What is the result?
A. Good Luck!
B. Good Day!
C. Welcome!
D. Hello!
Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
Explanation:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
QUESTION 113
Given:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
What is the result?
A. 10
20
B. A compile time error occurs
C. 20
20
D. 10
10
Correct Answer: B
Section: (none)
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
Explanation
Explanation/Reference:
Explanation:
QUESTION 114
Given these requirements:
Bus and Boat are Vehicle type classes.
The start() and stop() methods perform common operations across the Vehicle class type.
The ride() method performs a unique operations for each type of Vehicle.
A. 1. Create an abstract class Vehicle by defining start() and stop() methods, and declaring the ride() abstract method.
2. Create Bus and Boat classes by inheriting the Vehicle class and overriding the ride() method.
B. 1. Create an interface Vehicle by defining start() and stop() methods, and declaring the ride() abstract method.
2. Create Bus and Boat classes by implementing the Vehicle class.
C. 1. Create an abstract class Vehicle by declaring stop(), start(), and ride() abstract methods.
2. Create Bus and Boat classes by inheriting the Vehicle class and overriding all the methods.
D. 1. Create an interface Vehicle by defining default stop(), start(), and ride() methods.
2. Create Bus and Boat classes by implementing the Vehicle interface and overriding the ride() method.
Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
QUESTION 115
Given:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
What is the result?
A. null:null:0.0
B. null:null
C. <<HashCode>>:0.0
D. null:0.0
Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
Explanation:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
QUESTION 116
Examine the content of App.java:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
Which is true?
A. The App.class file is stored within the p1 folder. The Test.class file is stored within the p2 sub-folder of p1.
B. The App class is accessible within the Test class without an import statement.
C. import p1.App; is used to access the App class within the Test class.
D. It is optional to have the package statement as the first line of class definitions.
Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
QUESTION 117
Given the code fragment:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
Which code snippet at line 9 prints true?
A. Boolean s = p.apply(101);
System.out.println(s);
B. Boolean s = p.test(100);
System.out.println(s);
C.
D. System.out.println(p.apply(100));
Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
Explanation:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
QUESTION 118
Given:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
float sum is 30.0
B. float sum is 30.0
double sum is 30.0
C. Integer sum is 30
double sum is 30.0
D. Integer sum is 30
float sum is 30.0
Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
Explanation:
QUESTION 119
Given:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
What is the result?
A. c=null
b=true
f=0.0
B. c=
b=false
f=0.0
C. c=null
b=false
f=0.0
D. c=0
b=false
f=0.0F
Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
Explanation:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
QUESTION 120
Which two code fragments cause compilation errors? (Choose two.)
A. double y1 = 203.22;
float fit = y1;
B. float fit = (float) 1_11.00;
C. Float fit = 100.00;
D. int y2 = 100;
float fit = (float) y2;
E. float fit = 100.00F;
Correct Answer: BD
Section: (none)
Explanation
Explanation/Reference:
QUESTION 121
Given:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
What is the result?
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
https://www.gratisexam.com/
Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
Explanation:
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2