1Z0-803 Practice Questions
269 real 1Z0-803 exam questions with expert-verified answers and explanations. Page 4 of 6.
- Question #151
Given: public class Access { private int x = 0; private int y = 0; public static void main(String[] args) { Access accApp = new Access(); accApp.printThis(1, 2); accApp.printThat(3...
- Question #152
Given: What is the result?
- Question #153
Given the code fragment: 5. // insert code here 6. 7. arr[0] = new int[3]; 8. arr[0][0] = 1; 9. arr[0][1] = 2; 10. arr[0][2] = 3; 11. 12. arr[1] = new int[4]; 13. arr[1][0] = 10; 1...
- Question #154
Given the code fragment: 12. for (int row = 4; row > 0; row--) { 13. int col = row; 14. while (col <= 4) { 15. System.out.print(col); 16. col++; 17. } 18. System.out.println(); 19....
- Question #155
Given: public class Test3 { public static void main(String[] args) { double[] array = {10, 20.23, 'c', 300.00f}; for (double d : array) { d = d + 10; System.out.print(d + " "); } }...
- Question #157
Given this code in a file Traveler.java: And the commands: javac Traveler.java java Traveler Java Duke What is the result?
- Question #158
Given: What is the result?
- Question #159
Which statement is true about the default constructor of a top-level class?
- Question #160
Given: What is the result?
- Question #161
Given: What is the result?
- Question #162
Given: public class VarScope { public static void main (Stirng[] args) { String color = "red"; int qty = 10; if (color.equals("red")) { // line n1 int amount = qty * 10; } else if...
- Question #163
Given: Which line causes a compilation error?
- Question #164
Given: public class Test { public static void main(String[] args) { int i = 1; do { if ( i % 2 == 0) continue; if (i == 5) break; System.out.print(i + "\t"); i++; } while (true); }...
- Question #165
Which three statements are true regarding exception handling in Java?
- Question #166
Given: public class Test { public static void main (String[] args) { int i = 25; int j = i++ + 1; if (j % 5 == 0) { System.out.println(j + " is divisible by 5"); } else { System.ou...
- Question #167
Given the code fragment: 1. class Test { 2. public static void main(String[] args) { 3. Test t = new Test(); 4. int[] arr = new int[10]; 5. arr = t.subArray(arr, 0, 2); 6. } 7. //...
- Question #168
An unchecked exception occurs in a method doSomething(). Must other code be added in the doSomething() method for it to compile and run successfully?
- Question #169
Given: package handy.dandy; public class Keystroke { public void typeExclamation() { System.out.println("!"); } } And 1. package handy; 2. public class Greet { 3. public static voi...
- Question #170
The protected modifier on a Field declaration within a public class means that the field ______________.
- Question #171
Given: What is the result?
- Question #172
Given: What is the result?
- Question #173
Given: Class A { } Class B { } Interface X { } Interface Y { } Which two definitions of class C are valid?
- Question #174
View the exhibit. Given the code fragment: Which change enables the code to print the following? James age: 20 Williams age: 32
- Question #175
Given: What is the result?
- Question #176
Given the code format: Which code fragment must be inserted at line 6 to enable the code to compile?
- Question #178
Given: What is the result?
- Question #179
Given: What is the result?
- Question #180
Given: What is the result?
- Question #181
Given: What is the result?
- Question #182
Given: What is the result?
- Question #183
Given the code fragment: What is the result?
- Question #184
Given: What is the result?
- Question #185
Which two statements are true for a two-dimensional array of primitive data type?
- Question #186
Given: What is the result?
- Question #187
Given: What is the result?
- Question #188
Given: Which two classes use the shape class correctly?
- Question #189
Given the class definitions: And the code fragment of the main() method, What is the result?
- Question #190
Given: What is the result?
- Question #191
Which two items can legally be contained within a java class declaration?
- Question #192
Given: What is the result?
- Question #193
Given the code fragments: What is the result?
- Question #194
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?
- Question #195
Given the code fragment: What is the result?
- Question #196
Which two actions will improve the encapsulation of a class?
- Question #197
Given: The class is poorly encapsulated. You need to change the circle class to compute and return the area instead. Which two modifications are necessary to ensure that the class...
- Question #198
Given: What is the result?
- Question #199
Given: Which code fragment, when inserted at line 7, enables the code print true?
- Question #200
Given the code fragment: What is the result if the integer aVar is 9?
- Question #201
Given: And the commands: Javac Test.java Java Test 12345 What is the result?
- Question #202
Given the code fragment: Which code fragment, when inserted at // insert code here, enables the code to compile and and print a b c?