1Z0-803 Practice Questions
269 real 1Z0-803 exam questions with expert-verified answers and explanations. Page 5 of 6.
- Question #203
Given: What is the result?
- Question #204
Given: What will be the output?
- Question #205
Given the code fragment: What could expression1 and expression2 be, respectively, in order to produce output -8, 16?
- Question #206
Given: What is the result?
- Question #207
Given: And the commands: Javac Jump.java Java Jump crazy elephant is always What is the result?
- Question #208
Given: What is the result?
- Question #209
Given: What is the result?
- Question #210
Given: Which code fragment, when inserted at line 14, enables the code to print Mike Found?
- Question #211
Give: What is the result?
- Question #212
Given: What is the result?
- Question #213
Given: Which constructor initializes the variable x3?
- Question #214
Given: How many objects have been created when the line / / do complex stuff is reached?
- Question #215
Given: What is result?
- Question #216
Given the fragment: What is the result?
- Question #217
Given: Which code fragment, when inserted at line 9, enables the code to print true?
- Question #218
Given the code fragment: What is the result?
- Question #219
Given the classes: - AssertionError - ArithmeticException - ArrayIndexOutofBoundsException - FileNotFoundException - IllegalArgumentException - IOError - IOException - NumberFormat...
- Question #220
Given: public class Test1 { static void doubling (Integer ref, int pv) { ref =20; pv = 20; } public static void main(String[] args) { Integer iObj = new Integer(10); int iVar = 10;...
- Question #221
Given: class Mid { public int findMid(int n1, int n2) { return (n1 + n2) / 2; } } public class Calc extends Mid { public static void main(String[] args) { int n1 = 22, n2 = 2; // i...
- Question #222
Given: import java.util.*; public class Ref { public static void main(String[] args) { StringBuilder s1 = new StringBuilder("Hello Java!"); String s2 = s1.toString(); List<String>...
- Question #223
Given: public class ComputeSum { public int x; public int y; public int sum; public ComputeSum (int nx, int ny) { x = nx; y =ny; updateSum(); } public void setX(int nx) { x = nx; u...
- Question #224
Given the following four Java file definitions: // Foo.java package facades; public interface Foo { } // Boo.java package facades; public interface Boo extends Foo { } // Woofy.jav...
- Question #225
Given: public class SuperTest { public static void main(String[] args) { statement1 statement2 statement3 } } class Shape { public Shape() { System.out.println("Shape: constructor"...
- Question #226
Given: public class Marklist { int num; public static void graceMarks(Marklist obj4) { obj4.num += 10; } public static void main(String[] args) { MarkList obj1 = new MarkList(); Ma...
- Question #227
Given: class Cake { int model; String flavor; Cake() { model = 0; flavor = "Unknown"; } } public class Test { public static void main(String[] args) { Cake c = new Cake(); bake1(c)...
- Question #228
Given: public class Painting { private String type; public String getType() { return type; } public void setType(String type) { this.type = type; } public static void main(String[]...
- Question #229
Given: class Base { // insert code here } public class Derived extends Base{ public static void main(String[] args) { Derived obj = new Derived(); obj.setNum(3); System.out.println...
- Question #230
Given: public class Test { public static void main(String[] args) { int arr[] = new int[4]; arr[0] = 1; arr[1] = 2; arr[2] = 4; arr[3] = 5; int sum = 0; try { for (int pos = 0; pos...
- Question #231
Given: public class Equal { public static void main(String[] args) { String str1 = "Java"; String[] str2 = {"J","a","v","a"}; String str3 = ""; for (String str : str2) { str3 = str...
- Question #232
Given the code fragment: public static void main(String[] args) { int iArray[] = {65, 68, 69}; iArray[2] = iArray[0]; iArray[0] = iArray[1]; iArray[1] = iArray[2]; for (int element...
- Question #233
Given: public class TestLoop1 { public static void main(String[] args) { int a = 0, z=10; while (a < z) { a++; --z; } System.out.print(a + " : " + z); } } What is the result?
- Question #234
Given: public class MyClass { public static void main(String[] args) { while (int ii = 0; ii < 2) { ii++; System.out.println("ii = " + ii); } } } What is the result?
- Question #235
Given: public class String1 { public static void main(String[] args) { String s = "123"; if (s.length() >2) s.concat("456"); for(int x = 0; x <3; x++) s += "x"; System.out.println(...
- Question #236
Given the code fragment: float x = 22.00f % 3.00f; int y = 22 % 3; System.out.print(x + ", "+ y); What is the result?
- Question #237
Which three statements are true about the structure of a Java class?
- Question #238
Given: class MarksOutOfBoundsException extends IndexOutOfBoundsException { } public class GradingProcess { void verify(int marks) throws IndexOutOfBoundsException { if (marks > 100...
- Question #239
Given the code fragment: StringBuilder sb = new StringBuilder ( ) ; Sb.append ("world"); Which code fragment prints Hello World?
- Question #240
Given: package p1; public interface DoInterface { void method1(int n1); // line n1 } package p3; import p1.DoInterface; public class DoClass implements DoInterface { public DoClass...
- Question #241
Given the fragment: String[][] arra = new String[3][]; arra[0] = new String[]{"rose", "lily"}; arra[1] = new String[]{"apple", "berry","cherry","grapes"}; arra[0] = new String[]{"b...
- Question #242
Given the code fragment: public class Test { static String[][] arr =new String[3][]; private static void doPrint() { //insert code here } public static void main(String[] args) { S...
- Question #243
Given: public class FieldInit { char c; boolean b; float f; void printAll() { System.out.println("c = " + c); System.out.println("c = " + b); System.out.println("c = " + f); } publ...
- Question #244
Given the code fragment: String[] cartoons = {"tom","jerry","micky","tom"}; int counter =0; if ("tom".equals(cartoons[0])) { counter++; } else if ("tom".equals(cartoons[1])) { coun...
- Question #245
Given: public class Test { public static void main(String[] args) { int day = 1; switch (day) { case "7": System.out.print("Uranus"); case "6": System.out.print("Saturn"); case "1"...
- Question #246
Given: public class Test { public static void main(String[] args) { try { String[] arr =new String[4]; arr[1] = "Unix"; arr[2] = "Linux"; arr[3] = "Solarios"; for (String var : arr...
- Question #247
Given the code fragment int var1 = -5; int var2 = var1--; int var3 = 0; if (var2 < 0) { var3 = var2++; } else { var3 = --var2; } System.out.println(var3); What is the result?
- Question #248
Given the code fragment: List colors = new ArrayList(); colors.add("green"); colors.add("red"); colors.add("blue"); colors.add("yellow"); colors.remove(2); colors.add(3,"cyan"); Sy...
- Question #249
Given: public class TestOperator { public static void main(String[] args) { int result = 30 -12 / (2*5)+1; System.out.print("Result = " + result); } } What is the result?
- Question #250
Given: class Sports { int num_players; String name, ground_condition; Sports(int np, String sname, String sground){ num_players = np; name = sname; ground_condition = sground; } }...
- Question #251
Given: public class X { static int i; int j; public static void main(String[] args) { X x1 = new X(); X x2 = new X(); x1.i = 3; x1.j = 4; x2.i = 5; x2.j = 6; System.out.println( x1...
- Question #252
Which statement is true about the default constructor of a top-level class?