Java 1z0-808 Exam Questions & Answers
Java 1z0-808 Exam Questions & Answers
Number: 1z0-808
Passing Score: 800
Time Limit: 120 min
Website: https://vceplus.com
VCE to PDF Converter: https://vceplus.com/vce-to-pdf/
Facebook: https://www.facebook.com/VCE.For.All.VN/
Twitter : https://twitter.com/VCE_Plus
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
Exam A
QUESTION 1
Given:
A. 200.0 : 100.0
B. 400.0 : 200.0
C. 400.0 : 100.0
D. Compilation fails.
Correct Answer: C
Section: (none)
Explanation
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
Explanation/Reference:
QUESTION 2
Which statement is true about the switch statement?
Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
QUESTION 3
Given the code fragment:
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.
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
QUESTION 4
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.
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
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
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
B.
C.
D.
Correct Answer: A
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
Section: (none)
Explanation
Explanation/Reference:
QUESTION 5
Given the code fragment:
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
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 6
Given:
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
And given the code fragment:
A. Option A
B. Option B
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
C. Option C
D. Option D
Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
QUESTION 7
Given:
A. ABCD
B. ACD
C. ACDD
D. ABD
E. ABDC
Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
QUESTION 8
Given the code fragment:
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
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?
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)
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
Explanation
Explanation/Reference:
QUESTION 10
Given the code fragment:
Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
QUESTION 11
Given the code fragment:
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
Which modification enables the code fragment to print TrueDone?
A. Replace line 5 With String opt = "true"; Replace line 7 with case "true":
B. Replace line 5 with boolean opt = l; Replace line 7 with case 1:
C. At line 9, remove the break statement.
D. Remove the default section.
Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
QUESTION 12
Given the following main method:
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
What is the result?
A. 543210
B. 54321
C. 421
D. 5
E. Nothing is printed
Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
QUESTION 13
Given the code fragment:
A. 100
B. 101
C. 102
D. 103
E. Compilation fails
Correct Answer: A
Section: (none)
Explanation
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
Explanation/Reference:
QUESTION 14
Given the code fragment:
Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
QUESTION 15
Given:
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
What is the result?
A. C B A B.
C
C. A B C
D. Compilation fails at line n1 and line n2Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
QUESTION 16
Given the code fragment:
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
What is the result?
A. A B C Work done
B. A B C D Work done
C. A Work done
D. Compilation fails
Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
QUESTION 17
Which three are advantages of the Java exception mechanism? (Choose three.)
A. Improves the program structure because the error handling code is separated from the normal program function
B. Provides a set of standard exceptions that covers all possible errors
C. Improves the program structure because the programmer can choose where to handle exceptions
D. Improves the program structure because exceptions must be handled in the method in which they occurred
E. Allows the creation of new exceptions that are customized to the particular program being created
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
Section: (none)
Explanation
Explanation/Reference:
Reference: http://javajee.com/introduction-to-exceptions-in-java
QUESTION 18
Given the code from the Greeting.Java file:
A. Option A
B. Option B
C. Option C
D. Option D
Correct Answer: C
Section: (none)
Explanation
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
Explanation/Reference:
QUESTION 19
Given:
And:
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
A. Option A
B. Option B
C. Option C
D. Option D
Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
Explanation:
QUESTION 20
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
Given the code fragment:
A. 24
B. 0246
C. 024
D. Compilation fails
Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
QUESTION 21
Given the code fragment:
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
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 22
Given the code fragment:
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
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
C. Option C
D. Option D
E. Option E
Correct Answer: AC
Section: (none)
Explanation
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
Explanation/Reference:
QUESTION 23
Given:
A. Success
B. Failure
C. Compilation fails.
D. An exception is thrown at runtime
Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
QUESTION 24
Given the following code:
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
What is the output?
A. 4
4
B. 3
5
C. 4
7
D. 5
4
E. 4
5
F. 4
21
Correct Answer: E
Section: (none)
Explanation
Explanation/Reference:
QUESTION 25
Given:
Acc.java:
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
Which statement is true?
Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
QUESTION 26
Given the code fragment:
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
What is the result?
A. Execution terminates in the first catch statement, and Caught a RuntimeException is printed to the console.
B. Execution terminates in the second catch statement, and Caught an Exception is printed to the console.
C. A runtime error is thrown in the thread "main".
D. Execution completes normally, and Ready to use is printed to the console.
E. The code fails to compile because a throws keyword is required.
Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
QUESTION 27
Given:
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
A. Option A
B. Option B
C. Option C
D. Option D
Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
QUESTION 28
Given the code fragment:
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
C. false false
D. false true
Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
QUESTION 29
Given the code fragment:
A. Element 0
Element 1
B. Null element 0
Null element 1
C. Null
Null
D. A NullPointerException is thrown at runtime.
Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
QUESTION 30
Given the definitions of the MyString class and the Test class:
A.
B. C.
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
D. Compilation fails at the Test class
Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
QUESTION 31
Given:
A. int main 1
B. Object main 1
C. String main 1 D. Compilation fails
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
E. An exception is thrown at runtime
Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
QUESTION 32
Given the code fragment:
Which option represents the state of the num array after successful completion of the outer loop?
A.
B.
C.
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
D.
Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
QUESTION 33
Given this code for a Planet object:
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
What is the output?
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
A.
B.
C.
D.
E.
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
QUESTION 34
You are asked to develop a program for a shopping application, and you are given this information:
The application must contain the classes Toy, EduToy, and ConsToy. The Toy class is the superclass of the other two classes.
The int calculatePrice (Toy t) method calculates the price of a toy. The void printToy (Toy t) method prints the details of a toy.
Which definition of the Toy class adds a valid layer of abstraction to the class hierarchy?
A.
B.
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
C.
D.
Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
QUESTION 35
Given this array:
Which two code fragments, independently, print each element in this array? (Choose two.)
A.
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
B. C.
D. E.
F.
Correct Answer: BE
Section: (none)
Explanation
Explanation/Reference:
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
QUESTION 36
Given the content of three files:
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
QUESTION 37
Given the code fragment:
Correct Answer: DE
Section: (none)
Explanation
Explanation/Reference:
QUESTION 38
Given:
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
What is the result?
A. 400 200
B. 200 200
C. 400 400
D. Compilation fails.
Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
QUESTION 39
Given the following class declarations: public
abstract class Animal public interface Hunter
public class Cat extends Animal implements Hunter
public class Tiger extends Cat Which answer fails to
compile?
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
A. Option A
B. Option B
C. Option C
D. Option DE. Option E
Correct Answer: E
Section: (none)
Explanation
Explanation/Reference:
QUESTION 40
Given:
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
How many MarkList instances are created in memory at runtime?
A ..................................................................................................................................................................................................................................................... 2
B ..................................................................................................................................................................................................................................................... 6
C ..................................................................................................................................................................................................................................................... 6
DCorrect Answer: A....................................................................................................................................................................................................................... 6
Section:
(none)Explanation ......................................................................................................................................................................................................................... 7
Explanation/Reference
:QUESTION .................................................................................................................................................................................................................................... 7
Given:
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
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 42
Given:
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
What is the result?
Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
QUESTION 43
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
Given the following classes:
Which two options fail to compile when placed at line n1 of the main method? (Choose two.)
A. employee.salary = 50_000;
B. director.salary = 80_000;
C. employee.budget = 200_000;
D. manager.budget = 1_000_000;
E. manager.stockOption = 500;
F. director.stockOptions = 1_000;
Correct Answer: CE
Section: (none)
Explanation
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
Explanation/Reference:
QUESTION 44
Which one of the following code examples uses valid Java syntax?
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
A. Option A
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
B. Option B
C. Option C
D. Option D
Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
Reference: https://docs.oracle.com/javase/tutorial/getStarted/application/
QUESTION 45
Given the code fragment:
A. 1324
B. 2313
C. 3142
D. 4231
Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
QUESTION 46
Given:
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
Explanation/Reference:
QUESTION 47
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://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
QUESTION 48
Given:
A. a, e
i, i
B. a, e
o, o
C. e, e
i, i
D. a, a
o, o
Correct Answer: A
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
Section: (none)
Explanation
Explanation/Reference:
QUESTION 49
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 50
Given the code fragment:
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
What is the result?
A. Compilation fails.
B. C.
D.
E.
Correct Answer: E
Section: (none)
Explanation
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
Explanation/Reference:
Explanation:
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
QUESTION 51
Which statement will empty the contents of a StringBuilder variable named sb?
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 52
Given:
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
Which code fragment can replace the if block?
A.
B.
C.
D.
Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
QUESTION 53
Given:
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
And the code fragment:
Which code fragment, when inserted at line 14, enables the code to print Mike Found?
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
A.
B.
C.
D.
Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
QUESTION 54
Given:
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
What is the result?
A.
B.
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
C.
D.
Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
QUESTION 55
Which three statements are true about the structure of a Java class? (Choose three.)
Explanation/Reference:
QUESTION 56
Given:
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
What is the result?
Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
QUESTION 57
Given the code fragment:
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
What is the result?
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
QUESTION 58
Given the code fragment:
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
C. 5 : 10
D. Compilation fails.
Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
Explanation:
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
QUESTION 59
Given the code fragment:
Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
Explanation:
QUESTION 60
Which two code fragments cause a compilation error? (Choose two.)
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
A. float flt = 100.00F;
B. float flt = (float) 1_11.00;
C. Float flt = 100.00;
D. double y1 = 203.22; float flt = y1;
E. int y2 = 100; float flt = (float) y2 ;
Correct Answer: AD
Section: (none)
Explanation
Explanation/Reference:
QUESTION 61
Given:
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
What is the result?
A.
B. C.
D.
Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
QUESTION 62
Which three statements are true about exception handling? (Choose three.)
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
B. All subclasses of the RuntimeException class are not recoverable.
C. The parameter in a catch block is of Throwable type.
D. All subclasses of the RuntimeException class must be caught or declared to be thrown.
E. All subclasses of the RuntimeException class are unchecked exceptions.
F. All subclasses of the Error class are not recoverable.
Explanation/Reference:
QUESTION 63
Given the code fragment:
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
Which code fragment, inserted at line n1, prints The Top element: 30?
A.
B. C.
D.
E.
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
Correct Answer: E
Section: (none)
Explanation
Explanation/Reference:
QUESTION 64
Given the code fragment:
Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
QUESTION 65
Given:
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
https://vceplus.com/ What is the
result?
A. false, false
B. false, true
C. true, false
D. true, true
Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
QUESTION 66
Given the code fragment:
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
What is the result?
A. Compilation fails.
B. 0 Found
C. 1 Found
D. 3 Found
Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
QUESTION 67
Given the code fragment:
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
A. An exception is thrown at runtime.
B. 07-31-2014
C. 2014-07-31
D. 2014-09-30
Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
QUESTION 68
Given:
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
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:
QUESTION 69
Given this class:
Which three pieces of code, when inserted independently, set the value of amount to 100?
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
A.
B.
C.
D.
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
E.
F.
Explanation/Reference:
QUESTION 70
Given the code fragments:
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
What is the result?
Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
QUESTION 71
Given the code fragment:
Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
QUESTION 72
Given:
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
And given the code fragment:
A. C2C2
B. C1C2
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
C. C1C1
D. Compilation fails
Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
QUESTION 73
Given the code fragment:
Which two sets of actions, independently, enable the code fragment to print Fit?
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
At line n2 insert: String color = Shirt.getColor();
Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
QUESTION 74
Given the code fragments:
And:
A. After line 11, three objects are eligible for garbage collection.
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
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 75
Given the code fragment:
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
A. 3
B. 4
C. -1
D. Compilation fails.
Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
QUESTION 76
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 77
Given:
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
What is the result?
A. 10 : 30 : 6
B. 10 : 22 : 22
C. 10 : 22 : 20
D. 10 : 22 : 6
Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
Explanation:
QUESTION 78
Given:
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
And given the code fragment:
Correct Answer: E
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
Section: (none)
Explanation
Explanation/Reference:
QUESTION 79
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?
Correct Answer: AC
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
Section: (none)
Explanation
Explanation/Reference:
QUESTION 80
Given the code fragment:
Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
QUESTION 81
Given the code fragment:
Which three code fragments are valid at line n1? (Choose three.)
A.
B.
C.
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
D.
E.
Explanation/Reference:
QUESTION 82
Given:
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
What is the result?
A. Compilation fails.
B. 35
C. 00
D. 9 25
Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
QUESTION 83
Given:
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
What is the result?
A. 10 Hello Hello 11
B. 10 Hello Hello 121
C. 100 Hello 121
D. 100 Hello Hello 121
E. 10 Hello 11
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
Correct Answer: E
Section: (none)
Explanation
Explanation/Reference:
QUESTION 84
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 85
Given:
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
What is the result?
Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
QUESTION 86
Given the code fragment:
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
What is the result?
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://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
QUESTION 87
Given:
MainTest.java:
and commands:
A. String main 1
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
B. An exception is thrown at runtime
C. String main 1 2 3
D. String main 123
Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
QUESTION 88
Which two statements are true about Java byte code? (Choose two.)
Correct Answer: AE
Section: (none)
Explanation
Explanation/Reference:
QUESTION 89
Given the code fragment:
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
B. 2413
C. 1324
D. 4231
Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
Explanation:
QUESTION 90
Given the code fragments:
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
What is the result?
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
E. RTool::export Tool::export
Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
QUESTION 91
Given the code fragment:
A. 2012-02-10 00:00
B. 2012-01-30
C. 2012-02-10
D. A DateTimeException is thrown at runtime.
Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
Explanation:
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
QUESTION 92
Given:
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
D. Hello Log 1:2
Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
Explanation:
QUESTION 93
Given:
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
What is the result?
A. C B A
B. C
C. A B C
D. Compilation fails at line n1 and line n2
Correct Answer: A
Section: (none)
Explanation
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
Explanation/Reference:
QUESTION 94
Given this code for the classes MyException and Test:
A. A
B. AB
C. A compile time error occurs at line n1.
D. B
E. I
Correct Answer: E
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
Section: (none)
Explanation
Explanation/Reference:
Explanation:
QUESTION 95
Given the code fragment:
Correct Answer: AC
Section: (none)
Explanation
Explanation/Reference:
QUESTION 96
Given:
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
And the code fragment:
A. C1C2
B. C1C1
C. Compilation fails.
D. C2C2
Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
Explanation:
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
QUESTION 97
Given the code fragment:
A. 24
B. 0246
C. 024
D. Compilation fails.
Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
Explanation:
QUESTION 98
Given the code fragment:
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
3. Process alternating elements of the array in the order of entry.
Correct Answer: BC
Section: (none)
Explanation
Explanation/Reference:
QUESTION 99
Given:
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
What is the result?
A. 97 98
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
99 100 null
null null
B. 97 98
99 100
101 102 103C.
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 100
Given the code fragment:
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
QUESTION 101
Given:
A.
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
B.
C.
D.
Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
QUESTION 102
Given:
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
What is the result?
A. A
B
B. A
C
C. C
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
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 103
Given:
A. Compilation fails.
B. false true
C. true false
D. true true
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
E. false false
Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
Explanation:
QUESTION 104
Given the code fragments:
And:
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
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: A
Section: (none)
Explanation
Explanation/Reference:
Explanation:
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
QUESTION 105
Given the code snippet from a compiled Java source file:
Arg is 2
A. java MyFile 1 2 2
B. java MyFile 2
C. java MyFile 1 2 3 4
D. java MyFile 2 2
Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
QUESTION 106
Given the code fragment:
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
Which action enables it to print AB?
Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
QUESTION 107
Given the definitions of the Bird class and the Peacock class:
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
and the code fragment:
Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
QUESTION 108
Given the code fragment:
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
What is the result?
A. 11
B. 10
C. 12
D. A compile time error occurs.
Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
Explanation:
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
QUESTION 109
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://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
https://vceplus.com/
https://vceplus.com/
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com