Ensurepass.com : Ensure you pass the IT Exams
2018 Jan Oracle Official New Released 1z0-803
100% Free Download! 100% Pass Guaranteed!
http://www.EnsurePass.com/1z0-803.html
Java SE 7 Programmer I
Question No: 1
Given:
What is the result?
-
1 1
1
-
1 2
3
-
2 3
4
-
Compilation fails
-
The loop executes infinite times
Answer: E
Question No: 2
The catch clause argument is always of type .
-
Exception
-
Exception but NOT including RuntimeException
-
Throwable
-
RuntimeException
-
CheckedException
-
Error
Answer: C Explanation:
Because all exceptions in Java are the sub-class ofjava.lang.Exceptionclass, you can have a singlecatch blockthat catches an exception of typeExceptiononly. Hence the compiler is fooled into thinking that this block canhandle any exception.
See the following example:
try
{
// …
}
catch(Exception ex)
{
// Exception handling code for ANY exception
}
You can also use the java.lang.Throwable class here, since Throwable is the parent class for the application-specificException classes. However, this is discouraged in Java programming circles. This is because Throwable happens to also be the parent class for the non-application specific Error classes which are not meant to be handled explicitly as they are catered forby the JVM itself.
Note: The Throwable class is the superclass of all errors and exceptions in the Java language. Only objects that are instances of this class (or one of its subclasses) are thrown by the Java Virtual Machine or can be thrown by the Java throw statement.
A throwable contains a snapshot of the execution stack of its thread at the time it was created. It can also contain a message string that gives more information about the error.
Question No: 3
Which two items can legally be contained within a java class declaration?
-
An import statement
-
A field declaration
-
A package declaration
-
A method declaration
Answer: B,D
Reference: http://docs.oracle.com/javase/tutorial/java/javaOO/methods.html
Question No: 4
Given the code fragment:
Which code fragment prints blue, cyan, ?
-
Option A
-
Option B
-
Option C
-
Option D
Answer: A
Question No: 5
Given:
public class DoBreak1 {
public static void main(String[] args) { String[] table = {quot;aaquot;, quot;bbquot;, quot;ccquot;, quot;ddquot;}; for (String ss: table) {
if ( quot;bbquot;.equals(ss)){ continue;
}
System.out.println(ss); if ( quot;ccquot;.equals(ss)) { break;
}
}
}
}
What is the result?
-
aa cc
-
aa bb
cc
-
cc dd
-
cc
-
Compilation fails.
Answer: A
Question No: 6
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[] args) { Painting obj1 = new Painting(); Painting obj2 = new Painting(); obj1.setType(null); obj2.setType(quot;Frescoquot;);
System.out.print(obj1.getType() quot; : quot; obj2.getType());
}
}
What is the result?
-
: Fresco
-
null : Fresco
-
Fresco : Fresco
-
A NullPointerException is thrown at runtime
Answer: B
Question No: 7
Given:
What is true about the class Wow?
-
It compiles without error.
-
It does not compile because an abstract class cannot have private methods.
-
It does not compile because an abstract class cannot have instance variables.
-
It does not compile because an abstract class must have at least one abstract method.
-
It does not compile because an abstract class must have a constructor with no arguments.
Answer: A
Question No: 8
Given:
public class Equal {
public static void main(String[] args) { String str1 = quot;Javaquot;;
String[] str2 = {quot;Jquot;,quot;aquot;,quot;vquot;,quot;aquot;}; String str3 = quot;quot;;
for (String str : str2) { str3 = str3 str;
}
boolean b1 = (str1 == str3); boolean b2 = (str1.equals(str3)); System.out.print(b1 quot;, quot; b2);
}
What is the result?
-
true, false
-
false, true
-
true, true
-
false, false
Answer: B
Explanation: == strict equality. equals compare state, not identity.
Question No: 9
Given a java source file:
What changes will make this code compile? (Select Two)
-
Adding the public modifier to the declaration of class x
-
Adding the protected modifier to the x() constructor
-
Changing the private modifier on the declaration of the one() method to protected
-
Removing the Y () constructor
-
Removing the private modifier from the two () method
Answer: C,E Explanation:
Using the private protected, instead of the private modifier, for the declaration of the one() method, would enable the two() method to access the one() method.
Question No: 10
Given the code fragment:
float x = 22.00f % 3.00f; int y = 22 % 3;
System.out.print(x quot;, quot; y); What is the result?
A. 1.0, 1
B. 1.0f, 1
C. 7.33, 7
-
Compilation fails
-
An exception is thrown at runtime
Answer: A
100% Ensurepass Free Download!
–Download Free Demo:1z0-803 Demo PDF
100% Ensurepass Free Guaranteed!
–1z0-803 Dumps
EnsurePass | ExamCollection | Testking | |
---|---|---|---|
Lowest Price Guarantee | Yes | No | No |
Up-to-Dated | Yes | No | No |
Real Questions | Yes | No | No |
Explanation | Yes | No | No |
PDF VCE | Yes | No | No |
Free VCE Simulator | Yes | No | No |
Instant Download | Yes | No | No |
100-105 Dumps VCE PDF
200-105 Dumps VCE PDF
300-101 Dumps VCE PDF
300-115 Dumps VCE PDF
300-135 Dumps VCE PDF
300-320 Dumps VCE PDF
400-101 Dumps VCE PDF
640-911 Dumps VCE PDF
640-916 Dumps VCE PDF
70-410 Dumps VCE PDF
70-411 Dumps VCE PDF
70-412 Dumps VCE PDF
70-413 Dumps VCE PDF
70-414 Dumps VCE PDF
70-417 Dumps VCE PDF
70-461 Dumps VCE PDF
70-462 Dumps VCE PDF
70-463 Dumps VCE PDF
70-464 Dumps VCE PDF
70-465 Dumps VCE PDF
70-480 Dumps VCE PDF
70-483 Dumps VCE PDF
70-486 Dumps VCE PDF
70-487 Dumps VCE PDF
220-901 Dumps VCE PDF
220-902 Dumps VCE PDF
N10-006 Dumps VCE PDF
SY0-401 Dumps VCE PDF