Share some OCP 1Z0-805 exam questions and answers below.
Given the code fragment:
List
Which statement is true?
A. Read access to the List should be synchronized.
B. Write access to the List should be synchronized.
C. Person objects retrieved from the List are thread-safe.
D. A Person object retrieved from the List is copied when written to.
E. Multiple threads can safely delete Person objects from the List.
Answer: C
Given three resource bundles with these values set for menu1: ( The default resource bundle is written in US English.)
English US resource Bundle Menu1 = small
French resource Bundle Menu1 = petit
Chinese Resource Bundle Menu = 1
And given the code fragment:
Locale.setDefault (new Locale("es", "ES")); // Set default to Spanish and Spain loc1 = Locale.getDefault();
ResourceBundle messages = ResourceBundle.getBundle ("messageBundle", loc1); System.out.println
(messages.getString("menu1")); What is the result?
A. No message is printed
B. petit
C. :
D. Small
E. A runtime error is produced
Answer: E
Which two statements are true about the walkFileTree method of the files class?
A. The file tree traversal is breadth-first with the given FileVisitor invoked for each file encountered.
B. If the file is a directory, and if that directory could not be opened, the postVisitFileFailed method is invoked with the I/O exception.
C. The maxDepth parameter’s value is the maximum number of directories to visit.
D. By default, symbolic links are not automatically followed by the method.
Answer: C,D
What design pattern does the Drivermanager.getconnection () method characterize?
A. DAO
B. Factory
C. Singleton
D. composition
Answer: B
No comments:
Post a Comment