Examen1Z0-815 2
Examen1Z0-815 2
Examen1Z0-815 2
Which three pieces of code, when inserted independently, set the value of amount
to 100?
A. Option A
B. Option B
C. Option C
D. Option D
E. Option E
F. Option F
Which code fragment, inserted at line n1, pints The Top element: 30?
A. Option A
B. Option B
C. Option C
D. Option D
E. Option E
A. Option A
B. Option B
C. Option C
D. Option D
E. Option E
Which two modifications should you make so that the code compiles successfully?
A. Option A
B. Option B
C. Option C
D. Option D
E. Option E
A. Option A
B. Option B
C. Option C
D. Option D
Which two modifications enable the code to print the following output?
Canine 60 Long
Feline 30 Short
A. Replace line n1 with: super (); this.bounds = bounds;
B. Replace line n1 with: this.bounds = bounds; super ();
C. Replace line n2 with: super (type, maxSpeed); this (bounds);
D. Replace line n1 with: this (“Canine", 60); this.bounds = bounds
E. Replace line n2 with: super (type, maxSpeed); this.bounds = bounds;
Given:
public class MyClass {
public static void main(String[] args) { String s = ”’Java Duke"; int len = s . trim ().
length () ;
System.out.print(len);
}
}
What is the result?
A. Compilation fails
B. 11
C. 8
D. 9
E. 10
Which two options fail to compile when placed at line n1 of the main method?
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;
44.- Which one of the following code
examples uses valid Java Syntax?
Which one of the following code examples uses valid Java Syntax?
A. A.
public class Boat {
public static void main (String [] args) { System.out.println ("I float.");
}
}
B. public class Cake {
public static void main (String [] ) {
System.out.println ("Chocolate");
>
}
C. public class Dog {
public void main (String [] args) {
System.out.println ("Squirrel.");
>}
D. public class Bank {
public static void main (String () args) {
System.out.println ("Earn interest.");
>
}
Given:
Which three code fragments can be independently inserted at line nl to enable the
code to print one?
A. Byte x = 1;
B. short x = 1;
C. String x = "1";
D. Long x = 1;
E. Double x = 1;
F. Integer x = new Integer ("1");
A. Option A
B. Option B
C. Option C
D. Option D
E. Option E
Which two code fragments, independently, print each element in this array?
A. Option A
B. Option B
C. Option C
D. Option D
E. Option E
F. Option F
58.- Which statement is true?
Given the content of three files:
A. Option A
B. Option B
C. Option C
D. Option D
E. Option E
A. Option A
B. Option B
C. Option C
D. Option D
What are the values of each element in intArr after this code has executed?
A. 15, 60, 45, 90, 75
B. 15, 90, 45, 90, 75
C. 15, 30, 75, 60, 90
D. 15, 30, 90, 60, 90
E. 15, 4, 45, 60, 90
Which option represents the state of the num array after successful completion of
the outer loop?
A. Option A
B. Option B
C. Option C
D. Option D
A. Option A
B. Option B
C. Option C
D. Option D
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
A. Option A
B. Option B
C. Option C
D. Option D
A. Option A
B. Option B
C. Option C
D. Option D
Which code fragment, when inserted at line n1, enables the code to print Hank?
A. checkAge (iList, ( ) -> p. get Age ( ) > 40);
B. checkAge(iList, Person p -> p.getAge( ) > 40);
C. checkAge (iList, p -> p.getAge ( ) > 40);
D. checkAge(iList, (Person p) -> { p.getAge() > 40; });
76.- What is the result?
Given the code fragment:
You must ensure that the maskcc method returns a string that hides all digits of the
credit card number except the four last digits (and the hyphens that separate each
group of four digits).
Which two code fragments should you use at line n1, independently, to achieve
this requirement?
A. Option A
B. Option B
C. Option C
D. Option D
79.- Which statement is true?
Given:
A. Option A
B. Option B
C. Option C
D. Option D
E. Option E
82.- What is the result?
Given:
Assume that the system date is June 20, 2014. What is the result?
A. Option A
B. Option B
C. Option C
D. Option D
Which code fragment, when inserted at line 9, enables the code to print true?
A. String str2 = str1;
B. String str2 = new String (str1);
C. String str2 = sb1. toString ();
D. String str2 = "Duke";
86.- What is the result?
Given the code fragment:
A. Option A
B. Option B
C. Option C
D. Option D
A. Option A
B. Option B
C. Option C
D. Option D
Which code fragment, when inserted at line 3, enables the code to print 10:20?
A. int[] array n= new int[2];
B. int[] array; array = int[2];
C. int array = new int[2];
D. int array [2] ;
Which two modifications, when made independently, enable the code to print
joe:true: 100.0?
A. Option A
B. Option B
C. Option C
D. Option D
E. Option E
97.- What is the result?
Given the code fragment:
A. Option A
B. Option B
C. Option C
D. Option D
102.- What is the result?
Given the code fragment:
Which option can replace xxx to enable the code to print 135?
A. int e = 0; e < = 4; e++
B. int e = 0; e < 5; e + = 2
C. int e = 1; e < = 5; e + = 1
D. int e = 1; e < 5; e+ =2
Which code fragment, when inserted at line 2, enables the code to compile?
A. Option A
B. Option B
C. Option C
D. Option D
E. Option E
107.- Which three lines, when inserted
independently at line n1, cause the
program to print a o balance?
Given the following class:
Which three lines, when inserted independently at line n1, cause the program to
print a o balance?
A. this.amount = 0;
B. amount = 0;
C. acct (0) ;
D. acct.amount = 0;
E. acct. getAmount () = 0;
F. acct.changeAmount(0);
G. acct.changeAmount(-acct.amount);
H. acct.changeAmount(-acct.getAmount());
Which code fragment should you use at line n1 to instantiate the dvd object
successfully?
A. Option A
B. Option B
C. Option C
D. Option D
A. Option A
B. Option B
C. Option C
D. Option D
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?
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 method useElectricity method. An instance of the
customer class should never be able to tamper with or decrease the value of the
member variable bill.
A. Option A
B. Option B
C. Option C
D. Option D
112.- What is the result?
Given the code fragment:
Which two modifications should you make so that the code compiles successfully?
A. Option A
B. Option B
C. Option C
D. Option D
E. Option E