Online Access Free 1Z1-805 Practice Test

Exam Code:1Z1-805
Exam Name:Upgrade to Java SE 7 Programmer
Certification Provider:Oracle
Free Question Number:90
Posted:Oct 30, 2025
Rating
100%

Question 1

Given the code fragment:
/* method declaration */ { try {
String className = "java.lang.String";
String fieldname = "somefield";
Class c = Class.forName(className);
Field f = c.getField(fieldname);
} catch(Exception e) {
e.printStackTrace();
throw e;
}
}
Which two method declarations are valid options to replace /* method declaration */?

Question 2

Which three must be used when using the Java.util.concurrent package to execute a task that returns a result without blocking?

Question 3

Given:
public class MyGrades {
private final List<Integer> myGrades = new ArrayList<Integer>();
private final ReadWriteLock rwlock = new ReentrantReadWriteLock();
public void addGrade(Integer grade) {
/*
lock and modify
*/
}
public void averageGrades() {
// acquire _______ lock Line **
double sum = 0;
int i = 0;
for (i = 0; i < myGrades.size(); i++) {
sum += myGrades.get(i);
}
// release __________ lock Line ***
System.out.println("The average is: " + sum/(i+1));
}
}
Which pair's statements should you insert at line ** and line *** (respectively) to acquire and release the most appropriate lock?

Question 4

Given the code fragment: SimpleDateFormat sdf = new SimpleDateFormat("zzzz", Locale.US);
System.out.println ("Result: " + sdf.format(today) ) ;
What type of result is printed?

Question 5

What are two benefits of a Factory design pattern?

Add Comments

Your email address will not be published. Required fields are marked *

insert code
Type the characters from the picture.