nerdexam
Oracle

1Z0-805 · Question #76

1Z0-805 Question #76: Real Exam Question with Answer & Explanation

Sign in or unlock 1Z0-805 to reveal the answer and full explanation for question #76. The question stem and answer options stay visible for context.

Question

Given: public class MyGrades { private final List<Integer> myGrades = new ArrayList<Integer>(); private final ReadWriteLock rwlock = new ReentrantReadWriteLock(); public void addGrade(Integer grade) { // acquire _______ lock myGrades.add(grade); // release __________ lock } public void averageGrades() { Oracle 1Z0-805 Exam // 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 lines ** and lines *** (respectively) to acquire and release the most appropriate lock?

Options

  • Arwlock.readLock().acquire();
  • Brwlock.readLock().lock();
  • Crwlock.getLock().acquire();
  • Drwlock.getLock().lock();
  • Erelock.WriteLock().acquire();
  • Frwlock.writeLock().lock();

Unlock 1Z0-805 to see the answer

You've previewed enough free 1Z0-805 questions. Unlock 1Z0-805 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.

Full 1Z0-805 Practice
Given: public class MyGrades { private final List<Integer myGrades... | 1Z0-805 Q#76 Answer | NerdExam