What is the result? A. 4 B. 3 C. An exception is thrown at runtime. D. 5
Answer:
D
Discussions
0/ 1000
Question 10
Given:
It is required that if p instanceof Pair then p.isValid() returns true.
Which is the smallest set of visibility changes to insure this requirement is met?
A. setLeft and setRight must be protected.
B. left and right must be private.
C. isValid must be public.
D. left, right, setLeft, and setRight must be private.
Answer:
B
User Votes:
A
50%
B
50%
C
50%
D
50%
Discussions
0/ 1000
Question 11
Given:
What is the result?
A. 5
B. 3
C. 23
D. 25
E. 11
Answer:
E
User Votes:
A
50%
B
50%
C
50%
D
50%
E
50%
Discussions
0/ 1000
Question 12
Given:
What is the result? A. 2,34,34,5 B. 2,34,54,5 C. 2,54,54,5 D. 2,34,54,3
Answer:
C
Discussions
0/ 1000
Question 13
Given:
What is the result?
A. It throws a runtime exception.
B. Value of Euler = 2.71828
C. The code does not compile.
D. Value of Euler = “2.71828”
Answer:
C
User Votes:
A
50%
B
50%
C
50%
D
50%
Discussions
0/ 1000
Question 14
Given:
executed using this command: java Myclass My Car is red What is the output of this class?
A. Car--red--My
B. My--Car--is
C. My--is--java
D. java--Myclass--My
E. Myclass--Car--red
Answer:
A
User Votes:
A
50%
B
50%
C
50%
D
50%
E
50%
Discussions
0/ 1000
Question 15
Given:
Which two allow a.Main to allocate a new Person? (Choose two.)
A. In Line 1, change the access modifier to privateprivate Person() {
B. In Line 1, change the access modifier to publicpublic Person() {
C. In Line 2, add extends Person to the Main classpublic class Main extends Person {and change Line 3 to create a new Main objectPerson person = new Main();
D. In Line 2, change the access modifier to protectedprotected class Main {
E. In Line 1, remove the access modifierPerson() {