• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
  • paul wheaton
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Rob Spoor
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:

Sybex Practice Tests 11, possible errata, chapter 7, Q 57 and Q 58 and Q 59

 
Ranch Hand
Posts: 74
2
Mac IntelliJ IDE Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there,

Question 57 on page 258 asks what needs to be included in the module-info for it to be a service provider:

Question 56:
You have the following interface in a module named animal.insect.api.



Question 57:
And you have the following class in a module named animal.insect.impl and the service provider interface module from question 56 (from above). What needs to be included in the module-info for it to be a service provider? (Choose two.)



A. requires animal.insect.api.bugs;
B. requires animal.insect.lookup;
C. requires animal.printer;
D. provides animal.insect.impl.Worm;
E. provides animal.insect.api.bugs.Bug with animal.insect.impl.Worm;
F. provides animal.insect.impl.Worm with animal.insect.api.bugs.Bug;

And the answer on page 514 is:

A, E. This module is a service provider. It needs a requires directive for the service provider interface, which is option A. It also needs a provides directive which specifies both the interface and implementation. Option E has both in the correct order.

But A is not right because the directive is:

requires <module> not requires <package>

And question 58 also:

Suppose you have the following class in a module named animal.insect.lookup, the service provider interface from question 56 (from above), and the service provider from question 57. What needs to be included in the module-info file besides an exports directive for it to be a service locator? (Choose two.)



A. provides animal.insect.lookup;
B. provides animal.insect.lookup.InsectFinder;
C. requires animal.insect.api.bugs;
D. requires animal.insect.api.Bug;
E. uses animal.insect.api.bugs;
F. uses animal.insect.api.bugs.Bug;

And the answer on page 514 is:

C,F. This module is a service locator. It needs three directives: exports, requires, and uses. The requires directive specifies the module it depends on, which is option C. The uses directive specifies the service provider interface it references, which is option F.

Answer C is not right because like on question 58 requires directive needs a module not a package! And animal.insect.api.bugs is a package. In question 56 they name the interface module animal.insect.api not animal.insect.api.bugs

And the same problem is on question 59, with answer A,B, but A is not right because in A in the requires directive the package animal.insect.api.bugs is mentioned but it should be the module animal.insect.api!

 
author & internet detective
Posts: 41763
887
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Doh! You are correct. Added to the errata.
 
Greenhorn
Posts: 7
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ch 7 #57 has been added twice to the list on https://www.selikoff.net/ocp11-pt/.
I think Ch 7 #58 and #59 should be added, and Ch 7 #57 only once.
 
Jeanne Boyarsky
author & internet detective
Posts: 41763
887
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Added 58 to errata. 59 is on our "list of things to check if they should be clarified"
 
I'm not dead! I feel happy! I'd like to go for a walk! I'll even read a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic