Valid Tips For 100% 1Z0-803 Exam Pass: We PassLeader now provide the best 1Z0-803 169q study materials for your 1Z0-803 certification exam. We offer the latest 1Z0-803 169q exam questions to ensure that you 100 percent pass exam, and what’s more, we will offer you the new updated 1Z0-803 169q exam dumps for one year free and free new version VCE Player.
Vendor: Oracle
Exam Code: 1Z0-803
Exam Name: Java SE 7 Programmer I
QUESTION 76
Given the code fragment:
String name = "Spot";
int age = 4;
String str ="My dog " + name + " is " + age;
System.out.println(str);
And
StringBuilder sb = new StringBuilder();
Using StringBuilder, which code fragment is the best potion to build and print the following string: My dog Spot is 4?
A. sb.append("My dog " + name + " is " + age); System.out.println(sb);
B. sb.insert("My dog ").append( name + " is " + age); System.out.println(sb);
C. sb.insert("My dog ").insert( name ).insert(" is " ).insert(age); System.out.println(sb);
D. sb.append("My dog ").append( name ).append(" is " ).append(age); System.out.println(sb);
Answer: AD
QUESTION 77
Given:
public class Main {
public static void main(String[] args) {
try {
doSomething();
}
catch (SpecialException e) {
System.out.println(e);
}}
static void doSomething() {
int [] ages = new int[4];
ages[4] = 17;
doSomethingElse();
}
static void doSomethingElse() {
throw new SpecialException("Thrown at end of doSomething() method"); }
}
What is the output?
A. SpecialException: Thrown at end of doSomething() method
B. Error in thread "main" java.lang. ArrayIndexOutOfBoundseror
C. Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 4 at Main.doSomething(Main.java:12) at Main.main(Main.java:4)
D. SpecialException: Thrown at end of doSomething() method at Main.doSomethingElse(Main.java:16) at Main.doSomething(Main.java:13) at Main.main(Main.java:4)
Answer: C
QUESTION 78
View the exhibit:
public class Student {
public String name = "";
public int age = 0;
public String major = "Undeclared";
public boolean fulltime = true;
public void display() {
System.out.println("Name: " + name + " Major: " + major); }
public boolean isFullTime() {
return fulltime;
}
}
Which line of code initializes a student instance?
A. Student student1;
B. Student student1 = Student.new();
C. Student student1 = new Student();
D. Student student1 = Student();
Answer: C
QUESTION 79
What should keyword1 and keyword2 be respectively, in oreder to produce output 2345?
int [] array = {1,2,3,4,5};
for (int i: array) {
if ( i < 2) {
keyword1 ;
}
System.out.println(i);
if ( i == 3) {
keyword2 ;
}}
A. continue, break
B. break, break
C. break, continue
D. continue, continue
Answer: D
QUESTION 80
What is the result?
int i, j=0;
i = (3* 2 +4 +5 ) ;
j = (3 * ((2+4) + 5));
System.out.println("i:"+ i + "\nj":+j);
A. Option A
B. Option B
C. Option A
D. Option D
Answer: B
QUESTION 81
What is the result?
boolean log3 = ( 5.0 != 6.0) && ( 4 != 5);
boolean log4 = (4 != 4) || (4 == 4);
System.out.println("log3:"+ log3 + \nlog4" + log4);
A. log3:false
log4:true
B. log3:true
log4:true
C. log3:true
log4:false
D. log3:false
log4:false
Answer: B
QUESTION 82
Which statement will emoty 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();
Answer: C
http://www.passleader.com/1z0-803.html
QUESTION 83
What is the result?
Class StaticField {
static int i = 7;
public static void main(String[] args) {
StaticFied obj = new StaticField();
obj.i++;
StaticField.i++;
obj.i++;
System.out.println(StaticField.i + " "+ obj.i);
}
}
A. 10 10
B. 8 9
C. 9 8
D. 7 10
Answer: A
QUESTION 84
Which two are valid array declaration?
A. Object array[];
B. Boolean array[3];
C. int[] array;
D. Float[2] array;
Answer: AC
QUESTION 85
Given:
class Overloading {
int x(double d) {
System.out.println("one");
return 0;
}
String x(double d) {
System.out.println("two");
return null;
}
double x(double d) {
System.out.println("three");
return 0.0;
}
public static void main(String[] args) {
new Overloading().x(4.0);
}
}
What is the result?
A. one
B. two
C. three
D. Compilation fails.
Answer: D
QUESTION 86
Given:
public class MainMethod {
void main() {
System.out.println("one");
}
static void main(String args) {
System.out.println("two");
}
public static void main(String[] args) {
System.out.println("three");
}
void mina(Object[] args) {
System.out.println("four");
}
}
What is printed out when the program is excuted?
A. one
B. two
C. three
D. four
Answer: C
QUESTION 87
Given:
public class ScopeTest {
int j, int k;
public static void main(String[] args) {
ew ScopeTest().doStuff(); }
void doStuff() {
nt x = 5;
oStuff2();
System.out.println("x");
}
void doStuff2() {
nt y = 7;
ystem.out.println("y");
or (int z = 0; z < 5; z++) {
ystem.out.println("z");
ystem.out.println("y");
}
Which two items are fields?
A. j
B. k
C. x
D. y
E. z
Answer: AB
QUESTION 88
A method is declared to take three arguments. A program calls this method and passes only two arguments. What is the results?
A. Compilation fails.
B. The third argument is given the value null.
C. The third argument is given the value void.
D. The third argument is given the value zero.
E. The third argument is given the appropriate falsy value for its declared type.
F. An exception occurs when the method attempts to access the third argument.
Answer: A
QUESTION 89
Which three are valid replacements for foo so that the program will compiled and run?
public class ForTest {
public static void main(String[] args) {
int[] arrar = {1,2,3};
for ( foo ) {
}
}
}
A. int i: array
B. int i = 0; i < 1; i++
C. ;;
D. ; i < 1; i++
E. ; i < 1;
Answer: ABC
QUESTION 90
Given:
public class SampleClass {
public static void main(String[] args) {
AnotherSampleClass asc = new AnotherSampleClass(); SampleClass sc = new SampleClass();
sc = asc;
System.out.println("sc: " + sc.getClass());
System.out.println("asc: " + asc.getClass());
}}
class AnotherSampleClass extends SampleClass {
}
What is the result?
A. sc: class Object
asc: class AnotherSampleClass
B. sc: class SampleClass
asc: class AnotherSampleClass
C. sc: class AnotherSampleClass
asc: class SampleClass
D. sc: class AnotherSampleClass
asc: class AnotherSampleClass
Answer: D