Master the 1z0 808 practice test Java SE 8 Programmer I content and be ready for exam day success quickly with this Examcollection exam 1z0 808 practice exam. We guarantee it!We make it a reality and give you real 1z0 808 java se 8 programmer i questions in our Oracle java se 8 programmer i 1z0 808 braindumps.Latest 100% VALID Oracle 1z0 808 dumps pdf Exam Questions Dumps at below page. You can use our Oracle java se 8 programmer i 1z0 808 dumps braindumps and pass your exam.
Q41. Given the fragment:
What is the result?
A. 13480.0
B. 13480.02
C. Compilation fails
D. An exception is thrown at runtime
Answer: A
Q42. Given:
What is the result?
A. Option A
B. Option B
C. Option C
D. Option D
Answer: B
Q43. 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);
}
}
What is the result?
A. 10 10
B. 8 9
C. 9 8
D. 7 10
Answer: A
Q44. Given the code fragment:
float x = 22.00f % 3.00f;
int y = 22 % 3;
System.out.print(x + ", "+ y);
What is the result?
A. 1.0, 1
B. 1.0f, 1
C. 7.33, 7
D. Compilation fails
E. An exception is thrown at runtime
Answer: A
Q45. Given the classes:
* AssertionError
* ArithmeticException
* ArrayIndexOutofBoundsException
* FileNotFoundException
* IllegalArgumentException
* IOError
* IOException
* NumberFormatException
* SQLException
Which option lists only those classes that belong to the unchecked exception category?
A. AssertionError, ArrayIndexOutOfBoundsException, ArithmeticException
B. AssertionError, IOError, IOException
C. ArithmeticException, FileNotFoundException, NumberFormatException
D. FileNotFoundException, IOException, SQLException
E. ArrayIndexOutOfBoundException, IllegalArgumentException, FileNotFoundException
Answer: A
Explanation: Not B: IOError and IOException are both checked errors.
Not C, not D, not E: FileNotFoundException is a checked error.
Note:
Checked exceptions:
* represent invalid conditions in areas outside the immediate control of the program (invalid user input, database problems, network outages, absent files)
* are subclasses of Exception
* a method is obliged to establish a policy for all checked exceptions thrown by its implementation (either pass the checked exception further up the stack, or handle it
somehow)
Note:
Unchecked exceptions:
* represent defects in the program (bugs) - often invalid arguments passed to a non-private method. To quote from The Java Programming Language, by Gosling, Arnold, and Holmes: "Unchecked runtime exceptions represent conditions that, generally speaking, reflect errors in your program's logic and cannot be reasonably recovered from at run time."
* are subclasses of RuntimeException, and are usually implemented using IllegalArgumentException, NullPointerException, or IllegalStateException
* method is not obliged to establish a policy for the unchecked exceptions thrown by its implementation (and they almost always do not do so)
Q46. View the exhibit.
Given the code fragment:
Which change enables the code to print the following?
James age: 20
Williams age: 32
A. Replacing line 5 with public static void main (String [] args) throws MissingInfoException, AgeOutofRangeException {
B. Replacing line 5 with public static void main (String [] args) throws.Exception {
C. Enclosing line 6 and line 7 within a try block and adding: catch(Exception e1) { //code goes here} catch (missingInfoException e2) { //code goes here} catch (AgeOutofRangeException e3) {//code goes here}
D. Enclosing line 6 and line 7 within a try block and adding: catch (missingInfoException e2) { //code goes here} catch (AgeOutofRangeException e3) {//code goes here}
Answer: C
Q47. Which statement best describes encapsulation?
A. Encapsulation ensures that classes can be designed so that only certain fields and methods of an object are accessible from other objects.
B. Encapsulation ensures that classes can be designed so that their methods are inheritable.
C. Encapsulation ensures that classes can be designed with some fields and methods declared as abstract.
D. Encapsulation ensures that classes can be designed so that if a method has an argument MyType x, any subclass of MyType can be passed to that method.
Answer: A
Q48. Given the code fragment:
Which code fragment, when inserted at line n1, enables the App class to print Equal?
A. Option A
B. Option B
C. Option C
D. Option D
Answer: B
Q49. Which statement will empty 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
Q50. 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