Info For 1Z0-803 Exam 100% Pass: PassLeader provides you with the newest 1Z0-803 169q exam questions updated in recent days to prepare your 1Z0-803 certification exams. Our best 1Z0-803 169q exam dumps will offer you the newest questions and answers with premium VCE and PDF format to download. And PassLeader also offer you the latest free version VCE Player!
Vendor: Oracle
Exam Code: 1Z0-803
Exam Name: Java SE 7 Programmer I
QUESTION 46
Given the code fragment:
String valid = “true”;
if (valid) System.out.println (“valid”);
else system.out.println (“not valid”);
What is the result?
A. Valid
B. not valid
C. Compilation fails
D. An IllegalArgumentException is thrown at run time
Answer: C
QUESTION 47
Given:
public class ScopeTest {
int z;
public static void main(String[] args){
ScopeTest myScope = new ScopeTest();
int z = 6;
System.out.println(z);
myScope.doStuff();
System.out.println(z);
System.out.println(myScope.z);
}
void doStuff() {
int z = 5;
doStuff2();
System.out.println(z);
}
void doStuff2() {
z=4;
}
}
What is the result?
A. 6 5 6 4
B. 6 5 5 4
C. 6 5 6 6
D. 6 5 6 5
Answer: A
QUESTION 48
Which two are valid instantiations and initializations of a multi dimensional array?
A. int [] [] array 2D ={ { 0, 1, 2, 4} {5, 6}};
B. int [] [] array2D = new int [2] [2];
array2D[0] [0] = 1;
array2D[0] [1] =2;
array2D[1] [0] =3;
array2D[1] [1] =4;
C. int [] [] []array3D = {{0, 1}, {2, 3}, {4, 5}};
D. int [] [] [] array3D = new int [2] [2] [2];
array3D [0] [0] = array;
array3D [0] [1] = array;
array3D [1] [0] = array;
array3D [0] [1] = array;
E. int [] [] array2D = {0, 1};
Answer: BD
QUESTION 49
An unchecked exception occurs in a method dosomething(). Should other code be added in the dosomething() method for it to compile and execute?
A. The Exception must be caught
B. The Exception must be declared to be thrown.
C. The Exception must be caught or declared to be thrown.
D. No other code needs to be added.
Answer: C
QUESTION 50
Given the code fragment:
int b = 4;
b — ;
System.out.println (– b);
System.out.println(b);
What is the result?
A. 2 2
B. 1 2
C. 3 2
D. 3 3
Answer: A
QUESTION 51
Given the code fragment:
interface SampleClosable {
public void close () throws java.io.IOException;
}
Which three implementations are valid?
A. public class Test implements SampleCloseable {
Public void close () throws java.io.IOException {
/ /do something
}
}
B. public class Test implements SampleCloseable {
Public void close () throws Exception {
/ / do something
}
}
C. public class Test implements SampleCloseable {
public void close() throws java.io.FileNotFoundException { / / do something
}
}
D. public classTest extends SampleCloseable {
Public voidclose ()throws java.IO.IOException{
/ / do something
}
}
E. public class Test implements SampleCloseable {
public void close() / / do something
}
}
Answer: ACE
QUESTION 52
Given the following code:
public class Simple { /* Line 1 */
public float price; /* Line 2 */
public static void main (String[] args) { /* Line 3 */
Simple price = new Simple (); /* Line 4 */
price = 4; /* Line 5 */
} /* Line 6 */
} /* Line 7 */
What will make this code compile and run?
A. Change line 2 to the following:
Publicint price
B. Change line 4 to the following:
int price = new simple ();
C. Change line 4 to the following:
Floatprice = new simple ();
D. Change line 5 to the following:
Price = 4f;
E. Change line 5 to the following:
price.price = 4;
F. Change line 5 to the following:
Price= (float) 4:
G. Change line 5 to the following:
Price= (Simple) 4;
H. The code compiles and runs properly; no changes are necessary
Answer: E
http://www.passleader.com/1z0-803.html
QUESTION 53
Given:
public class DoWhile {
public static void main (String [] args) {
int ii = 2;
do {
System.out.println (ii);
} while (–ii);
}
}
What is the result?
A. 2
1
B. 2
1
0
C. null
D. an infinite loop
E. compilation fails
Answer: E
QUESTION 54
You are writing a method that is declared not to return a value. Which two are permitted in the method body?
A. omission of the return statement
B. return null;
C. return void;
D. return;
Answer: AD
QUESTION 55
Identify two benefits of using ArrayList over array in software development.
A. reduces memory footprint
B. implements the Collection API
C. is multi.thread safe
D. dynamically resizes based on the number of elements in the list
Answer: AD
QUESTION 56
Which three are valid types for switch?
A. int
B. float
C. double
D. integer
E. String
F. Float
Answer: ADE
QUESTION 57
Give:
public class MyFive {
static void main(String[] args) {
short ii;
short jj = 0;
for (ii = kk;ii > 6; ii -= 1) { // line x //
jj++;
}
System.out.println(“jj = ” + jj);
}
}
What value should replace KK in line x to cause jj = 5 to be output?
A. -1
B. 1
C. 5
D. 8
E. 11
Answer: E
QUESTION 58
Given the following code fragment:
if (value >= 0) {
if (value != 0)
System.out.print(“the “);
else
System.out.print(“quick “);
if (value < 10)
System.out.print(“brown “);
if (value > 30)
System.out.print(“fox “);
else if (value < 50)
System.out.print(“jumps “);
else if (value < 10)
System.out.print(“over “);
else
System.out.print(“the “);
if (value > 10)
System.out.print(“lazy “);
} else {
System.out.print(“dog “);
}
System.out.print(“… “);
}
What is the result if the integer value is 33?
A. The fox jump lazy…
B. The fox lazy…
C. Quick fox over lazy …
D. Quick fox the ….
Answer: B
QUESTION 59
Given the code fragment:
Int [] [] array = {{0}, {0, 1}, {0, 2, 4}, {0, 3, 6, 9}, {0, 4, 8, 12, 16}};
Systemout.printIn(array [4] [1]);
System.out.printIn (array) [1][4]);
int [] [] array = {{0}, {0, 1}, {0, 2, 4}, {0, 3, 6, 9}, {0, 4, 8, 12, 16}};
System.out.println(array [4][1]);
System.out.println(array) [1][4]);
What is the result?
A. 4 Null
B. Null 4
C. An IllegalArgumentException is thrown at run time
D. 4 An ArrayIndexOutOfBoundException is thrown at run time
Answer: D
QUESTION 60
Given:
public class DoCompare1 {
public static void main(String[] args) {
String[] table = {“aa”, “bb”, “cc”};
for (String ss: table) {
int ii = 0;
while (ii < table.length) {
System.out.println(ss + “, ” + ii);
ii++;
}
}
How many times is 2 printed as a part of the output?
A. Zero
B. Once
C. Twice
D. Thrice
E. Compilation fails.
Answer: D